Documentation ¶
Index ¶
- Constants
- Variables
- func EncryptKey(key *Key, auth string, scryptN, scryptP int) ([]byte, error)
- type Key
- type KeyStore
- func (ks *KeyStore) Accounts() ([]string, error)
- func (ks *KeyStore) Delete(a accounts.Account, passphrase string) error
- func (ks *KeyStore) Find(addr accounts.Address) *accounts.Account
- func (ks *KeyStore) HasAddress(addr accounts.Address) bool
- func (ks *KeyStore) NewAccount(passphrase string, accountType uint32) (accounts.Account, error)
- func (ks *KeyStore) SignHashWithPassphrase(a accounts.Account, passphrase string, hash []byte) (signature []byte, err error)
- func (ks *KeyStore) SignTx(a accounts.Account, tx *types.Transaction, pass string) (*types.Transaction, error)
- func (ks *KeyStore) Update(a accounts.Account, passphrase, newPassphrase string) error
Constants ¶
View Source
const ( ScryptN = 2 ScryptP = 1 )
View Source
const ( StandardScryptN = 1 << 18 StandardScryptP = 1 LightScryptN = 1 << 12 LightScryptP = 6 )
Variables ¶
View Source
var ( ErrNoMatch = errors.New("no key for given address or file") ErrDecrypt = errors.New("could not decrypt key with given passphrase") )
View Source
var KeyStoreScheme = "keystore"
Functions ¶
Types ¶
type Key ¶
func DecryptKey ¶
DecryptKey returns the decrypted key via auth
func (*Key) MarshalJSON ¶
Marshal key to json bytes
func (*Key) UnmarshalJSON ¶
UnmarshalJSON restore key from json
type KeyStore ¶
type KeyStore struct {
// contains filtered or unexported fields
}
KeyStore definition
func NewKeyStore ¶
func NewKeyStore(db *db.BlockchainDB, keydir string, scryptN, scryptP int) *KeyStore
NewKeyStore new a KeyStore instance
func NewPlaintextKeyStore ¶
func NewPlaintextKeyStore(db *db.BlockchainDB, keydir string) *KeyStore
NewPlaintextKeyStore new a PlaintextKeyStore instance
func (*KeyStore) HasAddress ¶
HasAddress returns if current node has the specified addr
func (*KeyStore) NewAccount ¶
NewAccount creates a new account
func (*KeyStore) SignHashWithPassphrase ¶
func (ks *KeyStore) SignHashWithPassphrase(a accounts.Account, passphrase string, hash []byte) (signature []byte, err error)
SignHashWithPassphrase signs hash if the private key matching the given address can be decrypted with the given passphrase. The produced signature is in the [R || S || V] format where V is 0 or 1.
Click to show internal directories.
Click to hide internal directories.