Documentation ¶
Overview ¶
Package pseudohsm provides a pseudo HSM for development environments.
Package pseudohsm provides a pseudo HSM for development environments.
Index ¶
- Constants
- Variables
- func EncryptKey(key *XKey, auth string, scryptN, scryptP int) ([]byte, error)
- type AmbiguousKeyError
- type HSM
- func (h *HSM) Backup() (*KeyImage, error)
- func (h *HSM) HasAlias(alias string) bool
- func (h *HSM) HasKey(xprv chainkd.XPrv) bool
- func (h *HSM) ImportKeyFromMnemonic(alias string, auth string, mnemonic string, language string) (*XPub, error)
- func (h *HSM) ListKeys() []XPub
- func (h *HSM) LoadChainKDKey(xpub chainkd.XPub, auth string) (xprv chainkd.XPrv, err error)
- func (h *HSM) ResetPassword(xpub chainkd.XPub, oldAuth, newAuth string) error
- func (h *HSM) Restore(image *KeyImage) error
- func (h *HSM) UpdateKeyAlias(xpub chainkd.XPub, newAlias string) error
- func (h *HSM) XCreate(alias string, auth string, language string) (*XPub, *string, error)
- func (h *HSM) XDelete(xpub chainkd.XPub, auth string) error
- func (h *HSM) XSign(xpub chainkd.XPub, path [][]byte, msg []byte, auth string) ([]byte, error)
- type KeyImage
- type XKey
- type XPub
Constants ¶
View Source
const ( // StandardScryptN n,r,p = 2^18, 8, 1 uses 256MB memory and approx 1s CPU time on a modern CPU. StandardScryptN = 1 << 18 // StandardScryptP fit above StandardScryptP = 1 // LightScryptN n,r,p = 2^12, 8, 6 uses 4MB memory and approx 100ms CPU time on a modern CPU. LightScryptN = 1 << 12 //LightScryptP fit above LightScryptP = 6 )
View Source
const EntropyLength = 128
EntropyLength random entropy length to generate mnemonics.
Variables ¶
View Source
var ( ErrDuplicateKeyAlias = errors.New("duplicate key alias") ErrXPubFormat = errors.New("xpub format error") ErrLoadKey = errors.New("key not found or wrong password ") ErrDecrypt = errors.New("could not decrypt key with given passphrase") ErrMnemonicLength = errors.New("mnemonic length error") )
pre-define errors for supporting bytom errorFormatter
Functions ¶
Types ¶
type AmbiguousKeyError ¶ added in v0.1.4
AmbiguousKeyError is returned when attempting to unlock an XPub for which more than one file exists.
func (*AmbiguousKeyError) Error ¶ added in v0.1.4
func (err *AmbiguousKeyError) Error() string
type HSM ¶
type HSM struct {
// contains filtered or unexported fields
}
HSM type for storing pubkey and privatekey
func (*HSM) ImportKeyFromMnemonic ¶ added in v1.0.7
func (h *HSM) ImportKeyFromMnemonic(alias string, auth string, mnemonic string, language string) (*XPub, error)
ImportKeyFromMnemonic produces a xprv from mnemonic and stores it in the db.
func (*HSM) LoadChainKDKey ¶ added in v0.3.0
LoadChainKDKey get xprv from xpub
func (*HSM) ResetPassword ¶
ResetPassword reset passphrase for an existing xpub
func (*HSM) UpdateKeyAlias ¶ added in v1.0.7
UpdateKeyAlias update key alias
type KeyImage ¶ added in v0.5.0
type KeyImage struct {
XKeys []*encryptedKeyJSON `json:"xkeys"`
}
KeyImage is the struct for hold export key data
Click to show internal directories.
Click to hide internal directories.