keys

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2024 License: ISC Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const LastVersion = 1

LastVersion is the most up to date file format version

Variables

This section is empty.

Functions

Types

type EncryptedMnemonic

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

EncryptedMnemonic represents an encrypted mnemonic

func CreateMnemonics

func CreateMnemonics(params *dagconfig.Params, numKeys uint32, cmdLinePassword string, isMultisig bool) (encryptedPrivateKeys []*EncryptedMnemonic, extendedPublicKeys []string, err error)

CreateMnemonics generates `numKeys` number of mnemonics.

func ImportMnemonics

func ImportMnemonics(params *dagconfig.Params, numKeys uint32, cmdLinePassword string, isMultisig bool) (encryptedPrivateKeys []*EncryptedMnemonic, extendedPublicKeys []string, err error)

ImportMnemonics imports a `numKeys` of mnemonics.

type File

type File struct {
	Version            uint32
	NumThreads         uint8 // This field is ignored for versions different than 0
	EncryptedMnemonics []*EncryptedMnemonic
	ExtendedPublicKeys []string
	MinimumSignatures  uint32
	CosignerIndex      uint32

	ECDSA bool
	// contains filtered or unexported fields
}

File holds all the data related to the wallet keys

func NewFileFromMnemonic

func NewFileFromMnemonic(params *dagconfig.Params, mnemonic string, password string) (*File, error)

NewFileFromMnemonic generates a new File from the given mnemonic string

func ReadKeysFile

func ReadKeysFile(netParams *dagconfig.Params, path string) (*File, error)

ReadKeysFile returns the data related to the keys file

func (*File) DecryptMnemonics

func (d *File) DecryptMnemonics(password string) ([]string, error)

DecryptMnemonics asks the user to enter the password for the private keys and returns the decrypted private keys.

func (*File) LastUsedExternalIndex

func (d *File) LastUsedExternalIndex() uint32

LastUsedExternalIndex returns the last used index in the external key chain and saves the file with the updated data.

func (*File) LastUsedInternalIndex

func (d *File) LastUsedInternalIndex() uint32

LastUsedInternalIndex returns the last used index in the internal key chain

func (*File) Path

func (d *File) Path() string

Path returns the file path.

func (*File) Save

func (d *File) Save() error

Save writes the file contents to the disk.

func (*File) SetLastUsedExternalIndex

func (d *File) SetLastUsedExternalIndex(index uint32) error

SetLastUsedExternalIndex sets the last used index in the external key chain, and saves the file with the updated data.

func (*File) SetLastUsedInternalIndex

func (d *File) SetLastUsedInternalIndex(index uint32) error

SetLastUsedInternalIndex sets the last used index in the internal key chain, and saves the file.

func (*File) SetPath

func (d *File) SetPath(params *dagconfig.Params, path string, forceOverride bool) error

SetPath sets the path where the file is saved to.

func (*File) TryLock

func (d *File) TryLock() error

TryLock tries to acquire an exclusive lock for the file.

Jump to

Keyboard shortcuts

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