stores

package
v0.0.0-...-f5bbbf4 Latest Latest
Warning

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

Go to latest
Published: May 2, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EthStore

type EthStore interface {
	// Create creates an Ethereum account
	Create(ctx context.Context, id string, attr *entities.Attributes) (*entities.ETHAccount, error)

	// Import imports an externally created Ethereum account
	Import(ctx context.Context, id string, privKey []byte, attr *entities.Attributes) (*entities.ETHAccount, error)

	// Get gets an Ethereum account
	Get(ctx context.Context, addr common.Address) (*entities.ETHAccount, error)

	// List lists all Ethereum account addresses
	List(ctx context.Context, limit, offset uint64) ([]common.Address, error)

	// Update updates Ethereum account attributes
	Update(ctx context.Context, addr common.Address, attr *entities.Attributes) (*entities.ETHAccount, error)

	// Delete deletes an account temporarily, by using Restore the account can be restored
	Delete(ctx context.Context, addr common.Address) error

	// GetDeleted Gets a deleted Ethereum accounts
	GetDeleted(ctx context.Context, addr common.Address) (*entities.ETHAccount, error)

	// ListDeleted lists all deleted Ethereum accounts
	ListDeleted(ctx context.Context, limit, offset uint64) ([]common.Address, error)

	// Restore restores a previously deleted Ethereum account
	Restore(ctx context.Context, addr common.Address) error

	// Destroy destroys (purges) an Ethereum account permanently
	Destroy(ctx context.Context, addr common.Address) error

	// Sign signs data using the specified Ethereum account (not exposed in the API)
	Sign(ctx context.Context, addr common.Address, data []byte) ([]byte, error)

	// SignMessage signs EIP-191 formatted data using the specified Ethereum account
	SignMessage(ctx context.Context, addr common.Address, data []byte) ([]byte, error)

	// SignTypedData signs EIP-712 formatted data using the specified Ethereum account
	SignTypedData(ctx context.Context, addr common.Address, typedData *core.TypedData) ([]byte, error)

	// SignTransaction signs a public Ethereum transaction
	SignTransaction(ctx context.Context, addr common.Address, chainID *big.Int, tx *types.Transaction) ([]byte, error)

	// SignEEA signs an EEA transaction
	SignEEA(ctx context.Context, addr common.Address, chainID *big.Int, tx *types.Transaction, args *ethereum.PrivateArgs) ([]byte, error)

	// SignPrivate signs a Quorum private transaction
	SignPrivate(ctx context.Context, addr common.Address, tx *quorumtypes.Transaction) ([]byte, error)

	// Encrypt encrypts any arbitrary data using a specified account
	Encrypt(ctx context.Context, addr common.Address, data []byte) ([]byte, error)

	// Decrypt decrypts a single block of encrypted data.
	Decrypt(ctx context.Context, addr common.Address, data []byte) ([]byte, error)
}

type KeyStore

type KeyStore interface {
	// Create creates a new key and stores it
	Create(ctx context.Context, id string, alg *entities2.Algorithm, attr *entities.Attributes) (*entities.Key, error)

	// Import imports an externally created key and stores it
	Import(ctx context.Context, id string, privKey []byte, alg *entities2.Algorithm, attr *entities.Attributes) (*entities.Key, error)

	// Get gets the public part of a stored key.
	Get(ctx context.Context, id string) (*entities.Key, error)

	// List lists keys
	List(ctx context.Context, limit, offset uint64) ([]string, error)

	// Update updates key tags
	Update(ctx context.Context, id string, attr *entities.Attributes) (*entities.Key, error)

	// Delete soft-deletes a key
	Delete(ctx context.Context, id string) error

	// GetDeleted gets a deleted key
	GetDeleted(ctx context.Context, id string) (*entities.Key, error)

	// ListDeleted lists deleted keys
	ListDeleted(ctx context.Context, limit, offset uint64) ([]string, error)

	// Restore restores a previously deleted secret
	Restore(ctx context.Context, id string) error

	// Destroy destroys a key permanently
	Destroy(ctx context.Context, id string) error

	// Sign from any arbitrary data using the specified key
	Sign(ctx context.Context, id string, data []byte, algo *entities2.Algorithm) ([]byte, error)

	// Encrypt encrypts any arbitrary data using a specified key
	Encrypt(ctx context.Context, id string, data []byte) ([]byte, error)

	// Decrypt decrypts a single block of encrypted data.
	Decrypt(ctx context.Context, id string, data []byte) ([]byte, error)
}

type SecretStore

type SecretStore interface {
	// Set secret
	Set(ctx context.Context, id, value string, attr *entities.Attributes) (*entities.Secret, error)

	// Get a secret
	Get(ctx context.Context, id string, version string) (*entities.Secret, error)

	// List secrets
	List(ctx context.Context, limit, offset uint64) ([]string, error)

	// Delete secret not permanently, it can be restored
	Delete(ctx context.Context, id string) error

	// GetDeleted secrets
	GetDeleted(ctx context.Context, id string) (*entities.Secret, error)

	// ListDeleted secrets
	ListDeleted(ctx context.Context, limit, offset uint64) ([]string, error)

	// Restore a previously deleted secret
	Restore(ctx context.Context, id string) error

	// Destroy secret permanently
	Destroy(ctx context.Context, id string) error
}

type Stores

type Stores interface {
	// CreateEthereum creates an ethereum store
	CreateEthereum(_ context.Context, name, keyStore string, allowedTenants []string, userInfo *auth.UserInfo) error

	// CreateKey creates a key store
	CreateKey(_ context.Context, name, vault, secretStore string, allowedTenants []string, userInfo *auth.UserInfo) error

	// CreateSecret creates a secret store
	CreateSecret(_ context.Context, name, vault string, allowedTenants []string, userInfo *auth.UserInfo) error

	// ImportEthereum import ethereum accounts from the vault into an ethereum store
	ImportEthereum(ctx context.Context, name string, userInfo *auth.UserInfo) error

	// ImportKeys import keys from the vault into a key store
	ImportKeys(ctx context.Context, storeName string, userInfo *auth.UserInfo) error

	// ImportSecrets import secrets from the vault into a secret store
	ImportSecrets(ctx context.Context, storeName string, userInfo *auth.UserInfo) error

	// Secret get secret store by name
	Secret(ctx context.Context, storeName string, userInfo *auth.UserInfo) (SecretStore, error)

	// Key get key store by name
	Key(ctx context.Context, storeName string, userInfo *auth.UserInfo) (KeyStore, error)

	// Ethereum get ethereum store by name
	Ethereum(ctx context.Context, storeName string, userInfo *auth.UserInfo) (EthStore, error)

	// EthereumByAddr gets ethereum store by address
	EthereumByAddr(ctx context.Context, addr common.Address, userInfo *auth.UserInfo) (EthStore, error)

	// List stores
	List(ctx context.Context, storeType string, userInfo *auth.UserInfo) ([]string, error)

	// ListAllAccounts list all accounts from all stores
	ListAllAccounts(ctx context.Context, userInfo *auth.UserInfo) ([]common.Address, error)
}

Directories

Path Synopsis
api
connectors
mock
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.
store

Jump to

Keyboard shortcuts

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