Documentation ¶
Index ¶
- Variables
- func DeleteAPIToken(tokenStore TokenStore, rawToken string) error
- type GenerateAPITokenHandler
- type GenerateAPITokenParams
- type GenerateAPITokenWalletParams
- type ListAPITokensResult
- type Manager
- func (m *Manager) ConnectedWallet(hostname string, token Token) (api.ConnectedWallet, error)
- func (m *Manager) EndAllSessionConnections()
- func (m *Manager) EndSessionConnection(hostname, walletName string)
- func (m *Manager) EndSessionConnectionWithToken(token Token)
- func (m *Manager) ListSessionConnections() []api.Connection
- func (m *Manager) StartSession(hostname string, w wallet.Wallet) (Token, error)
- type TimeService
- type Token
- type TokenDescription
- type TokenStore
- type TokenSummary
- type WalletCredentials
- type WalletStore
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrConnectionHasBeenClosed = errors.New("the connection has been closed") ErrExpirationDurationMustBeGreaterThan0 = errors.New("the expiration duration must be greater than 0") ErrHostnamesMismatchForThisToken = errors.New("the hostname from the request does not match the one that initiated the connection") ErrInvalidTokenFormat = errors.New("the token has not a valid format") ErrNoConnectionAssociatedThisAuthenticationToken = errors.New("there is no connection associated to this authentication token") ErrTokenDoesNotExist = errors.New("the token does not exist") ErrTokenHasExpired = errors.New("the token has expired") ErrTokenIsRequired = errors.New("the token is required") ErrWalletNameIsRequired = errors.New("the wallet name is required") ErrWalletPassphraseIsRequired = errors.New("the wallet passphrase is required") )
Functions ¶
func DeleteAPIToken ¶
func DeleteAPIToken(tokenStore TokenStore, rawToken string) error
Types ¶
type GenerateAPITokenHandler ¶
type GenerateAPITokenHandler struct {
// contains filtered or unexported fields
}
func NewGenerateAPITokenHandler ¶
func NewGenerateAPITokenHandler( walletStore api.WalletStore, tokenStore TokenStore, timeService TimeService, ) *GenerateAPITokenHandler
func (*GenerateAPITokenHandler) Handle ¶
func (h *GenerateAPITokenHandler) Handle(ctx context.Context, params GenerateAPITokenParams) (Token, error)
type GenerateAPITokenParams ¶
type GenerateAPITokenParams struct { Description string `json:"name"` ExpiresIn *time.Duration `json:"expireIn"` Wallet GenerateAPITokenWalletParams `json:"wallet"` }
type ListAPITokensResult ¶
type ListAPITokensResult struct {
Tokens []TokenSummary `json:"tokens"`
}
func ListAPITokens ¶
func ListAPITokens(tokenStore TokenStore) (ListAPITokensResult, error)
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager holds the opened connections between the third-party applications and the wallets.
func NewManager ¶
func NewManager(timeService TimeService, walletStore WalletStore, tokenStore TokenStore) (*Manager, error)
func (*Manager) ConnectedWallet ¶
ConnectedWallet retrieves the wallet associated to the specified token.
func (*Manager) EndAllSessionConnections ¶
func (m *Manager) EndAllSessionConnections()
func (*Manager) EndSessionConnection ¶
func (*Manager) EndSessionConnectionWithToken ¶
func (*Manager) ListSessionConnections ¶
func (m *Manager) ListSessionConnections() []api.Connection
ListSessionConnections lists all the session connections as a list of pairs of hostname/wallet name. The list is sorted, first, by hostname, and, then, by wallet name.
type TimeService ¶
type TokenDescription ¶
type TokenDescription struct { Description string `json:"description"` CreationDate time.Time `json:"creationDate"` ExpirationDate *time.Time `json:"expirationDate"` Token Token `json:"token"` Wallet WalletCredentials `json:"wallet"` }
func DescribeAPIToken ¶
func DescribeAPIToken(tokenStore TokenStore, rawToken string) (TokenDescription, error)
type TokenStore ¶
type TokenStore interface { TokenExists(token Token) (bool, error) ListTokens() ([]TokenSummary, error) DescribeToken(token Token) (TokenDescription, error) SaveToken(tokenConfig TokenDescription) error DeleteToken(token Token) error OnUpdate(callbackFn func(ctx context.Context, tokens ...TokenDescription)) }
TokenStore is the component used to retrieve and update the API tokens from the computer.
type TokenSummary ¶
type WalletCredentials ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.