Documentation
¶
Index ¶
- func ReadCmpConfig(path string) (*cmp.Config, error)
- type Account
- type FileStore
- func (fs *FileStore) ListAccounts() (map[crypto.CoinType][]Account, error)
- func (fs *FileStore) ListAccountsForToken(coinType crypto.CoinType) ([]Account, error)
- func (fs *FileStore) WriteCmpConfigs(ct crypto.CoinType, cmpConfigs []*cmp.Config) (Account, error)
- func (fs *FileStore) WriteEncShares(ct crypto.CoinType, cmpConfigs map[string][]byte) (Account, error)
- type KeyShare
- type Wallet
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Account ¶
type Account interface {
// Address returns the address of the account based on the coin type
Address() string
// CoinType returns the coin type of the account
CoinType() crypto.CoinType
// DID returns the DID of the account
DID() string
ListKeyshares() ([]KeyShare, error)
// Name returns the name of the account
Name() string
// Path returns the path of the account
Path() string
// PartyIDs returns the party IDs of the account
PartyIDs() []crypto.PartyID
// PubKey returns secp256k1 public key
PubKey() *crypto.PubKey
// Rename renames the account
Rename(name string) error
// Signs a message
Sign(bz []byte) ([]byte, error)
// Type returns the type of the account
Type() string
// VerificationMethod returns the verification method for the account
VerificationMethod(controller string) *types.VerificationMethod
// Verifies a signature
Verify(bz []byte, sig []byte) (bool, error)
}
Account is an interface for an account in the wallet
func NewWalletAccount ¶ added in v0.4.3
NewWalletAccount loads an accound directory and returns a WalletAccount
type FileStore ¶ added in v0.4.3
type FileStore struct {
// contains filtered or unexported fields
}
func NewFileStore ¶ added in v0.4.3
func (*FileStore) ListAccounts ¶ added in v0.4.3
GetAccountNames returns a list of all account names for each supported coin in the BIP32 file system.
func (*FileStore) ListAccountsForToken ¶ added in v0.4.3
ListAccountNames returns a list of all account names in the BIP32 file system.
func (*FileStore) WriteCmpConfigs ¶ added in v0.4.3
WriteCmpConfig writes a CmpConfig to the BIP32 file system.
type KeyShare ¶ added in v0.4.3
type KeyShare interface {
Path() string
Config() *cmp.Config
CoinType() crypto.CoinType
AccountName() string
Encrypt(credential *crypto.WebauthnCredential, pin string) error
Decrypt(credential *crypto.WebauthnCredential, pin string) error
}
KeyShare is a type that interacts with a cmp.Config file located on disk.
func NewKeyshare ¶ added in v0.4.3
NewKeyshare creates a new KeyShare.
type Wallet ¶ added in v0.4.3
type Wallet interface {
// Get the wallet's controller
Controller() string
// Count returns the number of accounts in the wallet for the given coin type
Count(coin crypto.CoinType) int
// Size returns the disk size of the wallet
Size() (int64, error)
// CreateAccount creates a new account for the given coin type
CreateAccount(coin crypto.CoinType) (Account, error)
// Export exports the wallet to the given path
Export() ([]byte, error)
// ListAllocatedCoins returns a list of coins that this currently has accounts for
ListCoins() ([]crypto.CoinType, error)
// ListAccounts returns a list of accounts for the given coin type
ListAccounts() (map[crypto.CoinType][]Account, error)
// ListAccountsForCoin returns a list of accounts for the given coin type
ListAccountsForCoin(coin crypto.CoinType) ([]Account, error)
// GetAccount returns the account for the given coin type and account index
GetAccount(coin crypto.CoinType, index int) (Account, error)
// GetAccountByAddress returns the account for the given address and parses the coin type from the address
GetAccountByAddress(address string) (Account, error)
// GetAccountByDID returns the account for the given DID and parses the coin type from the DID
GetAccountByDID(did string) (Account, error)
// SetAuthentication sets the authentication method for the wallet
SetAuthentication(credential *crypto.WebauthnCredential, pin string) error
// SignWithDID signs the given message with the private key of the account with the given DID
SignWithDID(did string, msg []byte) ([]byte, error)
// VerifyWithDID verifies the given signature with the public key of the account with the given DID
VerifyWithDID(did string, msg, sig []byte) (bool, error)
}
func LoadWallet ¶ added in v0.4.3
LoadWallet loads a wallet from the given path
Click to show internal directories.
Click to hide internal directories.