Documentation
¶
Index ¶
Constants ¶
const ( // FirstHardenedIndex is the index of the first hardened key (2^31). // https://youtu.be/2HrMlVr1QX8?t=390 FirstHardenedIndex = uint32(0x80000000) )
Variables ¶
var ( ErrInvalidPath = fmt.Errorf("invalid derivation path") ErrNoPublicDerivation = fmt.Errorf("no public derivation for ed25519") )
Functions ¶
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
MarshalBinary() ([]byte, error)
}
func DeriveForPath ¶
DeriveForPath derives the node at `path` starting from a ROOT seed.
Use this when you have the rootSeed(e.g. extracted from the mnemonic) and a derivation path, and you want to deterministically re-create the SAME node every time from the root.
Do NOT pass a node's RawSeed() here — that 32-byte value is only the ed25519 key seed for that node and does not include its chain code. Feeding it here creates a NEW unrelated root.
func NewMasterNode ¶
NewMasterNode constructs the SLIP-0010 *master node* from a ROOT seed.
Use this when you have the original root entropy and want to (re)build a tree deterministically from the top (e.g., together with a path like "m/44'/..."). Security: anyone with rootSeed can derive the entire tree. Treat as highly sensitive.
rootSeed: arbitrary-length seed per SLIP-0010 (typically 16–64 bytes).
func UnmarshalNode ¶ added in v1.0.1
UnmarshalNode restores a node from a 64-byte key||chainCode blob produced by MarshalBinary. Use this when you saved a node checkpoint and want to continue deriving BELOW that node.