Documentation ¶
Overview ¶
Package api exposes all the wallet capabilities to manage connections, wallets, keys, and transactions.
It is built with th JSON-RPC v2 standard. More info: See https://www.jsonrpc.org/specification for more information.
Terminology ¶
User:
The user is the actor behind the API that has the responsibility to review and validate the requests. It can be a human or a bot.
Wallet front-end:
The wallet front-end is the interface through which the user interact with the API. It can be a command-line interface, a graphical user-interface, or a script.
Third-party application:
The application that connects to the API (through HTTP or directly to JSON-RPC) to access wallets information, send transaction, etc.
Third-party application connection workflow ¶
Before sending transaction, a third-party application must initiate a connection. The connection workflow consists of:
Obtaining a connection token.
Verifying if the state of the permissions given to the connection.
Request additional permissions if needed.
## 1. Obtaining a connection token
A connection token is required to access the protected methods.
There are two type of tokens, and the way to obtain them differs: - Temporary tokens - Long-living tokens
Once obtained, this token must be used to value the `token` property in the requests payload of protected endpoints.
### Temporary tokens
A temporary token is unique, randomly generated and is only valid for the duration of the connection between the third-party application and the wallet service.
If any of the third-party application or the wallet service decide to end the connection, the token is voided. It can't be reused. There is no need for third-party applications to save this token for future use.
This token is issued when the third-party application explicitly request a connection to a wallet through the `client.connect_wallet` endpoint.
To end the connection, the third-party application can call the `client.disconnect_wallet`. endpoint. Once called, the token can no longer be used.
Explicitly requiring a connection requires manual intervention from the user to review to connection. While this type of token useful for auditing the connections, and make them short-living, it's not suited for a headless software (like bots, simulator, etc.) that requires full automation and complete independence. For that type of software, long-living-tokens are better suited.
### Long-living tokens
A long-living token, just like a temporary one, is unique and randomly generated. However, it's not voided when the connection between the third-party application, and the wallet service ends, nor when the service shutdowns.
Akin to a traditional API token, it can be reused. This aspect makes is particularly useful for a headless software to operate independently.
A long-living token must be generated in advance, before the service starts. through the `admin.generate_service_token` endpoint. Once generated, and the service started, the headless application can skip the call to the `client.connect_wallet` endpoint, and directly start calling the protected endpoints.
It's not possible to close a connection initiated with a long-living token. Calling the `client.disconnect_wallet`.
## 2. Verifying the permissions
To ensure a fine-grained control on what a third-party application can or can't do, the users can associate a set of permissions to the third-party application connection.
In order to figure out what's the state of the permission, the third-party application must call the `client.get_permissions` endpoint and compare the result with what it requires. It's up to the third-party application to determine what it needs access to, and to which extent.
If it has enough permission, then it can proceed with the call to other protected methods. If it doesn't, it has to request additional ones.
## 3. Requesting permissions
If, for any reason, the third-party application doesn't have enough permissions to do its job, it has to request addition ones through the `client.request_permissions` endpoint.
Index ¶
- Constants
- Variables
- func AdminAPI(log *zap.Logger, walletStore WalletStore, netStore NetworkStore, ...) (*jsonrpc.API, error)
- func ClientAPI(log *zap.Logger, walletStore WalletStore, interactor Interactor, ...) (*jsonrpc.API, error)
- func HostnameFromContext(ctx context.Context) string
- func TraceIDFromContext(ctx context.Context) string
- type AdminAnnotateKey
- type AdminAnnotateKeyParams
- type AdminAnnotateKeyResult
- type AdminCloseConnection
- type AdminCloseConnectionParams
- type AdminCloseConnectionsToHostname
- type AdminCloseConnectionsToHostnameParams
- type AdminCloseConnectionsToWallet
- type AdminCloseConnectionsToWalletParams
- type AdminCreateWallet
- type AdminCreateWalletParams
- type AdminCreateWalletResult
- type AdminCreatedWallet
- type AdminDeleteAPIToken
- type AdminDeleteAPITokenParams
- type AdminDescribeAPIToken
- type AdminDescribeAPITokenParams
- type AdminDescribeAPITokenResult
- type AdminDescribeKey
- type AdminDescribeKeyParams
- type AdminDescribeKeyResult
- type AdminDescribeNetwork
- type AdminDescribeNetworkParams
- type AdminDescribeNetworkResult
- type AdminDescribePermissions
- type AdminDescribePermissionsParams
- type AdminDescribePermissionsResult
- type AdminDescribeWallet
- type AdminDescribeWalletParams
- type AdminDescribeWalletResult
- type AdminFirstPublicKey
- type AdminGenerateAPIToken
- type AdminGenerateAPITokenParams
- type AdminGenerateAPITokenResult
- type AdminGenerateAPITokenWalletParams
- type AdminGenerateKey
- type AdminGenerateKeyParams
- type AdminGenerateKeyResult
- type AdminImportNetwork
- type AdminImportNetworkParams
- type AdminImportNetworkResult
- type AdminImportWallet
- type AdminImportWalletParams
- type AdminImportWalletResult
- type AdminImportedWallet
- type AdminIsolateKey
- type AdminIsolateKeyParams
- type AdminIsolateKeyResult
- type AdminLastBlockData
- type AdminListAPITokens
- type AdminListAPITokensResult
- type AdminListConnections
- type AdminListConnectionsParams
- type AdminListConnectionsResult
- type AdminListKeys
- type AdminListKeysParams
- type AdminListKeysResult
- type AdminListNetworks
- type AdminListNetworksResult
- type AdminListPermissions
- type AdminListPermissionsParams
- type AdminListPermissionsResult
- type AdminListWallets
- type AdminListWalletsResult
- type AdminNamedPublicKey
- type AdminPurgePermissions
- type AdminPurgePermissionsParams
- type AdminRemoveNetwork
- type AdminRemoveNetworkParams
- type AdminRemoveWallet
- type AdminRemoveWalletParams
- type AdminRenameWallet
- type AdminRenameWalletParams
- type AdminRevokePermissions
- type AdminRevokePermissionsParams
- type AdminRotateKey
- type AdminRotateKeyParams
- type AdminRotateKeyResult
- type AdminSendRawTransaction
- type AdminSendRawTransactionParams
- type AdminSendRawTransactionResult
- type AdminSendTransaction
- type AdminSendTransactionParams
- type AdminSendTransactionResult
- type AdminSignMessage
- type AdminSignMessageParams
- type AdminSignMessageResult
- type AdminSignTransaction
- type AdminSignTransactionParams
- type AdminSignTransactionResult
- type AdminStartService
- type AdminStartServiceParams
- type AdminStartServiceResult
- type AdminStopService
- type AdminStopServiceParams
- type AdminTaintKey
- type AdminTaintKeyParams
- type AdminUntaintKey
- type AdminUntaintKeyParams
- type AdminUpdateNetwork
- type AdminUpdateNetworkParams
- type AdminUpdatePassphrase
- type AdminUpdatePassphraseParams
- type AdminUpdatePermissions
- type AdminUpdatePermissionsParams
- type AdminUpdatePermissionsResult
- type AdminVerifyMessage
- type AdminVerifyMessageParams
- type AdminVerifyMessageResult
- type ClientConnectWallet
- type ClientConnectWalletResult
- type ClientDisconnectWallet
- type ClientDisconnectWalletParams
- type ClientGetChainID
- type ClientGetChainIDResult
- type ClientGetPermissions
- type ClientGetPermissionsParams
- type ClientGetPermissionsResult
- type ClientListKeys
- type ClientListKeysParams
- type ClientListKeysResult
- type ClientNamedPublicKey
- type ClientParsedSendTransactionParams
- type ClientParsedSignTransactionParams
- type ClientRequestPermissions
- type ClientRequestPermissionsParams
- type ClientRequestPermissionsResult
- type ClientSendTransaction
- type ClientSendTransactionParams
- type ClientSendTransactionResult
- type ClientSignTransaction
- type ClientSignTransactionParams
- type ClientSignTransactionResult
- type ErrorType
- type EventListener
- type Interactor
- type InteractorBuilderFunc
- type LogType
- type LoggerBuilderFunc
- type NetworkStore
- type NodeSelectorBuilder
- type ParsedAdminSendRawTransactionParams
- type ParsedAdminSendTransactionParams
- type ParsedAdminSignTransactionParams
- type PolicyBuilderFunc
- type ProcessStoppedNotifier
- type Reader
- type Readers
- type RunningService
- type SelectedWallet
- type ServiceShutdownSwitch
- func (s *ServiceShutdownSwitch) BeforeCancelFunc(f func())
- func (s *ServiceShutdownSwitch) BindToProcess() ProcessStoppedNotifier
- func (s *ServiceShutdownSwitch) Ctx() context.Context
- func (s *ServiceShutdownSwitch) Flip(err error)
- func (s *ServiceShutdownSwitch) Flipped() <-chan struct{}
- func (s *ServiceShutdownSwitch) WaitForShutdown()
- type ServiceStore
- type ServicesManager
- func (ns *ServicesManager) AbortService(network string, err error)
- func (ns *ServicesManager) RegisterService(network, url string, sessions *session.Sessions, ...) error
- func (ns *ServicesManager) Sessions(network string) (*session.Sessions, error)
- func (ns *ServicesManager) StopService(network string)
- type ShutdownSwitchBuilder
- type StdTime
- type TimeProvider
- type TokenStore
- type WalletStore
Constants ¶
const ( // ErrorCodeNodeCommunicationFailed refers to the inability of the program to // talk to the network nodes. ErrorCodeNodeCommunicationFailed jsonrpc.ErrorCode = 1000 // ErrorCodeNetworkRejectedTransaction refers to a transaction rejected by // the network nodes but for an unknown ABCI code. ErrorCodeNetworkRejectedTransaction jsonrpc.ErrorCode = 1001 // ErrorCodeNetworkRejectedInvalidTransaction refers to a validation failure raised // by the network nodes (error code 51). ErrorCodeNetworkRejectedInvalidTransaction jsonrpc.ErrorCode = 1051 // ErrorCodeNetworkRejectedMalformedTransaction refers to the inability to // decode a transaction from the network nodes (error code 60). ErrorCodeNetworkRejectedMalformedTransaction jsonrpc.ErrorCode = 1060 // ErrorCodeNetworkCouldNotProcessTransaction refers to the inability to // process a transaction from the network nodes (error code 70). ErrorCodeNetworkCouldNotProcessTransaction jsonrpc.ErrorCode = 1070 // ErrorCodeNetworkRejectedUnsupportedTransaction is raised when the network // nodes encounter an unsupported transaction (error code 80). ErrorCodeNetworkRejectedUnsupportedTransaction jsonrpc.ErrorCode = 1080 // ErrorCodeNetworkSpamProtectionActivated is raised when the network // nodes spin up the spam protection mechanism (error code 89). ErrorCodeNetworkSpamProtectionActivated jsonrpc.ErrorCode = 1089 // ErrorCodeRequestNotPermitted refers a request made by a third-party application // that is not permitted to do. This error is related to the permissions' // system. ErrorCodeRequestNotPermitted jsonrpc.ErrorCode = 2000 // ErrorCodeRequestHasBeenCanceledByApplication refers to an automated cancellation of a // request by the application core. This happens when some requirements are // missing to ensure correct handling of a request. ErrorCodeRequestHasBeenCanceledByApplication jsonrpc.ErrorCode = 2001 // ErrorCodeIncompatibilityBetweenNetworkAndSoftware refers to a // software that relies on a specific version of the network but the // network it tried to connect to is not the one expected. ErrorCodeIncompatibilityBetweenNetworkAndSoftware jsonrpc.ErrorCode = 2002 // ErrorCodeServicePortAlreadyBound refers to a service that attempt to run // on a port that is already bound. The user should try to shut down the // software using that port, or update the configuration to use another port. ErrorCodeServicePortAlreadyBound jsonrpc.ErrorCode = 2003 // ErrorCodeConnectionHasBeenClosed refers to an interruption of the service triggered // by the user. ErrorCodeConnectionHasBeenClosed jsonrpc.ErrorCode = 3000 // ErrorCodeRequestHasBeenRejected refers to an explicit rejection of a request by the // user. When received, the third-party application should consider the user // has withdrawn from the action, and thus, abort the action. ErrorCodeRequestHasBeenRejected jsonrpc.ErrorCode = 3001 // ErrorCodeRequestHasBeenCanceledByUser refers to a cancellation of a request by the // user. It's conceptually different from a rejection. Contrary to a rejection, // when a cancellation is received, the third-party application should temporarily // back off, maintain its state, and wait for the user to be ready to continue. ErrorCodeRequestHasBeenCanceledByUser jsonrpc.ErrorCode = 3002 )
const PermissionsSuccessfullyUpdated = "The permissions have been successfully updated."
const TransactionSuccessfullySigned = "The transaction has been successfully signed."
const WalletConnectionSuccessfullyEstablished = "The connection to the wallet has been successfully established."
Variables ¶
var ( ErrApplicationCanceledTheRequest = errors.New("the application canceled the request") ErrBlockHashIsRequired = errors.New("the block hash is required") ErrBlockHeightIsRequired = errors.New("the block-height is required") ErrCannotRotateKeysOnIsolatedWallet = errors.New("cannot rotate keys on an isolated wallet") ErrChainIDIsRequired = errors.New("the chain ID is required") ErrConnectionTokenIsRequired = errors.New("the connection token is required") ErrCouldNotConnectToWallet = errors.New("could not connect to the wallet") ErrCouldNotGetChainIDFromNode = errors.New("could not get the chain ID from the node") ErrCouldNotGetLastBlockInformation = errors.New("could not get information about the last block on the network") ErrCouldNotRequestPermissions = errors.New("could not request permissions") ErrCouldNotSendTransaction = errors.New("could not send transaction") ErrCouldNotSignTransaction = errors.New("could not sign transaction") ErrCurrentPublicKeyDoesNotExist = errors.New("the current public key does not exist") ErrCurrentPublicKeyIsRequired = errors.New("the next public key is required") ErrEnactmentBlockHeightIsRequired = errors.New("the enactment block height is required") ErrEnactmentBlockHeightMustBeGreaterThanSubmissionOne = errors.New("the enactment block height must be greater than the submission one") ErrEncodedMessageIsNotValidBase64String = errors.New("the encoded message is not a valid base-64 string") ErrEncodedSignatureIsNotValidBase64String = errors.New("the encoded signature is not a valid base-64 string") ErrEncodedTransactionIsNotValidBase64String = errors.New("the encoded transaction is not a valid base-64 string") ErrEncodedTransactionIsRequired = errors.New("the encoded transaction is required") ErrTransactionIsRequired = errors.New("the transaction or encoded transaction is required") ErrEncodedTransactionAndTransactionSupplied = errors.New("both transaction and encodedTransaction supplied") ErrEncodedTransactionIsNotValid = errors.New("the encoded transaction is not valid") ErrHostnameIsRequired = errors.New("the hostname is required") ErrInvalidLogLevelValue = errors.New("invalid log level value") ErrInvalidTokenExpiryValue = errors.New("invalid token expiry value") ErrIsolatedWalletPassphraseIsRequired = errors.New("the isolated wallet passphrase is required") ErrLastBlockDataOrNetworkIsRequired = errors.New("a network or the last block data is required") ErrMessageIsRequired = errors.New("the message is required") ErrMethodWithoutParameters = errors.New("this method does not take any parameters") ErrMultipleNetworkSources = errors.New("network sources are mutually exclusive") ErrNetworkAlreadyExists = errors.New("a network with the same name already exists") ErrNetworkConfigurationDoesNotHaveGRPCNodes = errors.New("the network does not have gRPC hosts configured") ErrNetworkCouldNotProcessTransaction = errors.New("the network could not process the transaction") ErrNetworkDoesNotExist = errors.New("the network does not exist") ErrNetworkIsRequired = errors.New("the network is required") ErrNetworkNameIsRequired = errors.New("the network name is required") ErrNetworkOrNodeAddressIsRequired = errors.New("a network or a node address is required") ErrNetworkRejectedInvalidTransaction = errors.New("the network rejected the transaction because it's invalid") ErrNetworkRejectedMalformedTransaction = errors.New("the network rejected the transaction because it's malformed") ErrNetworkRejectedUnsupportedTransaction = errors.New("the network does not support this transaction") ErrNetworkSourceIsRequired = errors.New("a network source is required") ErrNetworkSpamProtectionActivated = errors.New("the network blocked the transaction through the spam protection") ErrNewNameIsRequired = errors.New("the new name is required") ErrNewPassphraseIsRequired = errors.New("the new passphrase is required") ErrNextAndCurrentPublicKeysCannotBeTheSame = errors.New("the next and current public keys cannot be the same") ErrNextPublicKeyDoesNotExist = errors.New("the next public key does not exist") ErrNextPublicKeyIsRequired = errors.New("the next public key is required") ErrNextPublicKeyIsTainted = errors.New("the next public key is tainted") ErrNoHealthyNodeAvailable = errors.New("no healthy node available") ErrNoWalletToConnectTo = errors.New("there is no wallet to connect to, you should, first, create or import a wallet") ErrParamsDoNotMatch = errors.New("the params do not match expected ones") ErrParamsRequired = errors.New("the params are required") ErrPassphraseIsRequired = errors.New("the passphrase is required") ErrProofOfWorkDifficultyRequired = errors.New("the proof-of-work difficulty is required") ErrProofOfWorkHashFunctionRequired = errors.New("the proof-of-work hash function is required") ErrPublicKeyDoesNotExist = errors.New("the public key does not exist") ErrPublicKeyIsNotAllowedToBeUsed = errors.New("the public key is not allowed to be used") ErrPublicKeyIsRequired = errors.New("the public key is required") ErrReadAccessOnPublicKeysRequired = errors.New(`a "read" access on public keys is required`) ErrRecoveryPhraseIsRequired = errors.New("the recovery phrase is required") ErrRequestInterrupted = errors.New("the request has been interrupted") ErrRequestedPermissionsAreRequired = errors.New("the requested permissions are required") ErrSendingModeCannotBeTypeUnspecified = errors.New(`the sending mode can't be "TYPE_UNSPECIFIED"`) ErrSendingModeIsRequired = errors.New("the sending mode is required") ErrSignatureIsRequired = errors.New("the the signature is required") ErrSpecifyingNetworkAndLastBlockDataIsNotSupported = errors.New("specifying a network and the last block data is not supported") ErrSpecifyingNetworkAndNodeAddressIsNotSupported = errors.New("specifying a network and a node address is not supported") ErrSubmissionBlockHeightIsRequired = errors.New("the submission block height is required") ErrTokenDoesNotExist = errors.New("the token does not exist") ErrTokenIsRequired = errors.New("the token is required") ErrTransactionFailed = errors.New("the transaction failed") ErrTransactionIsMalformed = errors.New("the transaction is malformed") ErrUserCanceledTheRequest = errors.New("the user canceled the request") ErrUserCloseTheConnection = errors.New("the user closed the connection") ErrUserRejectedTheRequest = errors.New("the user rejected the request") ErrWalletAlreadyExists = errors.New("a wallet with the same name already exists") ErrWalletDoesNotExist = errors.New("the wallet does not exist") ErrWalletIsRequired = errors.New("the wallet is required") ErrWalletNameIsRequired = errors.New("the wallet name is required") ErrWalletPassphraseIsRequired = errors.New("the wallet passphrase is required") ErrWalletVersionIsRequired = errors.New("the wallet version is required") ErrWrongPassphrase = errors.New("wrong passphrase") ErrAPITokenExpirationCannotBeInThePast = errors.New("the token expiration date cannot be set to a past date") )
var ErrCannotUpdatePermissionsWhileUsingLingLivingToken = errors.New("cannot update the permissions of the wallet connected with a long-living token")
var ErrInvalidNetworkSource = errors.New("invalid network source")
var ErrNoServiceIsRunningForThisNetwork = errors.New("no service is running for this network")
Functions ¶
func AdminAPI ¶ added in v0.55.0
func AdminAPI( log *zap.Logger, walletStore WalletStore, netStore NetworkStore, svcStore ServiceStore, tokenStore TokenStore, nodeSelectorBuilder NodeSelectorBuilder, policyBuilderFunc PolicyBuilderFunc, interactorBuilderFunc InteractorBuilderFunc, loggerBuilderFunc LoggerBuilderFunc, contextBuilderFunc ShutdownSwitchBuilder, ) (*jsonrpc.API, error)
AdminAPI builds the JSON-RPC API of the wallet with all the methods available. This API exposes highly-sensitive methods, and, as a result, it should be only exposed to highly-trustable applications.
func ClientAPI ¶ added in v0.58.0
func ClientAPI(log *zap.Logger, walletStore WalletStore, interactor Interactor, nodeSelector node.Selector, sessions *session.Sessions) (*jsonrpc.API, error)
ClientAPI builds the wallet JSON-RPC API with specific methods that are intended to be publicly exposed to third-party applications in a non-trustable environment. Because of the nature of the environment from where these methods are called, no administration methods are exposed. We don't want malicious third-party applications to leverage administration capabilities that could expose the user and/or compromise his wallets.
func HostnameFromContext ¶ added in v0.63.0
func TraceIDFromContext ¶
Types ¶
type AdminAnnotateKey ¶ added in v0.55.0
type AdminAnnotateKey struct {
// contains filtered or unexported fields
}
func NewAdminAnnotateKey ¶ added in v0.55.0
func NewAdminAnnotateKey( walletStore WalletStore, ) *AdminAnnotateKey
func (*AdminAnnotateKey) Handle ¶ added in v0.55.0
func (h *AdminAnnotateKey) Handle(ctx context.Context, rawParams jsonrpc.Params, _ jsonrpc.RequestMetadata) (jsonrpc.Result, *jsonrpc.ErrorDetails)
Handle attaches metadata to the specified public key. It doesn't update in place. It overwrites. All existing metadata have to be specified to not lose them.
type AdminAnnotateKeyParams ¶ added in v0.55.0
type AdminAnnotateKeyResult ¶ added in v0.55.0
type AdminCloseConnection ¶ added in v0.63.0
type AdminCloseConnection struct {
// contains filtered or unexported fields
}
func NewAdminCloseConnection ¶ added in v0.63.0
func NewAdminCloseConnection(servicesManager *ServicesManager) *AdminCloseConnection
func (*AdminCloseConnection) Handle ¶ added in v0.63.0
func (h *AdminCloseConnection) Handle(_ context.Context, rawParams jsonrpc.Params, _ jsonrpc.RequestMetadata) (jsonrpc.Result, *jsonrpc.ErrorDetails)
Handle closes the connection between a third-party application and a wallet opened in the service that run against the specified network. It does not fail if the service or the connection are already closed.
type AdminCloseConnectionParams ¶ added in v0.63.0
type AdminCloseConnectionsToHostname ¶ added in v0.63.0
type AdminCloseConnectionsToHostname struct {
// contains filtered or unexported fields
}
func NewAdminCloseConnectionsToHostname ¶ added in v0.63.0
func NewAdminCloseConnectionsToHostname(servicesManager *ServicesManager) *AdminCloseConnectionsToHostname
func (*AdminCloseConnectionsToHostname) Handle ¶ added in v0.63.0
func (h *AdminCloseConnectionsToHostname) Handle(_ context.Context, rawParams jsonrpc.Params, _ jsonrpc.RequestMetadata) (jsonrpc.Result, *jsonrpc.ErrorDetails)
Handle closes all the connections from the specified hostname to any wallet opened in the service that run against the specified network. It does not fail if the service or the connections are already closed.
type AdminCloseConnectionsToHostnameParams ¶ added in v0.63.0
type AdminCloseConnectionsToWallet ¶ added in v0.63.0
type AdminCloseConnectionsToWallet struct {
// contains filtered or unexported fields
}
func NewAdminCloseConnectionsToWallet ¶ added in v0.63.0
func NewAdminCloseConnectionsToWallet(servicesManager *ServicesManager) *AdminCloseConnectionsToWallet
func (*AdminCloseConnectionsToWallet) Handle ¶ added in v0.63.0
func (h *AdminCloseConnectionsToWallet) Handle(_ context.Context, rawParams jsonrpc.Params, _ jsonrpc.RequestMetadata) (jsonrpc.Result, *jsonrpc.ErrorDetails)
Handle closes all the connections from any hostname to the specified wallet opened in the service that run against the specified network. It does not fail if the service or the connections are already closed.
type AdminCloseConnectionsToWalletParams ¶ added in v0.63.0
type AdminCreateWallet ¶ added in v0.55.0
type AdminCreateWallet struct {
// contains filtered or unexported fields
}
func NewAdminCreateWallet ¶ added in v0.55.0
func NewAdminCreateWallet( walletStore WalletStore, ) *AdminCreateWallet
func (*AdminCreateWallet) Handle ¶ added in v0.55.0
func (h *AdminCreateWallet) Handle(ctx context.Context, rawParams jsonrpc.Params, _ jsonrpc.RequestMetadata) (jsonrpc.Result, *jsonrpc.ErrorDetails)
Handle creates a wallet and generates its first key.
type AdminCreateWalletParams ¶ added in v0.55.0
type AdminCreateWalletResult ¶ added in v0.55.0
type AdminCreateWalletResult struct { Wallet AdminCreatedWallet `json:"wallet"` Key AdminFirstPublicKey `json:"key"` }
type AdminCreatedWallet ¶ added in v0.55.0
type AdminDeleteAPIToken ¶ added in v0.63.0
type AdminDeleteAPIToken struct {
// contains filtered or unexported fields
}
func NewAdminDeleteAPIToken ¶ added in v0.63.0
func NewAdminDeleteAPIToken( tokenStore TokenStore, ) *AdminDeleteAPIToken
func (*AdminDeleteAPIToken) Handle ¶ added in v0.63.0
func (h *AdminDeleteAPIToken) Handle(_ context.Context, rawParams jsonrpc.Params, _ jsonrpc.RequestMetadata) (jsonrpc.Result, *jsonrpc.ErrorDetails)
Handle generates a long-living API token.
type AdminDeleteAPITokenParams ¶ added in v0.63.0
type AdminDeleteAPITokenParams struct {
Token string `json:"token"`
}
type AdminDescribeAPIToken ¶ added in v0.63.0
type AdminDescribeAPIToken struct {
// contains filtered or unexported fields
}
func NewAdminDescribeAPIToken ¶ added in v0.63.0
func NewAdminDescribeAPIToken( tokenStore TokenStore, ) *AdminDescribeAPIToken
func (*AdminDescribeAPIToken) Handle ¶ added in v0.63.0
func (h *AdminDescribeAPIToken) Handle(_ context.Context, rawParams jsonrpc.Params, _ jsonrpc.RequestMetadata) (jsonrpc.Result, *jsonrpc.ErrorDetails)
Handle describes a long-living API token and its configuration.
type AdminDescribeAPITokenParams ¶ added in v0.63.0
type AdminDescribeAPITokenParams struct {
Token string `json:"token"`
}
type AdminDescribeAPITokenResult ¶ added in v0.63.0
type AdminDescribeKey ¶ added in v0.55.0
type AdminDescribeKey struct {
// contains filtered or unexported fields
}
func NewAdminDescribeKey ¶ added in v0.55.0
func NewAdminDescribeKey( walletStore WalletStore, ) *AdminDescribeKey
func (*AdminDescribeKey) Handle ¶ added in v0.55.0
func (h *AdminDescribeKey) Handle(ctx context.Context, rawParams jsonrpc.Params, _ jsonrpc.RequestMetadata) (jsonrpc.Result, *jsonrpc.ErrorDetails)
Handle retrieves key's information.
type AdminDescribeKeyParams ¶ added in v0.55.0
type AdminDescribeKeyResult ¶ added in v0.55.0
type AdminDescribeNetwork ¶ added in v0.55.0
type AdminDescribeNetwork struct {
// contains filtered or unexported fields
}
func NewAdminDescribeNetwork ¶ added in v0.55.0
func NewAdminDescribeNetwork( networkStore NetworkStore, ) *AdminDescribeNetwork
func (*AdminDescribeNetwork) Handle ¶ added in v0.55.0
func (h *AdminDescribeNetwork) Handle(_ context.Context, rawParams jsonrpc.Params, _ jsonrpc.RequestMetadata) (jsonrpc.Result, *jsonrpc.ErrorDetails)
Handle retrieve a wallet from its name and passphrase.
type AdminDescribeNetworkParams ¶ added in v0.55.0
type AdminDescribeNetworkParams struct {
Name string `json:"name"`
}
type AdminDescribeNetworkResult ¶ added in v0.55.0
type AdminDescribeNetworkResult struct { Name string `json:"name"` LogLevel vgencoding.LogLevel `json:"logLevel"` TokenExpiry vgencoding.Duration `json:"tokenExpiry"` Port int `json:"port"` Host string `json:"host"` API struct { GRPCConfig struct { Hosts []string `json:"hosts"` Retries uint64 `json:"retries"` } `json:"grpcConfig"` RESTConfig struct { Hosts []string `json:"hosts"` } `json:"restConfig"` GraphQLConfig struct { Hosts []string `json:"hosts"` } `json:"graphQLConfig"` } `json:"api"` }
type AdminDescribePermissions ¶ added in v0.55.0
type AdminDescribePermissions struct {
// contains filtered or unexported fields
}
func NewAdminDescribePermissions ¶ added in v0.55.0
func NewAdminDescribePermissions( walletStore WalletStore, ) *AdminDescribePermissions
func (*AdminDescribePermissions) Handle ¶ added in v0.55.0
func (h *AdminDescribePermissions) Handle(ctx context.Context, rawParams jsonrpc.Params, _ jsonrpc.RequestMetadata) (jsonrpc.Result, *jsonrpc.ErrorDetails)
Handle retrieves permissions set for the specified wallet and hostname.
type AdminDescribePermissionsParams ¶ added in v0.55.0
type AdminDescribePermissionsResult ¶ added in v0.55.0
type AdminDescribePermissionsResult struct {
Permissions wallet.Permissions `json:"permissions"`
}
type AdminDescribeWallet ¶ added in v0.55.0
type AdminDescribeWallet struct {
// contains filtered or unexported fields
}
func NewAdminDescribeWallet ¶ added in v0.55.0
func NewAdminDescribeWallet( walletStore WalletStore, ) *AdminDescribeWallet
func (*AdminDescribeWallet) Handle ¶ added in v0.55.0
func (h *AdminDescribeWallet) Handle(ctx context.Context, rawParams jsonrpc.Params, _ jsonrpc.RequestMetadata) (jsonrpc.Result, *jsonrpc.ErrorDetails)
Handle retrieve a wallet from its name and passphrase.
type AdminDescribeWalletParams ¶ added in v0.55.0
type AdminDescribeWalletResult ¶ added in v0.55.0
type AdminFirstPublicKey ¶ added in v0.55.0
type AdminGenerateAPIToken ¶ added in v0.63.0
type AdminGenerateAPIToken struct {
// contains filtered or unexported fields
}
func NewAdminGenerateAPIToken ¶ added in v0.63.0
func NewAdminGenerateAPIToken( walletStore WalletStore, tokenStore TokenStore, tp ...TimeProvider, ) *AdminGenerateAPIToken
func (*AdminGenerateAPIToken) Handle ¶ added in v0.63.0
func (h *AdminGenerateAPIToken) Handle(ctx context.Context, rawParams jsonrpc.Params, _ jsonrpc.RequestMetadata) (jsonrpc.Result, *jsonrpc.ErrorDetails)
Handle generates a long-living API token.
type AdminGenerateAPITokenParams ¶ added in v0.63.0
type AdminGenerateAPITokenParams struct { Description string `json:"name"` ExpiryTs *int64 `json:"expiry"` Wallet AdminGenerateAPITokenWalletParams `json:"wallet"` }
type AdminGenerateAPITokenResult ¶ added in v0.63.0
type AdminGenerateAPITokenResult struct {
Token string `json:"token"`
}
type AdminGenerateAPITokenWalletParams ¶ added in v0.63.0
type AdminGenerateKey ¶ added in v0.55.0
type AdminGenerateKey struct {
// contains filtered or unexported fields
}
func NewAdminGenerateKey ¶ added in v0.55.0
func NewAdminGenerateKey( walletStore WalletStore, ) *AdminGenerateKey
func (*AdminGenerateKey) Handle ¶ added in v0.55.0
func (h *AdminGenerateKey) Handle(ctx context.Context, rawParams jsonrpc.Params, _ jsonrpc.RequestMetadata) (jsonrpc.Result, *jsonrpc.ErrorDetails)
Handle generates a key of the specified wallet.
type AdminGenerateKeyParams ¶ added in v0.55.0
type AdminGenerateKeyResult ¶ added in v0.55.0
type AdminImportNetwork ¶ added in v0.55.0
type AdminImportNetwork struct {
// contains filtered or unexported fields
}
func NewAdminImportNetwork ¶ added in v0.55.0
func NewAdminImportNetwork( networkStore NetworkStore, ) *AdminImportNetwork
func (*AdminImportNetwork) Handle ¶ added in v0.55.0
func (h *AdminImportNetwork) Handle(_ context.Context, rawParams jsonrpc.Params, _ jsonrpc.RequestMetadata) (jsonrpc.Result, *jsonrpc.ErrorDetails)
Handle creates a wallet and generates its first key.
type AdminImportNetworkParams ¶ added in v0.55.0
type AdminImportNetworkResult ¶ added in v0.55.0
type AdminImportWallet ¶ added in v0.55.0
type AdminImportWallet struct {
// contains filtered or unexported fields
}
func NewAdminImportWallet ¶ added in v0.55.0
func NewAdminImportWallet( walletStore WalletStore, ) *AdminImportWallet
func (*AdminImportWallet) Handle ¶ added in v0.55.0
func (h *AdminImportWallet) Handle(ctx context.Context, rawParams jsonrpc.Params, _ jsonrpc.RequestMetadata) (jsonrpc.Result, *jsonrpc.ErrorDetails)
Handle creates a wallet and generates its first key.
type AdminImportWalletParams ¶ added in v0.55.0
type AdminImportWalletResult ¶ added in v0.55.0
type AdminImportWalletResult struct { Wallet AdminImportedWallet `json:"wallet"` Key AdminFirstPublicKey `json:"key"` }
type AdminImportedWallet ¶ added in v0.55.0
type AdminIsolateKey ¶ added in v0.55.0
type AdminIsolateKey struct {
// contains filtered or unexported fields
}
func NewAdminIsolateKey ¶ added in v0.55.0
func NewAdminIsolateKey( walletStore WalletStore, ) *AdminIsolateKey
func (*AdminIsolateKey) Handle ¶ added in v0.55.0
func (h *AdminIsolateKey) Handle(ctx context.Context, rawParams jsonrpc.Params, _ jsonrpc.RequestMetadata) (jsonrpc.Result, *jsonrpc.ErrorDetails)
Handle isolates a key in a specific wallet.
type AdminIsolateKeyParams ¶ added in v0.55.0
type AdminIsolateKeyResult ¶ added in v0.55.0
type AdminLastBlockData ¶ added in v0.56.0
type AdminListAPITokens ¶ added in v0.63.0
type AdminListAPITokens struct {
// contains filtered or unexported fields
}
func NewAdminListAPITokens ¶ added in v0.63.0
func NewAdminListAPITokens( tokenStore TokenStore, ) *AdminListAPITokens
func (*AdminListAPITokens) Handle ¶ added in v0.63.0
func (h *AdminListAPITokens) Handle(_ context.Context, rawParams jsonrpc.Params, _ jsonrpc.RequestMetadata) (jsonrpc.Result, *jsonrpc.ErrorDetails)
Handle generates a long-living API token.
type AdminListAPITokensResult ¶ added in v0.63.0
type AdminListAPITokensResult struct {
Tokens []session.TokenSummary `json:"tokens"`
}
type AdminListConnections ¶ added in v0.63.0
type AdminListConnections struct {
// contains filtered or unexported fields
}
func NewAdminListConnections ¶ added in v0.63.0
func NewAdminListConnections(servicesManager *ServicesManager) *AdminListConnections
func (*AdminListConnections) Handle ¶ added in v0.63.0
func (h *AdminListConnections) Handle(_ context.Context, rawParams jsonrpc.Params, _ jsonrpc.RequestMetadata) (jsonrpc.Result, *jsonrpc.ErrorDetails)
Handle closes all opened connections to a running service and stop the service.
type AdminListConnectionsParams ¶ added in v0.63.0
type AdminListConnectionsParams struct {
Network string `json:"network"`
}
type AdminListConnectionsResult ¶ added in v0.63.0
type AdminListConnectionsResult struct {
ActiveConnections []session.Connection `json:"activeConnections"`
}
type AdminListKeys ¶ added in v0.55.0
type AdminListKeys struct {
// contains filtered or unexported fields
}
func NewAdminListKeys ¶ added in v0.55.0
func NewAdminListKeys( walletStore WalletStore, ) *AdminListKeys
func (*AdminListKeys) Handle ¶ added in v0.55.0
func (h *AdminListKeys) Handle(ctx context.Context, rawParams jsonrpc.Params, _ jsonrpc.RequestMetadata) (jsonrpc.Result, *jsonrpc.ErrorDetails)
Handle list all the generated key from the specified wallet.
type AdminListKeysParams ¶ added in v0.55.0
type AdminListKeysResult ¶ added in v0.55.0
type AdminListKeysResult struct {
PublicKeys []AdminNamedPublicKey `json:"keys"`
}
type AdminListNetworks ¶ added in v0.55.0
type AdminListNetworks struct {
// contains filtered or unexported fields
}
func NewAdminListNetworks ¶ added in v0.55.0
func NewAdminListNetworks( networkStore NetworkStore, ) *AdminListNetworks
func (*AdminListNetworks) Handle ¶ added in v0.55.0
func (h *AdminListNetworks) Handle(_ context.Context, _ jsonrpc.Params, _ jsonrpc.RequestMetadata) (jsonrpc.Result, *jsonrpc.ErrorDetails)
Handle List all registered networks.
type AdminListNetworksResult ¶ added in v0.55.0
type AdminListNetworksResult struct {
Networks []string `json:"networks"`
}
type AdminListPermissions ¶ added in v0.55.0
type AdminListPermissions struct {
// contains filtered or unexported fields
}
func NewAdminListPermissions ¶ added in v0.55.0
func NewAdminListPermissions( walletStore WalletStore, ) *AdminListPermissions
func (*AdminListPermissions) Handle ¶ added in v0.55.0
func (h *AdminListPermissions) Handle(ctx context.Context, rawParams jsonrpc.Params, _ jsonrpc.RequestMetadata) (jsonrpc.Result, *jsonrpc.ErrorDetails)
Handle returns the permissions summary for all set hostnames.
type AdminListPermissionsParams ¶ added in v0.55.0
type AdminListPermissionsResult ¶ added in v0.55.0
type AdminListPermissionsResult struct {
Permissions map[string]wallet.PermissionsSummary `json:"permissions"`
}
type AdminListWallets ¶ added in v0.55.0
type AdminListWallets struct {
// contains filtered or unexported fields
}
func NewAdminListWallets ¶ added in v0.55.0
func NewAdminListWallets( walletStore WalletStore, ) *AdminListWallets
func (*AdminListWallets) Handle ¶ added in v0.55.0
func (h *AdminListWallets) Handle(ctx context.Context, rawParams jsonrpc.Params, _ jsonrpc.RequestMetadata) (jsonrpc.Result, *jsonrpc.ErrorDetails)
Handle list all the wallets present on the computer.
type AdminListWalletsResult ¶ added in v0.55.0
type AdminListWalletsResult struct {
Wallets []string `json:"wallets"`
}
type AdminNamedPublicKey ¶ added in v0.55.0
type AdminPurgePermissions ¶ added in v0.55.0
type AdminPurgePermissions struct {
// contains filtered or unexported fields
}
func NewAdminPurgePermissions ¶ added in v0.55.0
func NewAdminPurgePermissions( walletStore WalletStore, ) *AdminPurgePermissions
func (*AdminPurgePermissions) Handle ¶ added in v0.55.0
func (h *AdminPurgePermissions) Handle(ctx context.Context, rawParams jsonrpc.Params, _ jsonrpc.RequestMetadata) (jsonrpc.Result, *jsonrpc.ErrorDetails)
Handle purges all the permissions set for all hostname.
type AdminPurgePermissionsParams ¶ added in v0.55.0
type AdminRemoveNetwork ¶ added in v0.55.0
type AdminRemoveNetwork struct {
// contains filtered or unexported fields
}
func NewAdminRemoveNetwork ¶ added in v0.55.0
func NewAdminRemoveNetwork( networkStore NetworkStore, ) *AdminRemoveNetwork
func (*AdminRemoveNetwork) Handle ¶ added in v0.55.0
func (h *AdminRemoveNetwork) Handle(_ context.Context, rawParams jsonrpc.Params, _ jsonrpc.RequestMetadata) (jsonrpc.Result, *jsonrpc.ErrorDetails)
Handle removes a wallet from the computer.
type AdminRemoveNetworkParams ¶ added in v0.55.0
type AdminRemoveNetworkParams struct {
Network string `json:"network"`
}
type AdminRemoveWallet ¶ added in v0.55.0
type AdminRemoveWallet struct {
// contains filtered or unexported fields
}
func NewAdminRemoveWallet ¶ added in v0.55.0
func NewAdminRemoveWallet( walletStore WalletStore, ) *AdminRemoveWallet
func (*AdminRemoveWallet) Handle ¶ added in v0.55.0
func (h *AdminRemoveWallet) Handle(ctx context.Context, rawParams jsonrpc.Params, _ jsonrpc.RequestMetadata) (jsonrpc.Result, *jsonrpc.ErrorDetails)
Handle removes a wallet from the computer.
type AdminRemoveWalletParams ¶ added in v0.55.0
type AdminRemoveWalletParams struct {
Wallet string `json:"wallet"`
}
type AdminRenameWallet ¶ added in v0.60.0
type AdminRenameWallet struct {
// contains filtered or unexported fields
}
func NewAdminRenameWallet ¶ added in v0.60.0
func NewAdminRenameWallet( walletStore WalletStore, ) *AdminRenameWallet
func (*AdminRenameWallet) Handle ¶ added in v0.60.0
func (h *AdminRenameWallet) Handle(ctx context.Context, rawParams jsonrpc.Params, _ jsonrpc.RequestMetadata) (jsonrpc.Result, *jsonrpc.ErrorDetails)
Handle renames the wallet.
type AdminRenameWalletParams ¶ added in v0.60.0
type AdminRevokePermissions ¶ added in v0.55.0
type AdminRevokePermissions struct {
// contains filtered or unexported fields
}
func NewAdminRevokePermissions ¶ added in v0.55.0
func NewAdminRevokePermissions( walletStore WalletStore, ) *AdminRevokePermissions
func (*AdminRevokePermissions) Handle ¶ added in v0.55.0
func (h *AdminRevokePermissions) Handle(ctx context.Context, rawParams jsonrpc.Params, _ jsonrpc.RequestMetadata) (jsonrpc.Result, *jsonrpc.ErrorDetails)
Handle revokes the permissions set in the specified hostname.
type AdminRevokePermissionsParams ¶ added in v0.55.0
type AdminRotateKey ¶ added in v0.55.0
type AdminRotateKey struct {
// contains filtered or unexported fields
}
func NewAdminRotateKey ¶ added in v0.55.0
func NewAdminRotateKey( walletStore WalletStore, ) *AdminRotateKey
func (*AdminRotateKey) Handle ¶ added in v0.55.0
func (h *AdminRotateKey) Handle(ctx context.Context, rawParams jsonrpc.Params, _ jsonrpc.RequestMetadata) (jsonrpc.Result, *jsonrpc.ErrorDetails)
Handle create a transaction to rotate the keys.
type AdminRotateKeyParams ¶ added in v0.55.0
type AdminRotateKeyParams struct { Wallet string `json:"wallet"` Passphrase string `json:"passphrase"` FromPublicKey string `json:"fromPublicKey"` ToPublicKey string `json:"toPublicKey"` ChainID string `json:"chainID"` SubmissionBlockHeight uint64 `json:"submissionBlockHeight"` EnactmentBlockHeight uint64 `json:"enactmentBlockHeight"` }
type AdminRotateKeyResult ¶ added in v0.55.0
type AdminSendRawTransaction ¶ added in v0.63.0
type AdminSendRawTransaction struct {
// contains filtered or unexported fields
}
func NewAdminSendRawTransaction ¶ added in v0.63.0
func NewAdminSendRawTransaction(networkStore NetworkStore, nodeSelectorBuilder NodeSelectorBuilder) *AdminSendRawTransaction
func (*AdminSendRawTransaction) Handle ¶ added in v0.63.0
func (h *AdminSendRawTransaction) Handle(ctx context.Context, rawParams jsonrpc.Params, _ jsonrpc.RequestMetadata) (jsonrpc.Result, *jsonrpc.ErrorDetails)
type AdminSendRawTransactionParams ¶ added in v0.63.0
type AdminSendRawTransactionResult ¶ added in v0.63.0
type AdminSendRawTransactionResult struct { ReceivedAt time.Time `json:"receivedAt"` SentAt time.Time `json:"sentAt"` TxHash string `json:"transactionHash"` Tx *commandspb.Transaction `json:"transaction"` }
type AdminSendTransaction ¶ added in v0.56.0
type AdminSendTransaction struct {
// contains filtered or unexported fields
}
func NewAdminSendTransaction ¶ added in v0.56.0
func NewAdminSendTransaction(walletStore WalletStore, networkStore NetworkStore, nodeSelectorBuilder NodeSelectorBuilder) *AdminSendTransaction
func (*AdminSendTransaction) Handle ¶ added in v0.56.0
func (h *AdminSendTransaction) Handle(ctx context.Context, rawParams jsonrpc.Params, _ jsonrpc.RequestMetadata) (jsonrpc.Result, *jsonrpc.ErrorDetails)
type AdminSendTransactionParams ¶ added in v0.56.0
type AdminSendTransactionParams struct { Wallet string `json:"wallet"` Passphrase string `json:"passphrase"` PublicKey string `json:"publicKey"` Network string `json:"network"` NodeAddress string `json:"nodeAddress"` Retries uint64 `json:"retries"` SendingMode string `json:"sendingMode"` Transaction interface{} `json:"transaction"` }
type AdminSendTransactionResult ¶ added in v0.56.0
type AdminSendTransactionResult struct { ReceivedAt time.Time `json:"receivedAt"` SentAt time.Time `json:"sentAt"` TxHash string `json:"transactionHash"` Tx *commandspb.Transaction `json:"transaction"` }
type AdminSignMessage ¶ added in v0.56.0
type AdminSignMessage struct {
// contains filtered or unexported fields
}
func NewAdminSignMessage ¶ added in v0.56.0
func NewAdminSignMessage(walletStore WalletStore) *AdminSignMessage
func (*AdminSignMessage) Handle ¶ added in v0.56.0
func (h *AdminSignMessage) Handle(ctx context.Context, rawParams jsonrpc.Params, _ jsonrpc.RequestMetadata) (jsonrpc.Result, *jsonrpc.ErrorDetails)
type AdminSignMessageParams ¶ added in v0.56.0
type AdminSignMessageResult ¶ added in v0.56.0
type AdminSignMessageResult struct {
Base64Signature string `json:"encodedSignature"`
}
type AdminSignTransaction ¶ added in v0.56.0
type AdminSignTransaction struct {
// contains filtered or unexported fields
}
func NewAdminSignTransaction ¶ added in v0.56.0
func NewAdminSignTransaction(walletStore WalletStore, networkStore NetworkStore, nodeSelectorBuilder NodeSelectorBuilder) *AdminSignTransaction
func (*AdminSignTransaction) Handle ¶ added in v0.56.0
func (h *AdminSignTransaction) Handle(ctx context.Context, rawParams jsonrpc.Params, _ jsonrpc.RequestMetadata) (jsonrpc.Result, *jsonrpc.ErrorDetails)
type AdminSignTransactionParams ¶ added in v0.56.0
type AdminSignTransactionParams struct { Wallet string `json:"wallet"` Passphrase string `json:"passphrase"` PublicKey string `json:"publicKey"` Transaction interface{} `json:"transaction"` Network string `json:"network"` LastBlockData *AdminLastBlockData `json:"lastBlockData"` }
type AdminSignTransactionResult ¶ added in v0.56.0
type AdminSignTransactionResult struct { Tx *commandspb.Transaction `json:"transaction"` EncodedTransaction string }
type AdminStartService ¶ added in v0.63.0
type AdminStartService struct {
// contains filtered or unexported fields
}
func NewAdminStartService ¶ added in v0.63.0
func NewAdminStartService(walletStore WalletStore, netStore NetworkStore, svcStore ServiceStore, policyBuilderFunc PolicyBuilderFunc, interactorBuilderFunc InteractorBuilderFunc, loggerBuilderFunc LoggerBuilderFunc, shutdownSwitchBuilderFunc ShutdownSwitchBuilder, servicesManager *ServicesManager) *AdminStartService
func (*AdminStartService) Handle ¶ added in v0.63.0
func (h *AdminStartService) Handle(_ context.Context, rawParams jsonrpc.Params, _ jsonrpc.RequestMetadata) (jsonrpc.Result, *jsonrpc.ErrorDetails)
Handle create a transaction to rotate the keys.
Note: We do not use the context passed as parameter as we don't want to tie a short living context to the long-running goroutines, like with an HTTP request context. To manage the lifetime of the goroutines, the context builder should be used to wrap the parent context.
type AdminStartServiceParams ¶ added in v0.63.0
type AdminStartServiceResult ¶ added in v0.63.0
type AdminStartServiceResult struct {
URL string `json:"url"`
}
type AdminStopService ¶ added in v0.63.0
type AdminStopService struct {
// contains filtered or unexported fields
}
func NewAdminStopService ¶ added in v0.63.0
func NewAdminStopService(servicesManager *ServicesManager) *AdminStopService
func (*AdminStopService) Handle ¶ added in v0.63.0
func (h *AdminStopService) Handle(_ context.Context, rawParams jsonrpc.Params, _ jsonrpc.RequestMetadata) (jsonrpc.Result, *jsonrpc.ErrorDetails)
Handle closes all opened connections to a running service and stop the service.
type AdminStopServiceParams ¶ added in v0.63.0
type AdminStopServiceParams struct {
Network string `json:"network"`
}
type AdminTaintKey ¶ added in v0.55.0
type AdminTaintKey struct {
// contains filtered or unexported fields
}
func NewAdminTaintKey ¶ added in v0.55.0
func NewAdminTaintKey( walletStore WalletStore, ) *AdminTaintKey
func (*AdminTaintKey) Handle ¶ added in v0.55.0
func (h *AdminTaintKey) Handle(ctx context.Context, rawParams jsonrpc.Params, _ jsonrpc.RequestMetadata) (jsonrpc.Result, *jsonrpc.ErrorDetails)
Handle marks the specified public key as tainted. It makes it unusable for transaction signing.
type AdminTaintKeyParams ¶ added in v0.55.0
type AdminUntaintKey ¶ added in v0.55.0
type AdminUntaintKey struct {
// contains filtered or unexported fields
}
func NewAdminUntaintKey ¶ added in v0.55.0
func NewAdminUntaintKey( walletStore WalletStore, ) *AdminUntaintKey
func (*AdminUntaintKey) Handle ¶ added in v0.55.0
func (h *AdminUntaintKey) Handle(ctx context.Context, rawParams jsonrpc.Params, _ jsonrpc.RequestMetadata) (jsonrpc.Result, *jsonrpc.ErrorDetails)
Handle marks the specified public key as tainted. It makes it unusable for transaction signing.
type AdminUntaintKeyParams ¶ added in v0.55.0
type AdminUpdateNetwork ¶ added in v0.56.0
type AdminUpdateNetwork struct {
// contains filtered or unexported fields
}
func NewAdminUpdateNetwork ¶ added in v0.56.0
func NewAdminUpdateNetwork( networkStore NetworkStore, ) *AdminUpdateNetwork
func (*AdminUpdateNetwork) Handle ¶ added in v0.56.0
func (h *AdminUpdateNetwork) Handle(_ context.Context, rawParams jsonrpc.Params, _ jsonrpc.RequestMetadata) (jsonrpc.Result, *jsonrpc.ErrorDetails)
Handle retrieve a wallet from its name and passphrase.
type AdminUpdateNetworkParams ¶ added in v0.56.0
type AdminUpdateNetworkParams struct { Name string `json:"name"` Level string `json:"logLevel"` TokenExpiry string `json:"tokenExpiry"` Port int `json:"port"` Host string `json:"host"` API struct { GRPCConfig struct { Hosts []string `json:"hosts"` Retries uint64 `json:"retries"` } `json:"grpcConfig"` RESTConfig struct { Hosts []string `json:"hosts"` } `json:"restConfig"` GraphQLConfig struct { Hosts []string `json:"hosts"` } `json:"graphQLConfig"` } `json:"api"` }
type AdminUpdatePassphrase ¶ added in v0.60.0
type AdminUpdatePassphrase struct {
// contains filtered or unexported fields
}
func NewAdminUpdatePassphrase ¶ added in v0.60.0
func NewAdminUpdatePassphrase( walletStore WalletStore, ) *AdminUpdatePassphrase
func (*AdminUpdatePassphrase) Handle ¶ added in v0.60.0
func (h *AdminUpdatePassphrase) Handle(ctx context.Context, rawParams jsonrpc.Params, _ jsonrpc.RequestMetadata) (jsonrpc.Result, *jsonrpc.ErrorDetails)
Handle renames the wallet.
type AdminUpdatePassphraseParams ¶ added in v0.60.0
type AdminUpdatePermissions ¶ added in v0.55.0
type AdminUpdatePermissions struct {
// contains filtered or unexported fields
}
func NewAdminUpdatePermissions ¶ added in v0.55.0
func NewAdminUpdatePermissions( walletStore WalletStore, ) *AdminUpdatePermissions
func (*AdminUpdatePermissions) Handle ¶ added in v0.55.0
func (h *AdminUpdatePermissions) Handle(ctx context.Context, rawParams jsonrpc.Params, _ jsonrpc.RequestMetadata) (jsonrpc.Result, *jsonrpc.ErrorDetails)
Handle revokes the permissions set in the specified hostname.
type AdminUpdatePermissionsParams ¶ added in v0.55.0
type AdminUpdatePermissionsParams struct { Wallet string `json:"wallet"` Passphrase string `json:"passphrase"` Hostname string `json:"hostname"` Permissions wallet.Permissions `json:"permissions"` }
type AdminUpdatePermissionsResult ¶ added in v0.55.0
type AdminUpdatePermissionsResult struct {
Permissions wallet.Permissions `json:"permissions"`
}
type AdminVerifyMessage ¶ added in v0.56.0
type AdminVerifyMessage struct{}
func NewAdminVerifyMessage ¶ added in v0.56.0
func NewAdminVerifyMessage() *AdminVerifyMessage
func (*AdminVerifyMessage) Handle ¶ added in v0.56.0
func (h *AdminVerifyMessage) Handle(_ context.Context, rawParams jsonrpc.Params, _ jsonrpc.RequestMetadata) (jsonrpc.Result, *jsonrpc.ErrorDetails)
type AdminVerifyMessageParams ¶ added in v0.56.0
type AdminVerifyMessageResult ¶ added in v0.56.0
type AdminVerifyMessageResult struct {
IsValid bool `json:"valid"`
}
type ClientConnectWallet ¶ added in v0.58.0
type ClientConnectWallet struct {
// contains filtered or unexported fields
}
func NewConnectWallet ¶
func NewConnectWallet(walletStore WalletStore, interactor Interactor, sessions *session.Sessions) *ClientConnectWallet
func (*ClientConnectWallet) Handle ¶ added in v0.58.0
func (h *ClientConnectWallet) Handle(ctx context.Context, _ jsonrpc.Params, metadata jsonrpc.RequestMetadata) (jsonrpc.Result, *jsonrpc.ErrorDetails)
Handle initiates the wallet connection between the API and a third-party application.
It triggers a selection of the wallet the client wants to use for this connection. The wallet is then loaded in memory. All changes done to that wallet will start in-memory, and then, be saved in the wallet file. Any changes done to the wallet outside the JSON-RPC session (via the command-line for example) will be overridden. For the effects to be taken into account, the wallet has to be disconnected first, and then re-connected.
All sessions have to be initialized by using this handler. Otherwise, a call to any other handlers will be rejected.
type ClientConnectWalletResult ¶ added in v0.58.0
type ClientConnectWalletResult struct {
Token string `json:"token"`
}
type ClientDisconnectWallet ¶ added in v0.58.0
type ClientDisconnectWallet struct {
// contains filtered or unexported fields
}
func NewDisconnectWallet ¶
func NewDisconnectWallet(sessions *session.Sessions) *ClientDisconnectWallet
func (*ClientDisconnectWallet) Handle ¶ added in v0.58.0
func (h *ClientDisconnectWallet) Handle(_ context.Context, rawParams jsonrpc.Params, _ jsonrpc.RequestMetadata) (jsonrpc.Result, *jsonrpc.ErrorDetails)
Handle disconnect a wallet for a third-party application.
It does not fail. If there's no connected wallet for the given token, nothing happens.
The wallet resources are unloaded.
type ClientDisconnectWalletParams ¶ added in v0.58.0
type ClientDisconnectWalletParams struct {
Token string `json:"hostname"`
}
type ClientGetChainID ¶ added in v0.58.0
type ClientGetChainID struct {
// contains filtered or unexported fields
}
func NewGetChainID ¶ added in v0.55.0
func NewGetChainID(nodeSelector walletnode.Selector) *ClientGetChainID
func (*ClientGetChainID) Handle ¶ added in v0.58.0
func (h *ClientGetChainID) Handle(ctx context.Context, _ jsonrpc.Params, _ jsonrpc.RequestMetadata) (jsonrpc.Result, *jsonrpc.ErrorDetails)
type ClientGetChainIDResult ¶ added in v0.58.0
type ClientGetChainIDResult struct {
ChainID string `json:"chainID"`
}
type ClientGetPermissions ¶ added in v0.58.0
type ClientGetPermissions struct {
// contains filtered or unexported fields
}
func NewGetPermissions ¶
func NewGetPermissions(sessions *session.Sessions) *ClientGetPermissions
func (*ClientGetPermissions) Handle ¶ added in v0.58.0
func (h *ClientGetPermissions) Handle(_ context.Context, rawParams jsonrpc.Params, _ jsonrpc.RequestMetadata) (jsonrpc.Result, *jsonrpc.ErrorDetails)
Handle returns the permissions set on the given hostname.
If a third-party application does not have enough permissions, it has to request them using `request_permissions` handler.
Using this handler does not require permissions.
type ClientGetPermissionsParams ¶ added in v0.58.0
type ClientGetPermissionsParams struct {
Token string `json:"token"`
}
type ClientGetPermissionsResult ¶ added in v0.58.0
type ClientGetPermissionsResult struct {
Permissions wallet.PermissionsSummary `json:"permissions"`
}
type ClientListKeys ¶ added in v0.58.0
type ClientListKeys struct {
// contains filtered or unexported fields
}
func NewListKeys ¶
func NewListKeys(walletStore WalletStore, interactor Interactor, sessions *session.Sessions) *ClientListKeys
func (*ClientListKeys) Handle ¶ added in v0.58.0
func (h *ClientListKeys) Handle(ctx context.Context, rawParams jsonrpc.Params, metadata jsonrpc.RequestMetadata) (jsonrpc.Result, *jsonrpc.ErrorDetails)
Handle returns the public keys the third-party application has access to.
This requires a "read" access on "public_keys".
type ClientListKeysParams ¶ added in v0.58.0
type ClientListKeysParams struct {
Token string `json:"token"`
}
type ClientListKeysResult ¶ added in v0.58.0
type ClientListKeysResult struct {
Keys []ClientNamedPublicKey `json:"keys"`
}
type ClientNamedPublicKey ¶ added in v0.58.0
type ClientParsedSendTransactionParams ¶ added in v0.58.0
type ClientParsedSendTransactionParams struct { Token string PublicKey string SendingMode apipb.SubmitTransactionRequest_Type RawTransaction string }
type ClientParsedSignTransactionParams ¶ added in v0.58.0
type ClientRequestPermissions ¶ added in v0.58.0
type ClientRequestPermissions struct {
// contains filtered or unexported fields
}
func NewRequestPermissions ¶
func NewRequestPermissions( walletStore WalletStore, interactor Interactor, sessions *session.Sessions, ) *ClientRequestPermissions
func (*ClientRequestPermissions) Handle ¶ added in v0.58.0
func (h *ClientRequestPermissions) Handle(ctx context.Context, rawParams jsonrpc.Params, metadata jsonrpc.RequestMetadata) (jsonrpc.Result, *jsonrpc.ErrorDetails)
Handle allows a third-party application to request permissions to access certain capabilities of the wallet.
To update the permissions, the third-party application has to specify all the permissions it required, even those that are already active. This way the client get a full understanding of all the requested access, and is much more capable to evaluate abusive requests and applications. Any permission that is omitted is considered to be revoked.
The client will be asked to review the permissions the third-party application is requesting. It has the possibility to approve or reject the request.
Everytime the permissions are updated, the connected wallet resources are updated.
Using this handler does not require permissions.
type ClientRequestPermissionsParams ¶ added in v0.58.0
type ClientRequestPermissionsParams struct { Token string `json:"token"` RequestedPermissions wallet.PermissionsSummary `json:"requestedPermissions"` }
type ClientRequestPermissionsResult ¶ added in v0.58.0
type ClientRequestPermissionsResult struct {
Permissions wallet.PermissionsSummary `json:"permissions"`
}
type ClientSendTransaction ¶ added in v0.58.0
type ClientSendTransaction struct {
// contains filtered or unexported fields
}
func NewSendTransaction ¶
func NewSendTransaction(interactor Interactor, nodeSelector node.Selector, sessions *session.Sessions, tp ...TimeProvider) *ClientSendTransaction
func (*ClientSendTransaction) Handle ¶ added in v0.58.0
func (h *ClientSendTransaction) Handle(ctx context.Context, rawParams jsonrpc.Params, metadata jsonrpc.RequestMetadata) (jsonrpc.Result, *jsonrpc.ErrorDetails)
type ClientSendTransactionParams ¶ added in v0.58.0
type ClientSendTransactionResult ¶ added in v0.58.0
type ClientSendTransactionResult struct { ReceivedAt time.Time `json:"receivedAt"` SentAt time.Time `json:"sentAt"` TxHash string `json:"transactionHash"` Tx *commandspb.Transaction `json:"transaction"` }
type ClientSignTransaction ¶ added in v0.58.0
type ClientSignTransaction struct {
// contains filtered or unexported fields
}
func NewSignTransaction ¶ added in v0.55.0
func NewSignTransaction(interactor Interactor, nodeSelector node.Selector, sessions *session.Sessions, tp ...TimeProvider) *ClientSignTransaction
func (*ClientSignTransaction) Handle ¶ added in v0.58.0
func (h *ClientSignTransaction) Handle(ctx context.Context, rawParams jsonrpc.Params, metadata jsonrpc.RequestMetadata) (jsonrpc.Result, *jsonrpc.ErrorDetails)
type ClientSignTransactionParams ¶ added in v0.58.0
type ClientSignTransactionResult ¶ added in v0.58.0
type ClientSignTransactionResult struct {
Tx *commandspb.Transaction `json:"transaction"`
}
type ErrorType ¶
type ErrorType string
ErrorType defines the type of error that is sent to the user, for fine grain error management and reporting.
var ( // InternalError defines an unexpected technical error upon which the user // can't act. // The wallet front-end should report it to the user and automatically // abort the processing of the ongoing request. // It can be raised if a file is not accessible or corrupt, for example. InternalError ErrorType = "Internal error" // ServerError defines a programmatic error threw by the server, such as // a request cancellation. The server error targets error that happens in // the communication layer. It's different form application error. // It's a type of error that should be expected and handled. ServerError ErrorType = "Server error" // NetworkError defines an error that comes from the network and its nodes. NetworkError ErrorType = "Network error" // ApplicationError defines a programmatic error threw by the application // core, also called "business logic". ApplicationError ErrorType = "Application error" // UserError defines an error that originated from the user and that // requires its intervention to correct it. // It can be raised if a passphrase is invalid, for example. UserError ErrorType = "User error" )
type EventListener ¶ added in v0.63.0
type EventListener func(eventName string, optionalData ...interface{})
EventListener is used to transmit event happening in a component to another one. For example, it's used in the service to broadcast information about the service health and state.
type Interactor ¶ added in v0.58.0
type Interactor interface { // NotifyInteractionSessionBegan notifies the beginning of an interaction // session. // A session is scoped to a request. NotifyInteractionSessionBegan(ctx context.Context, traceID string) error // NotifyInteractionSessionEnded notifies the end of an interaction // session. // A session is scoped to a request. NotifyInteractionSessionEnded(ctx context.Context, traceID string) // NotifySuccessfulTransaction is used to report a successful transaction. NotifySuccessfulTransaction(ctx context.Context, traceID, txHash, deserializedInputData, tx string, sentAt time.Time) // NotifyFailedTransaction is used to report a failed transaction. NotifyFailedTransaction(ctx context.Context, traceID, deserializedInputData, tx string, err error, sentAt time.Time) // NotifySuccessfulRequest is used to notify the user the request is // successful. NotifySuccessfulRequest(ctx context.Context, traceID string, message string) // NotifyError is used to report errors to the user. NotifyError(ctx context.Context, traceID string, t ErrorType, err error) // Log is used to report information of any kind to the user. This is used // to log internal activities and provide feedback to the wallet front-ends. // It's purely for informational purpose. // Receiving logs should be expected at any point during an interaction // session. Log(ctx context.Context, traceID string, t LogType, msg string) // RequestWalletConnectionReview is used to trigger a user review of // the wallet connection requested by the specified hostname. // It returns the type of connection approval chosen by the user. RequestWalletConnectionReview(ctx context.Context, traceID, hostname string) (string, error) // RequestWalletSelection is used to trigger the selection of the wallet the // user wants to use for the specified hostname. RequestWalletSelection(ctx context.Context, traceID, hostname string, availableWallets []string) (SelectedWallet, error) // RequestPassphrase is used to request to the user the passphrase of a wallet. // It's primarily used by requests that update the wallet. RequestPassphrase(ctx context.Context, traceID, wallet string) (string, error) // RequestPermissionsReview is used to trigger a user review of the permissions // requested by the specified hostname. // It returns true if the user approved the requested permissions, false // otherwise. RequestPermissionsReview(ctx context.Context, traceID, hostname, wallet string, perms map[string]string) (bool, error) // RequestTransactionReviewForSending is used to trigger a user review of the // transaction a third-party application wants to send. // It returns true if the user approved the sending of the transaction, // false otherwise. RequestTransactionReviewForSending(ctx context.Context, traceID, hostname, wallet, pubKey, transaction string, receivedAt time.Time) (bool, error) // RequestTransactionReviewForSigning is used to trigger a user review of the // transaction a third-party application wants to sign. The wallet doesn't // send the transaction. // It returns true if the user approved the signing of the transaction, // false otherwise. RequestTransactionReviewForSigning(ctx context.Context, traceID, hostname, wallet, pubKey, transaction string, receivedAt time.Time) (bool, error) }
Interactor is the component in charge of delegating the JSON-RPC API requests, notifications and logs to the wallet front-end. Convention:
- Notify* calls do not expect a response from the user.
- Request* calls are expecting a response from the user.
- Log function is just information logging and does not expect a response.
type InteractorBuilderFunc ¶ added in v0.63.0
type InteractorBuilderFunc func(ctx context.Context) Interactor
InteractorBuilderFunc returns the interactor to use in the client API.
type LogType ¶ added in v0.56.0
type LogType string
LogType defines the type of log that is sent to the user.
type LoggerBuilderFunc ¶ added in v0.63.0
type LoggerBuilderFunc func(path paths.StatePath, level string) (*zap.Logger, zap.AtomicLevel, error)
LoggerBuilderFunc is used to build a logger. It returns the built logger and a zap.AtomicLevel to allow the caller to dynamically change the log level.
type NetworkStore ¶ added in v0.55.0
type NetworkStore interface { NetworkExists(string) (bool, error) GetNetwork(string) (*network.Network, error) SaveNetwork(*network.Network) error ListNetworks() ([]string, error) GetNetworkPath(string) string DeleteNetwork(string) error }
NetworkStore is the component used to retrieve and update the networks from the computer.
type NodeSelectorBuilder ¶ added in v0.56.0
type ParsedAdminSendRawTransactionParams ¶ added in v0.63.0
type ParsedAdminSendTransactionParams ¶ added in v0.56.0
type ParsedAdminSignTransactionParams ¶ added in v0.56.0
type PolicyBuilderFunc ¶ added in v0.63.0
PolicyBuilderFunc return the policy the API v2.
type ProcessStoppedNotifier ¶ added in v0.63.0
type ProcessStoppedNotifier func()
type Readers ¶ added in v0.55.0
func NewReaders ¶ added in v0.55.0
func NewReaders() Readers
type RunningService ¶ added in v0.63.0
type RunningService struct {
// contains filtered or unexported fields
}
type SelectedWallet ¶
SelectedWallet holds the result of the wallet selection from the user.
type ServiceShutdownSwitch ¶ added in v0.63.0
type ServiceShutdownSwitch struct {
// contains filtered or unexported fields
}
func NewServiceShutdownSwitch ¶ added in v0.63.0
func NewServiceShutdownSwitch(onErrorFunc func(error)) *ServiceShutdownSwitch
func (*ServiceShutdownSwitch) BeforeCancelFunc ¶ added in v0.63.0
func (s *ServiceShutdownSwitch) BeforeCancelFunc(f func())
func (*ServiceShutdownSwitch) BindToProcess ¶ added in v0.63.0
func (s *ServiceShutdownSwitch) BindToProcess() ProcessStoppedNotifier
func (*ServiceShutdownSwitch) Ctx ¶ added in v0.63.0
func (s *ServiceShutdownSwitch) Ctx() context.Context
func (*ServiceShutdownSwitch) Flip ¶ added in v0.63.0
func (s *ServiceShutdownSwitch) Flip(err error)
func (*ServiceShutdownSwitch) Flipped ¶ added in v0.63.0
func (s *ServiceShutdownSwitch) Flipped() <-chan struct{}
func (*ServiceShutdownSwitch) WaitForShutdown ¶ added in v0.63.0
func (s *ServiceShutdownSwitch) WaitForShutdown()
type ServiceStore ¶ added in v0.63.0
type ServiceStore interface { RSAKeysExists() (bool, error) SaveRSAKeys(*service.RSAKeys) error GetRsaKeys() (*service.RSAKeys, error) }
ServiceStore is used to initialise the RSA keys the service API v1 relies on.
type ServicesManager ¶ added in v0.63.0
type ServicesManager struct {
// contains filtered or unexported fields
}
ServicesManager keeps track of all running services. It is used by the admin API to control the lifecycle of the services and query their state.
func NewServicesManager ¶ added in v0.63.0
func NewServicesManager(tokenStore TokenStore, walletStore WalletStore) *ServicesManager
func (*ServicesManager) AbortService ¶ added in v0.63.0
func (ns *ServicesManager) AbortService(network string, err error)
func (*ServicesManager) RegisterService ¶ added in v0.63.0
func (ns *ServicesManager) RegisterService(network, url string, sessions *session.Sessions, shutdownSwitch *ServiceShutdownSwitch) error
func (*ServicesManager) Sessions ¶ added in v0.63.0
func (ns *ServicesManager) Sessions(network string) (*session.Sessions, error)
func (*ServicesManager) StopService ¶ added in v0.63.0
func (ns *ServicesManager) StopService(network string)
type ShutdownSwitchBuilder ¶ added in v0.63.0
type ShutdownSwitchBuilder func() *ServiceShutdownSwitch
ShutdownSwitchBuilder is used to build a switch that is controlled by components that share the same lifecycle.
type TimeProvider ¶ added in v0.63.0
type TokenStore ¶ added in v0.63.0
type TokenStore interface { TokenExists(token string) (bool, error) ListTokens() ([]session.TokenSummary, error) GetToken(token string) (session.Token, error) SaveToken(tokenConfig session.Token) error DeleteToken(token string) error }
TokenStore is the component used to retrieve and update the API tokens from the computer.
type WalletStore ¶
type WalletStore interface { WalletExists(ctx context.Context, name string) (bool, error) GetWallet(ctx context.Context, name, passphrase string) (wallet.Wallet, error) ListWallets(ctx context.Context) ([]string, error) SaveWallet(ctx context.Context, w wallet.Wallet, passphrase string) error DeleteWallet(ctx context.Context, name string) error RenameWallet(ctx context.Context, currentName, newName string) error GetWalletPath(name string) string }
WalletStore is the component used to retrieve and update wallets from the computer.
Source Files ¶
- admin_annotate_key.go
- admin_close_connection.go
- admin_close_connections_to_hostname.go
- admin_close_connections_to_wallet.go
- admin_create_wallet.go
- admin_delete_api_token.go
- admin_describe_api_token.go
- admin_describe_key.go
- admin_describe_network.go
- admin_describe_permissions.go
- admin_describe_wallet.go
- admin_generate_api_token.go
- admin_generate_key.go
- admin_import_network.go
- admin_import_wallet.go
- admin_isolate_key.go
- admin_list_api_tokens.go
- admin_list_connections.go
- admin_list_keys.go
- admin_list_networks.go
- admin_list_permissions.go
- admin_list_wallets.go
- admin_purge_permissions.go
- admin_remove_network.go
- admin_remove_wallet.go
- admin_rename_wallet.go
- admin_revoke_permissions.go
- admin_rotate_key.go
- admin_send_raw_transaction.go
- admin_send_transaction.go
- admin_sign_message.go
- admin_sign_transaction.go
- admin_start_service.go
- admin_stop_service.go
- admin_taint_key.go
- admin_untaint_key.go
- admin_update_network.go
- admin_update_passphrase.go
- admin_update_permissions.go
- admin_verify_message.go
- api.go
- client_connect_wallet.go
- client_disconnect_wallet.go
- client_get_chain_id.go
- client_get_permissions.go
- client_list_keys.go
- client_request_permissions.go
- client_send_transaction.go
- client_sign_transaction.go
- context.go
- doc.go
- errors.go
- services_manager.go
- time_provider.go