Documentation
¶
Index ¶
Constants ¶
View Source
const ( // FirstHardenedIndex is the index of the first hardened key (2^31). // https://youtu.be/2HrMlVr1QX8?t=390 FirstHardenedIndex = uint32(0x80000000) // RecommendedSeedLen is the recommended length in bytes for a seed // to a master node. RecommendedSeedLen = 32 // 256 bits // MinSeedBytes is the minimum number of bytes allowed for a seed to // a master node. MinSeedBytes = 16 // 128 bits // MaxSeedBytes is the maximum number of bytes allowed for a seed to // a master node. MaxSeedBytes = 64 // 512 bits )
Variables ¶
View Source
var ( ErrInvalidPath = fmt.Errorf("invalid derivation path") ErrNoPublicDerivation = fmt.Errorf("no public derivation for ed25519") // ErrInvalidSeedLen describes an error in which the provided seed or // seed length is not in the allowed range. ErrInvalidSeedLen = fmt.Errorf("seed length must be between %d and %d "+ "bits", MinSeedBytes*8, MaxSeedBytes*8) )
Functions ¶
func GenerateSeed ¶
GenerateSeed returns a cryptographically secure random seed that can be used as the input for the NewMaster function to generate a new master node.
The length is in bytes, and it must be between 16 and 64 (128 to 512 bits). The recommended length is 32 (256 bits) as defined by the RecommendedSeedLen constant.
func IsValidPath ¶
IsValidPath check whether or not the path has valid segments.
Types ¶
type Node ¶
type Node interface { Derive(i uint32) (Node, error) KeyPair() (ed25519.PublicKey, ed25519.PrivateKey) PrivateKey() []byte PublicKeyWithPrefix() []byte RawSeed() []byte Serialize() string Bytes() []byte Zero() }
func DeriveForPath ¶
DeriveForPath derives key for a path in BIP-44 format and a seed. Ed25119 derivation operated on hardened keys only.
func NewMasterNode ¶
NewMasterNode generates a new master key from seed.
func NewNodeFromString ¶
Click to show internal directories.
Click to hide internal directories.