seedwords

package
v0.0.0-...-46f88e6 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2023 License: ISC Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Seed

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

Unencrypted seed, used for deriving keys, this should be cleared when not needed using seed.Zero().

func RandomSeed

func RandomSeed() (*Seed, er.R)

Generate a random seed with a birthday of right now

func (*Seed) Birthday

func (s *Seed) Birthday() time.Time

Provide the day when the seed was first created, useful for determining how far back in time you must search for possible payments to the wallet.

func (*Seed) Bytes

func (s *Seed) Bytes() []byte

Bytes returns the secret seed, 19 bytes long including the birthday bytes which provide a small amount of additional entropy.

func (*Seed) Encrypt

func (s *Seed) Encrypt(passphrase []byte) *SeedEnc

Encrypt converts a Seed to a SeedEnc using a passphrase, if the passphrase is the empty string then the SeedEnc will be flagged as not requiring a passphrase to decrypt.

func (*Seed) Zero

func (s *Seed) Zero()

Zero wipes the data of this seed from memory.

type SeedEnc

type SeedEnc struct {
	Bytes [encByteLen]byte
}

func SeedFromWords

func SeedFromWords(words string) (*SeedEnc, er.R)

SeedFromWords creates an encrypted seed from a set of words, the language is auto-detected.

func (*SeedEnc) Decrypt

func (s *SeedEnc) Decrypt(passphrase []byte, force bool) (*Seed, er.R)

Decrypt converts a SeedEnc into a Seed (decrypted) If no passphrase is required by the seed (see: seed.NeedsPassphrase()), the passphrase is not used. If the decrypted seed birthday is in the future or so far in the past as to be before the seed derivation code was written, this function will result in an error, unless force is true.

func (*SeedEnc) NeedsPassphrase

func (s *SeedEnc) NeedsPassphrase() bool

NeedsPassphrase returns true if the seed requires a passphrase in order to decrypt.

func (*SeedEnc) Words

func (s *SeedEnc) Words(lang string) (string, er.R)

Words converts the encrypted seed to it's representation as a list of words.

func (*SeedEnc) Zero

func (s *SeedEnc) Zero()

Zero wipes the data from this seed from memory.

Jump to

Keyboard shortcuts

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