Documentation ¶
Index ¶
- Constants
- Variables
- func CheckMnemonic(mnemonic string) error
- func GenerateMnemonic(bitSize int) (string, error)
- func H[T constraints.Integer](i T) uint32
- func NewErrAddressNotFound(addr string) error
- type AddressInfo
- type AddressNotFoundError
- type Vault
- func (v *Vault) AddressCount() int
- func (v *Vault) AddressFromPath(p string) *AddressInfo
- func (v *Vault) AddressInfo(addr string) *AddressInfo
- func (v *Vault) AddressInfos() []AddressInfo
- func (v *Vault) AllAccountAddresses() []AddressInfo
- func (v *Vault) AllImportedPrivateKeysAddresses() []AddressInfo
- func (v *Vault) AllValidatorAddresses() []AddressInfo
- func (v *Vault) Contains(addr string) bool
- func (v *Vault) ImportPrivateKey(password string, prv *bls.PrivateKey) error
- func (v *Vault) IsEncrypted() bool
- func (v *Vault) IsNeutered() bool
- func (v *Vault) Label(addr string) string
- func (v *Vault) Mnemonic(password string) (string, error)
- func (v *Vault) Neuter() *Vault
- func (v *Vault) NewBLSAccountAddress(label string) (*AddressInfo, error)
- func (v *Vault) NewValidatorAddress(label string) (*AddressInfo, error)
- func (v *Vault) PrivateKeys(password string, addrs []string) ([]crypto.PrivateKey, error)
- func (v *Vault) SetLabel(addr, label string) error
- func (v *Vault) SortAddressesByAddressIndex(addrs ...AddressInfo)
- func (v *Vault) SortAddressesByAddressType(addrs ...AddressInfo)
- func (v *Vault) SortAddressesByPurpose(addrs ...AddressInfo)
- func (v *Vault) UpdatePassword(oldPassword, newPassword string, opts ...encrypter.Option) error
Constants ¶
View Source
const ( TypeFull = int(1) TypeNeutered = int(2) )
View Source
const ( PurposeBLS12381 = uint32(12381) PurposeImportPrivateKey = uint32(65535) )
Variables ¶
View Source
var ( // ErrAddressExists describes an error in which the address already exist // in wallet. ErrAddressExists = errors.New("address already exists") // ErrInvalidPath describes an error in which the key path is invalid. ErrInvalidPath = errors.New("the key path is invalid") // ErrNeutered describes an error in which the wallet is neutered. ErrNeutered = errors.New("wallet is neutered") // ErrInvalidCoinType describes an error in which the coin type is not valid. ErrInvalidCoinType = errors.New("invalid coin type") // ErrUnsupportedPurpose describes an error in which the purpose is not supported. ErrUnsupportedPurpose = errors.New("unsupported purpose") )
Functions ¶
func CheckMnemonic ¶ added in v0.13.0
CheckMnemonic validates a mnemonic (seed phrase) based on BIP-39.
func GenerateMnemonic ¶
GenerateMnemonic generates a new mnemonic (seed phrase) based on BIP-39 https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki
func H ¶ added in v0.18.0
func H[T constraints.Integer](i T) uint32
H hardens the value 'i' by adding it to 0x80000000 (2^31).
func NewErrAddressNotFound ¶
Types ¶
type AddressInfo ¶
type AddressNotFoundError ¶ added in v0.15.0
type AddressNotFoundError struct {
// contains filtered or unexported fields
}
AddressNotFoundError describes an error in which the address doesn't exist in wallet.
func (AddressNotFoundError) Error ¶ added in v0.15.0
func (e AddressNotFoundError) Error() string
type Vault ¶
type Vault struct { Type int `json:"type"` // Wallet type. 1: Full keys, 2: Neutered CoinType uint32 `json:"coin_type"` // Coin type: 21888 for Mainnet, 21777 for Testnet Addresses map[string]AddressInfo `json:"addresses"` // All addresses that are stored in the wallet Encrypter encrypter.Encrypter `json:"encrypter"` // Encryption algorithm KeyStore string `json:"key_store"` // KeyStore that stores the secrets and encrypts using Encrypter Purposes purposes `json:"purposes"` // Contains Purpose 12381 for BLS signature }
func CreateVaultFromMnemonic ¶
func (*Vault) AddressCount ¶
func (*Vault) AddressFromPath ¶ added in v0.18.0
func (v *Vault) AddressFromPath(p string) *AddressInfo
func (*Vault) AddressInfo ¶
func (v *Vault) AddressInfo(addr string) *AddressInfo
AddressInfo like it can return bls.PublicKey instead of string.
func (*Vault) AddressInfos ¶ added in v0.15.0
func (v *Vault) AddressInfos() []AddressInfo
func (*Vault) AllAccountAddresses ¶ added in v1.1.0
func (v *Vault) AllAccountAddresses() []AddressInfo
func (*Vault) AllImportedPrivateKeysAddresses ¶ added in v0.18.0
func (v *Vault) AllImportedPrivateKeysAddresses() []AddressInfo
func (*Vault) AllValidatorAddresses ¶ added in v0.18.0
func (v *Vault) AllValidatorAddresses() []AddressInfo
func (*Vault) ImportPrivateKey ¶
func (v *Vault) ImportPrivateKey(password string, prv *bls.PrivateKey) error
func (*Vault) IsEncrypted ¶
func (*Vault) IsNeutered ¶
func (*Vault) NewBLSAccountAddress ¶ added in v0.15.0
func (v *Vault) NewBLSAccountAddress(label string) (*AddressInfo, error)
func (*Vault) NewValidatorAddress ¶ added in v0.15.0
func (v *Vault) NewValidatorAddress(label string) (*AddressInfo, error)
func (*Vault) PrivateKeys ¶ added in v0.10.0
func (*Vault) SortAddressesByAddressIndex ¶ added in v0.18.0
func (v *Vault) SortAddressesByAddressIndex(addrs ...AddressInfo)
func (*Vault) SortAddressesByAddressType ¶ added in v0.18.0
func (v *Vault) SortAddressesByAddressType(addrs ...AddressInfo)
func (*Vault) SortAddressesByPurpose ¶ added in v0.18.0
func (v *Vault) SortAddressesByPurpose(addrs ...AddressInfo)
Click to show internal directories.
Click to hide internal directories.