Documentation ¶
Overview ¶
Package apiauth provides persistent authorization based on boltdb.
Index ¶
- type AccessAuth
- type Account
- type Authorizer
- func (a *Authorizer) AddAccount(username string, password string, notBefore time.Time, notAfter time.Time) error
- func (a *Authorizer) Close() error
- func (a *Authorizer) CreateSession(address string, username string, password string) (*Session, error)
- func (a *Authorizer) ListAccounts() ([]*Account, error)
- func (a *Authorizer) RefreshSession(address string, refreshToken string) (*Session, error)
- func (a *Authorizer) RemoveAccount(username string) error
- func (a *Authorizer) RemoveSession(refreshToken string) error
- func (a *Authorizer) VerifyAccessToken(address string, accessToken string) (string, error)
- type Config
- type Login
- type RefreshAuth
- type ScryptConfig
- type Session
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccessAuth ¶
type Authorizer ¶
type Authorizer struct {
// contains filtered or unexported fields
}
func (*Authorizer) AddAccount ¶
func (*Authorizer) Close ¶
func (a *Authorizer) Close() error
func (*Authorizer) CreateSession ¶
func (*Authorizer) ListAccounts ¶
func (a *Authorizer) ListAccounts() ([]*Account, error)
func (*Authorizer) RefreshSession ¶
func (a *Authorizer) RefreshSession(address string, refreshToken string) (*Session, error)
func (*Authorizer) RemoveAccount ¶
func (a *Authorizer) RemoveAccount(username string) error
RemoveAccount revokes any authentication of an account and deletes it.
func (*Authorizer) RemoveSession ¶
func (a *Authorizer) RemoveSession(refreshToken string) error
func (*Authorizer) VerifyAccessToken ¶
func (a *Authorizer) VerifyAccessToken(address string, accessToken string) (string, error)
type Config ¶
type Config struct { // AccessTokenLength define the length of the access token // used to make requests. AccessTokenLength int `json:"accessTokenLength"` // AccessDurationSeconds defines how many seconds the access token // will be valid. AccessDurationSeconds int `json:"accessDurationSeconds"` // RefreshTokenLength defines the length of the refresh token // used to continue a session. RefreshTokenLength int `json:"refreshTokenLength"` // RefreshDurationSeconds defines how many seconds the refresh token // will be valid. RefreshDurationSeconds int `json:"refreshDurationSeconds"` // Scrypt configuration parameters. Scrypt ScryptConfig `json:"scrypt"` }
type RefreshAuth ¶
type ScryptConfig ¶
type ScryptConfig struct { // CPU/memory cost parameter (logN) N int `json:"n"` // block size parameter (octets) R int `json:"r"` // parallelisation parameter (positive int) P int `json:"p"` // bytes to use as salt (octets) SaltLen int `json:"saltLen"` // length of the derived key (octets) KeyLen int `json:"keyLen"` }
func (*ScryptConfig) MemoryRequiredMB ¶
func (s *ScryptConfig) MemoryRequiredMB() int
func (*ScryptConfig) TimeRequiredMS ¶
func (s *ScryptConfig) TimeRequiredMS() (int, error)
Click to show internal directories.
Click to hide internal directories.