Documentation ¶
Index ¶
- type Account
- type AccountCompositePublicKeyProvider
- type AccountIDProvider
- type AccountLocker
- type AccountMetadataProvider
- type AccountNameProvider
- type AccountParticipantsProvider
- type AccountPathProvider
- type AccountPrivateKeyProvider
- type AccountProtectingMultiSigner
- type AccountProtectingSigner
- type AccountPublicKeyProvider
- type AccountSigner
- type AccountSigningThresholdProvider
- type AccountVerificationVectorProvider
- type AccountWalletProvider
- type DistributedAccount
- type Encryptor
- type Store
- type StoreLocationProvider
- type StoreProvider
- type Wallet
- type WalletAccountByIDProvider
- type WalletAccountByNameProvider
- type WalletAccountCreator
- type WalletAccountImporter
- type WalletAccountsByPathProvider
- type WalletAccountsProvider
- type WalletDistributedAccountCreator
- type WalletDistributedAccountImporter
- type WalletExporter
- type WalletIDProvider
- type WalletLocker
- type WalletNameProvider
- type WalletPathedAccountCreator
- type WalletTypeProvider
- type WalletVersionProvider
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Account ¶
type Account interface { AccountIDProvider AccountNameProvider AccountPublicKeyProvider }
Account is a generic interface for accounts, providing minimal required functionality.
type AccountCompositePublicKeyProvider ¶ added in v2.3.0
type AccountCompositePublicKeyProvider interface { // CompositePublicKey provides the composite public key for the account. CompositePublicKey() e2types.PublicKey }
AccountCompositePublicKeyProvider is the interface for accounts that can provide a composite public key.
type AccountIDProvider ¶ added in v2.3.0
AccountIDProvider is the interface for accounts that can provide an ID.
type AccountLocker ¶ added in v2.3.0
type AccountLocker interface { // Lock locks the account. A locked account cannot sign. Lock(ctx context.Context) error // Unlock unlocks the account. An unlocked account can sign. Unlock(ctx context.Context, passphrase []byte) error // IsUnlocked returns true if the account is unlocked. IsUnlocked(ctx context.Context) (bool, error) }
AccountLocker is the interface for accounts that can be locked and unlocked.
type AccountMetadataProvider ¶ added in v2.3.0
type AccountMetadataProvider interface { // WalletID provides the ID for the wallet. WalletID() uuid.UUID // ID provides the ID for the account. ID() uuid.UUID // Name provides the name for the account. Name() string }
AccountMetadataProvider provides metadata for an account. It is used for various accounting purposes, for example to ensure that no two accounts with the same name exist in a single wallet.
type AccountNameProvider ¶ added in v2.3.0
type AccountNameProvider interface { // Name provides the name for the account. Name() string }
AccountNameProvider is the interface for accounts that can provide a name.
type AccountParticipantsProvider ¶ added in v2.3.0
type AccountParticipantsProvider interface { // Participants provides the participants that hold the composite key. Participants() map[uint64]string }
AccountParticipantsProvider is the interface for accounts that can participate in distributed operations.
type AccountPathProvider ¶ added in v2.3.0
type AccountPathProvider interface { // Path provides the path for the account. Path() string }
AccountPathProvider is the interface for accounts that can provide a path.
type AccountPrivateKeyProvider ¶
type AccountPrivateKeyProvider interface { // PrivateKey provides the private key for the account. PrivateKey(ctx context.Context) (e2types.PrivateKey, error) }
AccountPrivateKeyProvider is the interface for accounts that can provide a private key.
type AccountProtectingMultiSigner ¶ added in v2.8.0
type AccountProtectingMultiSigner interface { // SignBeaconAttestations signs multiple beacon attestations with protection. SignBeaconAttestations(ctx context.Context, slot uint64, accounts []Account, committeeIndices []uint64, blockRoot []byte, sourceEpoch uint64, sourceRoot []byte, targetEpoch uint64, targetRoot []byte, domain []byte) ([]e2types.Signature, error) }
AccountProtectingMultiSigner is the interface for accounts that sign multiple requests with protection.
type AccountProtectingSigner ¶ added in v2.3.0
type AccountProtectingSigner interface { // SignGeneric signs a generic root with protection. SignGeneric(ctx context.Context, data []byte, domain []byte) (e2types.Signature, error) // SignBeaconProposal signs a beacon proposal with protection. SignBeaconProposal(ctx context.Context, slot uint64, proposerIndex uint64, parentRoot []byte, stateRoot []byte, bodyRoot []byte, domain []byte) (e2types.Signature, error) // SignBeaconAttestation signs a beacon attestation with protection. SignBeaconAttestation(ctx context.Context, slot uint64, committeeIndex uint64, blockRoot []byte, sourceEpoch uint64, sourceRoot []byte, targetEpoch uint64, targetRoot []byte, domain []byte) (e2types.Signature, error) }
AccountProtectingSigner is the interface for accounts that sign with protection.
type AccountPublicKeyProvider ¶ added in v2.3.0
type AccountPublicKeyProvider interface { // PublicKey provides the public key for the account. PublicKey() e2types.PublicKey }
AccountPublicKeyProvider is the interface for accounts that can provide a public key.
type AccountSigner ¶ added in v2.3.0
type AccountSigner interface { // Sign signs data with the account. Sign(ctx context.Context, data []byte) (e2types.Signature, error) }
AccountSigner is the interface for accounts that can sign generic data.
type AccountSigningThresholdProvider ¶ added in v2.3.0
type AccountSigningThresholdProvider interface { // SigningThreshold provides the threshold to make a valid composite signature. SigningThreshold() uint32 }
AccountSigningThresholdProvider is the interface for accounts that can provide a signing threshold.
type AccountVerificationVectorProvider ¶ added in v2.3.0
type AccountVerificationVectorProvider interface { // VerificationVector provides the composite verification vector for regeneration. VerificationVector() []e2types.PublicKey }
AccountVerificationVectorProvider is the interface for accounts that can provide a verification vector.
type AccountWalletProvider ¶ added in v2.3.0
type AccountWalletProvider interface { // Wallet provides the wallet for this account. Wallet() Wallet }
AccountWalletProvider is the interface for accounts that can provide their containing wallet.
type DistributedAccount ¶ added in v2.2.0
type DistributedAccount interface { AccountIDProvider AccountNameProvider AccountCompositePublicKeyProvider AccountSigningThresholdProvider AccountParticipantsProvider }
DistributedAccount is generic interface for distributed accounts, providing minimal required functionality.
type Encryptor ¶
type Encryptor interface { // Name() provides the name of the encryptor Name() string // Version() provides the version of the encryptor Version() uint // Encrypt encrypts a byte array with its encryption mechanism and key Encrypt(data []byte, key string) (map[string]interface{}, error) // Decrypt encrypts a byte array with its encryption mechanism and key Decrypt(data map[string]interface{}, key string) ([]byte, error) }
Encryptor is the interface for encrypting and decrypting sensitive information in wallets.
type Store ¶
type Store interface { // Name provides the name of the store Name() string // StoreWallet stores wallet data. It will fail if it cannot store the data. StoreWallet(walletID uuid.UUID, walletName string, data []byte) error // RetrieveWallet retrieves wallet data for all wallets. RetrieveWallets() <-chan []byte // RetrieveWallet retrieves wallet data for a wallet with a given name. // It will fail if it cannot retrieve the data. RetrieveWallet(walletName string) ([]byte, error) // RetrieveWalletByID retrieves wallet data for a wallet with a given ID. // It will fail if it cannot retrieve the data. RetrieveWalletByID(walletID uuid.UUID) ([]byte, error) // StoreAccount stores account data. It will fail if it cannot store the data. StoreAccount(walletID uuid.UUID, accountID uuid.UUID, data []byte) error // RetrieveAccounts retrieves account information for all accounts. RetrieveAccounts(walletID uuid.UUID) <-chan []byte // RetrieveAccount retrieves account data for a wallet with a given ID. // It will fail if it cannot retrieve the data. RetrieveAccount(walletID uuid.UUID, accountID uuid.UUID) ([]byte, error) // StoreAccountsIndex stores the index of accounts for a given wallet. StoreAccountsIndex(walletID uuid.UUID, data []byte) error // RetrieveAccountsIndex retrieves the index of accounts for a given wallet. RetrieveAccountsIndex(walletID uuid.UUID) ([]byte, error) }
Store is the interface for wallet stores. It is used to store and access data provided by wallets, both wallets themselves as well as keys inside the wallets.
type StoreLocationProvider ¶
type StoreLocationProvider interface {
Location() string
}
StoreLocationProvider provides the location of the store.
type StoreProvider ¶
type StoreProvider interface { // Store returns the store. Store() Store }
StoreProvider is the interface provides a store.
type Wallet ¶
type Wallet interface { WalletIDProvider WalletTypeProvider WalletNameProvider WalletVersionProvider WalletAccountsProvider }
Wallet is a generic interface for wallets, providing minimal required functionality.
type WalletAccountByIDProvider ¶ added in v2.3.0
type WalletAccountByIDProvider interface { // AccountByID provides a single account from the wallet given its ID. // This will error if the account is not found. AccountByID(ctx context.Context, id uuid.UUID) (Account, error) }
WalletAccountByIDProvider is the interface for wallets that provide an account given its ID.
type WalletAccountByNameProvider ¶ added in v2.3.0
type WalletAccountByNameProvider interface { // AccountByName provides a single account from the wallet given its name. // This will error if the account is not found. AccountByName(ctx context.Context, name string) (Account, error) }
WalletAccountByNameProvider is the interface for wallets that provide an account given its name.
type WalletAccountCreator ¶ added in v2.2.0
type WalletAccountCreator interface { // CreateAccount creates a new account in the wallet. // The only rule for names is that they cannot start with an underscore (_) character. // This will error if an account with the name already exists. CreateAccount(ctx context.Context, name string, passphrase []byte) (Account, error) }
WalletAccountCreator is the interface for wallets that can create accounts.
type WalletAccountImporter ¶
type WalletAccountImporter interface { // ImportAccount creates a new account in the wallet from an existing private key. // The only rule for names is that they cannot start with an underscore (_) character. // This will error if an account with the name already exists. ImportAccount(ctx context.Context, name string, key []byte, passphrase []byte) (Account, error) }
WalletAccountImporter is the interface for wallets that can import accounts.
type WalletAccountsByPathProvider ¶ added in v2.3.0
type WalletAccountsByPathProvider interface { // AccountsByPath provides all matching accounts in the wallet. AccountsByPath(ctx context.Context, path string) <-chan Account }
WalletAccountsByPathProvider is the interface for wallets that provide accounts given a path.
type WalletAccountsProvider ¶ added in v2.3.0
type WalletAccountsProvider interface { // Accounts provides all accounts in the wallet. Accounts(ctx context.Context) <-chan Account }
WalletAccountsProvider is the interface for wallets that provide account information.
type WalletDistributedAccountCreator ¶ added in v2.3.0
type WalletDistributedAccountCreator interface { // CreateDistributedAccount creates a new distributed account in the wallet. // The only rule for names is that they cannot start with an underscore (_) character. // This will error if an account with the name already exists. CreateDistributedAccount(ctx context.Context, name string, particpants uint32, signingThreshold uint32, passphrase []byte) (Account, error) }
WalletDistributedAccountCreator is the interface for wallets that can create distributed accounts.
type WalletDistributedAccountImporter ¶ added in v2.2.0
type WalletDistributedAccountImporter interface { // ImportDistributedAccount creates a new distributed account in the wallet from provided data. // The only rule for names is that they cannot start with an underscore (_) character. // This will error if an account with the name already exists. ImportDistributedAccount(ctx context.Context, name string, key []byte, signingThreshold uint32, verificationVector [][]byte, participants map[uint64]string, passphrase []byte) (Account, error) }
WalletDistributedAccountImporter is the interface for wallets that can import distributed accounts.
type WalletExporter ¶
type WalletExporter interface { // Export exports the entire wallet, protected by an additional passphrase. Export(ctx context.Context, passphrase []byte) ([]byte, error) }
WalletExporter is the interface for wallets that can export themselves.
type WalletIDProvider ¶ added in v2.3.0
WalletIDProvider is the interface for wallets that can provide an ID.
type WalletLocker ¶ added in v2.3.0
type WalletLocker interface { // Lock locks the wallet. A locked account cannot create new accounts. Lock(ctx context.Context) error // Unlock unlocks the wallet. An unlocked account can create new accounts. Unlock(ctx context.Context, passphrase []byte) error // IsUnlocked returns true if the wallet is unlocked. IsUnlocked(ctx context.Context) (bool, error) }
WalletLocker is the interface for wallets that can be locked and unlocked.
type WalletNameProvider ¶ added in v2.3.0
type WalletNameProvider interface { // Name provides the name for the wallet. Name() string }
WalletNameProvider is the interface for wallets that can provide a name.
type WalletPathedAccountCreator ¶ added in v2.7.0
type WalletPathedAccountCreator interface { // CreatePathedAccount creates a new account in the wallet with a given path. // The only rule for names is that they cannot start with an underscore (_) character. // This will error if an account with the name or path already exists. CreatePathedAccount(ctx context.Context, path string, name string, passphrase []byte) (Account, error) }
WalletPathedAccountCreator is the interface for wallets that can create accounts with explicit HD paths.
type WalletTypeProvider ¶ added in v2.3.0
type WalletTypeProvider interface { // Type provides the type for the wallet. Type() string }
WalletTypeProvider is the interface for wallets that can provide a type.
type WalletVersionProvider ¶ added in v2.3.0
type WalletVersionProvider interface { // Version provides the version of the wallet. Version() uint }
WalletVersionProvider is the interface for wallets that can provide a version.