Documentation ¶
Index ¶
- Variables
- func Decrypt(encryptor string, key Key, attrs Property, reader io.Reader) error
- func DecryptBlock(key Key, message []byte) ([]byte, error)
- func Encrypt(encryptor string, key Key, attrs Property, writer io.Writer) error
- func EncryptBlock(driver string, pubkey []byte, message []byte) ([]byte, error)
- func MnemonicFromKeystore(reader io.Reader, password string) (string, error)
- func MnemonicToKeystore(mnemonic string, password string, writer io.Writer) error
- func PublicKeyToAddress(driver string, pubkey []byte) (string, error)
- func Recover(driver string, sig []byte, hash []byte) ([]byte, error)
- func RegisterEncryptor(name string, f Encryptor)
- func RegisterProvider(provider Provider)
- func ValidAddress(driver string, address string) (bool, error)
- func Verify(driver string, pubkey []byte, sig []byte, hash []byte) (bool, error)
- type BytesEncryptor
- type Encryptor
- type Key
- func From(driver string, key Key) (Key, error)
- func FromMnemonic(driver string, mnemonic string, path string) (Key, error)
- func New(driver string) (Key, error)
- func NewMnemonic(driver string, path string) (string, Key, error)
- func NewMnemonicWithLength(driver string, path string, length int) (string, Key, error)
- type Property
- type Provider
- type RecoverableProvider
- type WithNetID
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrDriver = errors.New("unknown driver") ErrPublicKey = errors.New("invalid public key") ErrCanonicalSign = errors.New("couldn't find a canonical signature") ErrRecoverSign = errors.New("recover error") )
Errors
Functions ¶
func EncryptBlock ¶
EncryptBlock .
func MnemonicFromKeystore ¶
MnemonicFromKeystore .
func MnemonicToKeystore ¶
MnemonicToKeystore .
func PublicKeyToAddress ¶
PublicKeyToAddress .
func RegisterEncryptor ¶
RegisterEncryptor register key encrypto
Types ¶
type BytesEncryptor ¶
type BytesEncryptor interface { EncryptBytes(source []byte, property Property, writer io.Writer) error DecryptBytes(property Property, reader io.Reader) ([]byte, error) }
BytesEncryptor .
type Encryptor ¶
type Encryptor interface { Encrypt(key Key, property Property, writer io.Writer) error Decrypt(key Key, property Property, reader io.Reader) error }
Encryptor .
type Key ¶
type Key interface { Address() string // address display string PriKey() []byte // private key byte array PubKey() []byte // public key byte array SetBytes(priKey []byte) // set private key bytes Sign(hashed []byte) ([]byte, error) // sign the hashed message Provider() Provider // provider }
Key blockchain key facade
func FromMnemonic ¶
FromMnemonic .
type Provider ¶
type Provider interface { Name() string // driver name New() (Key, error) // create new key Verify(pubkey []byte, sig []byte, hash []byte) bool PublicKeyToAddress(pubkey []byte) (string, error) ValidAddress(address string) bool PrivateToPublic(privateKey []byte) []byte Curve() elliptic.Curve }
Provider the key service provider
Click to show internal directories.
Click to hide internal directories.