types

package
v0.0.0-...-308b279 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 3, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

Account is a generic interface for accounts, providing minimal required functionality.

type AccountCompositePublicKeyProvider

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

type AccountIDProvider interface {
	// ID provides the ID for the account.
	ID() uuid.UUID
}

AccountIDProvider is the interface for accounts that can provide an ID.

type AccountLocker

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

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

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

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

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

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

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

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

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

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

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

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 BatchRetriever

type BatchRetriever interface {
	// RetrieveBatch retrieves the batch of accounts for a given wallet.
	RetrieveBatch(ctx context.Context, walletID uuid.UUID) ([]byte, error)
}

BatchRetriever is an interface for retrieving account batches.

type BatchStorer

type BatchStorer interface {
	// StoreBatch stores wallet batch data.  It will fail if it cannot store the data.
	StoreBatch(ctx context.Context, walletID uuid.UUID, walletName string, data []byte) error
}

BatchStorer is an interface for storing account batches.

type DistributedAccount

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

	// String provides a string value for the encryptor.
	String() string

	// Encrypt encrypts a byte array with its encryption mechanism and key.
	Encrypt(data []byte, key string) (map[string]any, error)

	// Decrypt encrypts a byte array with its encryption mechanism and key.
	Decrypt(data map[string]any, key string) ([]byte, error)
}

Encryptor is the interface for encrypting and decrypting sensitive information in wallets.

type ShardedAccount

ShardedAccount is generic interface for sharded accounts, providing minimal required functionality.

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

Wallet is a generic interface for wallets, providing minimal required functionality.

type WalletAccountByIDProvider

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

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

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

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

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 WalletBatchCreator

type WalletBatchCreator interface {
	// BatchWallet encrypts all accounts in a single entity, allowing for faster
	// decryption of wallets with large numbers of accounts.
	BatchWallet(ctx context.Context, passphrases []string, batchPassphrase string) error
}

type WalletDistributedAccountCreator

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

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

type WalletIDProvider interface {
	// ID provides the ID for the wallet.
	ID() uuid.UUID
}

WalletIDProvider is the interface for wallets that can provide an ID.

type WalletLocker

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

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

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 WalletShardedAccountImporter

type WalletShardedAccountImporter interface {
	// ImportShardedAccount creates a new sharded 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.
	ImportShardedAccount(ctx context.Context,
		name string,
		key []byte,
		signingThreshold uint32,
		compositePublicKey []byte,
		participants map[uint64]string,
		passphrase []byte) (Account, error)
}

WalletShardedAccountImporter is the interface for wallets that can import sharded accounts.

type WalletTypeProvider

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

type WalletVersionProvider interface {
	// Version provides the version of the wallet.
	Version() uint
}

WalletVersionProvider is the interface for wallets that can provide a version.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL