Documentation ¶
Overview ¶
Package accesstoken provides storage and validation of Chain Core credentials.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrBadID is returned when Create is called on an invalid id string. ErrBadID = errors.New("invalid id") // ErrDuplicateID is returned when Create is called on an existing ID. ErrDuplicateID = errors.New("duplicate access token ID") // ErrBadType is returned when Create is called with a bad type. ErrBadType = errors.New("type must be client or network") // ErrNoMatchID is returned when Delete is called on nonexisting ID. ErrNoMatchID = errors.New("nonexisting access token ID") // ErrInvalidToken is returned when Check is called on invalid token ErrInvalidToken = errors.New("invalid token") )
Functions ¶
This section is empty.
Types ¶
type CredentialStore ¶
CredentialStore store user access credential.
func NewStore ¶
func NewStore(db dbm.DB) *CredentialStore
NewStore creates and returns a new Store object.
func (*CredentialStore) Check ¶
func (cs *CredentialStore) Check(id string, secret string) error
Check returns whether or not an id-secret pair is a valid access token.
func (*CredentialStore) Create ¶
func (cs *CredentialStore) Create(id, typ string) (*Token, error)
Create generates a new access token with the given ID.
func (*CredentialStore) Delete ¶
func (cs *CredentialStore) Delete(id string) error
Delete deletes an access token by id.
func (*CredentialStore) List ¶
func (cs *CredentialStore) List() ([]*Token, error)
List lists all access tokens.
Click to show internal directories.
Click to hide internal directories.