Documentation ¶
Index ¶
- func PrivateKeyFile(name string) string
- func ToConfig(accounts Accounts) config.Accounts
- type Account
- type Accounts
- type BIP44Key
- func (a BIP44Key) HashAlgo() crypto.HashAlgorithm
- func (a BIP44Key) Index() int
- func (a *BIP44Key) PrivateKey() (*crypto.PrivateKey, error)
- func (a BIP44Key) SigAlgo() crypto.SignatureAlgorithm
- func (a *BIP44Key) Signer(ctx context.Context) (crypto.Signer, error)
- func (a *BIP44Key) ToConfig() config.AccountKey
- func (a BIP44Key) Type() config.KeyType
- func (a *BIP44Key) Validate() error
- type FileKey
- func (a FileKey) HashAlgo() crypto.HashAlgorithm
- func (a FileKey) Index() int
- func (f *FileKey) PrivateKey() (*crypto.PrivateKey, error)
- func (a FileKey) SigAlgo() crypto.SignatureAlgorithm
- func (f *FileKey) Signer(ctx context.Context) (crypto.Signer, error)
- func (f *FileKey) ToConfig() config.AccountKey
- func (a FileKey) Type() config.KeyType
- func (a FileKey) Validate() error
- type HexKey
- func (a HexKey) HashAlgo() crypto.HashAlgorithm
- func (a HexKey) Index() int
- func (a *HexKey) PrivateKey() (*crypto.PrivateKey, error)
- func (a HexKey) SigAlgo() crypto.SignatureAlgorithm
- func (a *HexKey) Signer(ctx context.Context) (crypto.Signer, error)
- func (a *HexKey) ToConfig() config.AccountKey
- func (a HexKey) Type() config.KeyType
- func (a *HexKey) Validate() error
- type KMSKey
- func (a KMSKey) HashAlgo() crypto.HashAlgorithm
- func (a KMSKey) Index() int
- func (a *KMSKey) PrivateKey() (*crypto.PrivateKey, error)
- func (a KMSKey) SigAlgo() crypto.SignatureAlgorithm
- func (a *KMSKey) Signer(ctx context.Context) (crypto.Signer, error)
- func (a *KMSKey) ToConfig() config.AccountKey
- func (a KMSKey) Type() config.KeyType
- func (a *KMSKey) Validate() error
- type Key
- type PublicKey
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PrivateKeyFile ¶ added in v1.13.0
PrivateKeyFile returns the private key file name for an account.
Types ¶
type Account ¶
Account is defined by an address and name and contains an Key which can be used for signing.
func NewEmulatorAccount ¶
func NewEmulatorAccount( rw config.ReaderWriter, sigAlgo crypto.SignatureAlgorithm, hashAlgo crypto.HashAlgorithm, ) (*Account, error)
type Accounts ¶
type Accounts []Account
Accounts is a collection of account.
func (*Accounts) AddOrUpdate ¶
AddOrUpdate add account if missing or updates if present.
type BIP44Key ¶
type BIP44Key struct {
// contains filtered or unexported fields
}
BIP44Key implements https://github.com/onflow/flow/blob/master/flips/20201125-bip-44-multi-account.md
func (BIP44Key) HashAlgo ¶
func (a BIP44Key) HashAlgo() crypto.HashAlgorithm
func (*BIP44Key) PrivateKey ¶
func (a *BIP44Key) PrivateKey() (*crypto.PrivateKey, error)
func (BIP44Key) SigAlgo ¶
func (a BIP44Key) SigAlgo() crypto.SignatureAlgorithm
func (*BIP44Key) ToConfig ¶
func (a *BIP44Key) ToConfig() config.AccountKey
type FileKey ¶
type FileKey struct {
// contains filtered or unexported fields
}
FileKey represents a key that is saved in a seperate file and will be lazy-loaded.
The FileKey stores location of the file where private key is stored in hex-encoded format.
func NewFileKey ¶
func NewFileKey( location string, index int, sigAlgo crypto.SignatureAlgorithm, hashAlgo crypto.HashAlgorithm, rw config.ReaderWriter, ) *FileKey
NewFileKey creates a new account key that is stored to a separate file in the provided location.
This type of the key is a more secure way of storing accounts. The config only includes the location and not the key.
func (FileKey) HashAlgo ¶
func (a FileKey) HashAlgo() crypto.HashAlgorithm
func (*FileKey) PrivateKey ¶
func (f *FileKey) PrivateKey() (*crypto.PrivateKey, error)
func (FileKey) SigAlgo ¶
func (a FileKey) SigAlgo() crypto.SignatureAlgorithm
func (*FileKey) ToConfig ¶
func (f *FileKey) ToConfig() config.AccountKey
type HexKey ¶
type HexKey struct {
// contains filtered or unexported fields
}
HexKey implements account key in hex representation.
func NewHexKeyFromPrivateKey ¶
func NewHexKeyFromPrivateKey( index int, hashAlgo crypto.HashAlgorithm, privateKey crypto.PrivateKey, ) *HexKey
func (HexKey) HashAlgo ¶
func (a HexKey) HashAlgo() crypto.HashAlgorithm
func (*HexKey) PrivateKey ¶
func (a *HexKey) PrivateKey() (*crypto.PrivateKey, error)
func (HexKey) SigAlgo ¶
func (a HexKey) SigAlgo() crypto.SignatureAlgorithm
func (*HexKey) ToConfig ¶
func (a *HexKey) ToConfig() config.AccountKey
type KMSKey ¶
type KMSKey struct {
// contains filtered or unexported fields
}
KMSKey implements Gcloud KMS system for signing.
func (KMSKey) HashAlgo ¶
func (a KMSKey) HashAlgo() crypto.HashAlgorithm
func (*KMSKey) PrivateKey ¶
func (a *KMSKey) PrivateKey() (*crypto.PrivateKey, error)
func (KMSKey) SigAlgo ¶
func (a KMSKey) SigAlgo() crypto.SignatureAlgorithm
func (*KMSKey) ToConfig ¶
func (a *KMSKey) ToConfig() config.AccountKey
ToConfig convert account key to configuration.
type Key ¶
type Key interface { // Type returns the key type (hex, kms, file...) Type() config.KeyType // Index returns the key index on the account Index() int // SigAlgo returns signature algorithm used for signing SigAlgo() crypto.SignatureAlgorithm // HashAlgo returns hash algorithm used for signing HashAlgo() crypto.HashAlgorithm // Signer is used when we want to sign a transaction, using the Sign() function Signer(ctx context.Context) (crypto.Signer, error) // ToConfig converts the key to the storable key format ToConfig() config.AccountKey // Validate key Validate() error // PrivateKey returns the private key if possible, // depends on the key type PrivateKey() (*crypto.PrivateKey, error) }
Key defines functions any key representation must implement.
type PublicKey ¶
type PublicKey struct { Public crypto.PublicKey Weight int SigAlgo crypto.SignatureAlgorithm HashAlgo crypto.HashAlgorithm }
PublicKey contains public account key information.