Documentation ¶
Overview ¶
Package hdw provides a unified API for dealing with hierarchical deterministic keys also known as hierarchical deterministic wallets in application to blockchains as defined in BIP-32 and SLIP-10
Index ¶
Constants ¶
const ChainCodeSize = 32
ChainCodeSize is the length of chain code common for all key types
const Hard uint32 = 1 << 31
Hard is the flag signifying so called hardened derivation if added to the derivation index. The exact use of it is specific to the chosen algorithm but in general it means that the private key is used to build the hash chain
Variables ¶
var ErrHardenedPublic = errors.New("hdw: can't use hardened derivation with public key")
ErrHardenedPublic returned if an attempt to use hardened derivation with a public key was made
Functions ¶
func Derive ¶
Derive returns a child key of root using a full path. root must be either PrivateKey or PublicKey
func NewSeedFromMnemonic ¶
NewSeedFromMnemonic generates the seed value from the mnemonic as specified in BIP-39. The seed is the primary secret used to derive root keys and their derivatives
Types ¶
type Path ¶
type Path []uint32
Path is a BIP-32/SLIP-10 derivation path
type PrivateKey ¶
type PrivateKey interface { crypto.Signer // Equal reports whether receiver and x have the same value Equal(x crypto.PrivateKey) bool // Chain returns the chain code Chain() []byte // Derive returns a child key of the receiver using a single index Derive(index uint32) (PrivateKey, error) // Derive returns a child key of the receiver using a full path DerivePath(path Path) (PrivateKey, error) // Public returns the extended public key corresponding to the receiver ExtendedPublic() PublicKey // Naked returns the naked private key that can be used with the standard Go crypto library Naked() crypto.PrivateKey }
PrivateKey is an extended private key bearing the chain code required for derivation of child keys
type PublicKey ¶
type PublicKey interface { // Equal reports whether receiver and x have the same value Equal(x crypto.PublicKey) bool // Chain returns the chain code Chain() []byte // Derive returns a child key of the receiver using single index Derive(index uint32) (PublicKey, error) // Derive returns a child key of the receiver using a full path DerivePath(path Path) (PublicKey, error) // Naked returns the naked public key that can be used with the standard Go crypto library Naked() crypto.PublicKey }
PrivateKey is an extended public key bearing the chain code required for derivation of child keys
Directories ¶
Path | Synopsis |
---|---|
Package bip25519 deals with BIP32-Ed25519 keys as specified in paper by Khovratovich and Law.
|
Package bip25519 deals with BIP32-Ed25519 keys as specified in paper by Khovratovich and Law. |
ex25519
Package ex25519 provides operations with expanded 512 bit ed25519 private keys.
|
Package ex25519 provides operations with expanded 512 bit ed25519 private keys. |
Package ed25519 deals with SLIP-10/Ed25519 keys.
|
Package ed25519 deals with SLIP-10/Ed25519 keys. |