ed25519hd

package module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 22, 2023 License: Apache-2.0 Imports: 14 Imported by: 3

Documentation

Overview

Package ed25519hd provides hierarchical derivation of ED255-19 keys.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrUnhardenedElement is returned when an element in a path is not hardened.
	ErrUnhardenedElement = errors.New("elements must be hardened")
	// ErrInvalidPath is returned when a path is invalid.
	ErrInvalidPath = errors.New("invalid path")
)
View Source
var (
	// ErrElementTooLarge is returned when a path element is too large.
	ErrElementTooLarge = errors.New("path element cannot be larger than 4294967295")
)

Functions

func Keys

func Keys(seed []byte, path string) ([]byte, []byte, error)

Keys generates the Ed25519 public and private keys given a seed and a path. https://github.com/satoshilabs/slips/blob/master/slip-0010.md

func SeedFromMnemonic

func SeedFromMnemonic(mnemonic string, passphrase string) ([]byte, error)

SeedFromMnemonic takes a BIP39 mnemonic and generates a seed.

func ValidateMnemonic

func ValidateMnemonic(mnemonic string) (bool, error)

ValidateMnemonic returns true if the mnemonic is valid. Note that this expects mnemonics to be of 24 words; other lengths are not supported.

Types

type Key

type Key struct {
	// contains filtered or unexported fields
}

Key is an ED255-19 key.

func DeriveKey

func DeriveKey(seed []byte, path string) (*Key, error)

DeriveKey derives a key given a seed and a derivation path.

func MasterKeyFromSeed

func MasterKeyFromSeed(seed []byte) (*Key, error)

MasterKeyFromSeed generates a master key given a seed. The seed must be 64 bytes to be valid.

func (*Key) PublicKey

func (k *Key) PublicKey() ([]byte, error)

PublicKey returns the public key for a derived private key.

func (*Key) Seed

func (k *Key) Seed() [32]byte

Seed returns a copy of the seed for a derived path.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL