Documentation ¶
Index ¶
- Variables
- func DeleteAPIToken(tokenStore TokenStore, rawToken string) error
- type GenerateAPITokenHandler
- type GenerateAPITokenParams
- type GenerateAPITokenWalletParams
- type ListAPITokensResult
- type Manager
- func (m *Manager) ConnectedWallet(ctx context.Context, hostname string, token Token) (api.ConnectedWallet, *jsonrpc.ErrorDetails)
- 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 Session
- type SessionStore
- type TimeService
- type Token
- type TokenDescription
- type TokenStore
- type TokenSummary
- type WalletCredentials
- type WalletStore
Constants ¶
This section is empty.
Variables ¶
View Source
var ( 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, sessionStore SessionStore, interactor api.Interactor) (*Manager, error)
func (*Manager) ConnectedWallet ¶
func (m *Manager) ConnectedWallet(ctx context.Context, hostname string, token Token) (api.ConnectedWallet, *jsonrpc.ErrorDetails)
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 SessionStore ¶ added in v0.72.0
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) (bool, error) ListTokens() ([]TokenSummary, error) DescribeToken(Token) (TokenDescription, error) SaveToken(TokenDescription) error DeleteToken(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 ¶
type WalletStore ¶
type WalletStore interface { WalletExists(ctx context.Context, name string) (bool, error) UnlockWallet(ctx context.Context, name, passphrase string) error IsWalletAlreadyUnlocked(ctx context.Context, name string) (bool, error) GetWallet(ctx context.Context, name string) (wallet.Wallet, error) OnUpdate(callbackFn func(context.Context, wallet.Event)) }
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |
store
|
|
Click to show internal directories.
Click to hide internal directories.