keystore

package module
v0.0.0-...-54d3599 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2021 License: MIT Imports: 15 Imported by: 1

README

keystore

inwecrypto blockchain wallet key store library implement by go

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrDecrypt = errors.New("could not decrypt key with given passphrase")
)

Errors

Functions

func Encrypt

func Encrypt(key *Key, password string, attrs map[string]interface{}) ([]byte, error)

Encrypt encrypt key as keystore data

func GetEntropyCSPRNG

func GetEntropyCSPRNG(n int) []byte

GetEntropyCSPRNG .

Types

type KdfParams

type KdfParams struct {
	DkLen int    `json:"dklen"` // DK length
	Salt  string `json:"salt"`  // salt string
}

KdfParams .

type Key

type Key struct {
	ID         []byte
	Address    string
	PrivateKey []byte
}

Key keystore handled key object

func Decrypt

func Decrypt(data []byte, password string) (*Key, error)

Decrypt read key from keystore

type Provider

type Provider interface {
	Read(data []byte, password string) (*Key, error)
	Write(key *Key, password string, attrs map[string]interface{}) ([]byte, error)
	KdfTypeName() []string
}

Provider keystore serializer provider

type Web3KeyStore

type Web3KeyStore struct {
}

Web3KeyStore scrypt keystore keystore

func (*Web3KeyStore) KdfTypeName

func (keystore *Web3KeyStore) KdfTypeName() []string

KdfTypeName get the keystore keystore's kdf alogirthm type

func (*Web3KeyStore) Read

func (keystore *Web3KeyStore) Read(data []byte, password string) (*Key, error)

Read .

func (*Web3KeyStore) Write

func (keystore *Web3KeyStore) Write(key *Key, password string, attrs map[string]interface{}) ([]byte, error)

Write .

Jump to

Keyboard shortcuts

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