Documentation ¶
Index ¶
- Constants
- Variables
- func EncryptKey(key *Key, auth string, scryptN, scryptP int) ([]byte, error)
- func ZeroKey(k *ecdsa.PrivateKey)
- type Key
- type PassphraseKeyStore
- func (ks *PassphraseKeyStore) GetKey(addr common.Address, filename string, passphrase string) (*Key, error)
- func (ks *PassphraseKeyStore) GetPath(addr common.Address) string
- func (ks *PassphraseKeyStore) ImportKey(key *Key, passphrase string) (string, error)
- func (ks *PassphraseKeyStore) JoinPath(filename string) string
- func (p *PassphraseKeyStore) ScryptN() int
- func (p *PassphraseKeyStore) ScryptP() int
- func (ks *PassphraseKeyStore) StoreKey(filename string, key *Key, passphrase string) error
- type PlainKeyJSON
- type PlaintextKeyStore
- func (ks *PlaintextKeyStore) GetKey(addr common.Address, filename string, passphrase string) (*Key, error)
- func (ks *PlaintextKeyStore) GetPath(addr common.Address) string
- func (ks *PlaintextKeyStore) ImportKey(key *Key, passphrase string) (string, error)
- func (ks *PlaintextKeyStore) JoinPath(filename string) string
- func (ks *PlaintextKeyStore) StoreKey(filename string, key *Key, passphrase string) error
Constants ¶
View Source
const ( // StandardScryptN is the N parameter of Scrypt encryption algorithm, using 256MB // memory and taking approximately 1s CPU time on a modern processor. StandardScryptN = 1 << 18 // StandardScryptP is the P parameter of Scrypt encryption algorithm, using 256MB // memory and taking approximately 1s CPU time on a modern processor. StandardScryptP = 1 // LightScryptN is the N parameter of Scrypt encryption algorithm, using 4MB // memory and taking approximately 100ms CPU time on a modern processor. LightScryptN = 1 << 12 // LightScryptP is the P parameter of Scrypt encryption algorithm, using 4MB // memory and taking approximately 100ms CPU time on a modern processor. LightScryptP = 6 )
Variables ¶
View Source
var (
ErrDecrypt = errors.New("could not decrypt key with given passphrase")
)
Functions ¶
func EncryptKey ¶
EncryptKey encrypts a key using the specified scrypt parameters into a json blob that can be decrypted later on.
Types ¶
type Key ¶
type Key struct { Id uuid.UUID // Version 4 "random" for unique id not derived from key data Address common.Address // we only store privkey as pubkey/address can be derived from it // privkey in this struct is always in plaintext PrivateKey *ecdsa.PrivateKey // for validator, also store the bls key in case of enable bls signature BlsKey []byte }
func DecryptKey ¶
DecryptKey decrypts a key from a json blob, returning the private key itself.
type PassphraseKeyStore ¶
type PassphraseKeyStore struct {
// contains filtered or unexported fields
}
func NewPassphraseKeyStore ¶
func NewPassphraseKeyStore(keydir string, scryptN, scryptP int) (*PassphraseKeyStore, error)
func (*PassphraseKeyStore) GetPath ¶
func (ks *PassphraseKeyStore) GetPath(addr common.Address) string
func (*PassphraseKeyStore) ImportKey ¶
func (ks *PassphraseKeyStore) ImportKey(key *Key, passphrase string) (string, error)
func (*PassphraseKeyStore) JoinPath ¶
func (ks *PassphraseKeyStore) JoinPath(filename string) string
func (*PassphraseKeyStore) ScryptN ¶
func (p *PassphraseKeyStore) ScryptN() int
func (*PassphraseKeyStore) ScryptP ¶
func (p *PassphraseKeyStore) ScryptP() int
type PlainKeyJSON ¶
type PlaintextKeyStore ¶
type PlaintextKeyStore struct {
// contains filtered or unexported fields
}
func NewPlaintextKeyStore ¶
func NewPlaintextKeyStore(keydir string, scryptN, scryptP int) (*PlaintextKeyStore, error)
func (*PlaintextKeyStore) GetPath ¶
func (ks *PlaintextKeyStore) GetPath(addr common.Address) string
func (*PlaintextKeyStore) ImportKey ¶
func (ks *PlaintextKeyStore) ImportKey(key *Key, passphrase string) (string, error)
func (*PlaintextKeyStore) JoinPath ¶
func (ks *PlaintextKeyStore) JoinPath(filename string) string
Click to show internal directories.
Click to hide internal directories.