Documentation ¶
Overview ¶
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) HasAlias(alias string) bool
- func (h *HSM) HasKey(xprv chainkd.XPrv) bool
- func (h *HSM) ImportXPrvKey(auth string, alias string, xprv chainkd.XPrv) (*XPub, bool, 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) XCreate(alias string, auth string) (*XPub, 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 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 )
Variables ¶
View Source
var ( ErrDuplicateKeyAlias = errors.New("duplicate key alias") ErrDuplicateKey = errors.New("duplicate key") ErrInvalidAfter = errors.New("invalid after") ErrLoadKey = errors.New("key not found or wrong password ") ErrTooManyAliasesToList = errors.New("requested aliases exceeds limit") ErrDecrypt = errors.New("could not decrypt key with given passphrase") )
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) ImportXPrvKey ¶ added in v0.3.0
ImportXPrvKey import XPrv to chainkd
func (*HSM) LoadChainKDKey ¶ added in v0.3.0
LoadChainKDKey get xprv from xpub
func (*HSM) ResetPassword ¶
ResetPassword reset passphrase for an existing xpub
Click to show internal directories.
Click to hide internal directories.