Documentation ¶
Index ¶
- func Curve(key Key) elliptic.Curve
- func Decode(encodingName string, property Property, reader io.Reader) ([]byte, error)
- func Decrypt(providerName string, privkey []byte, block []byte) ([]byte, error)
- func Encode(encodingName string, privKey []byte, property Property, writer io.Writer) error
- func Encrypt(providerName string, pubkey []byte, block []byte) ([]byte, error)
- func PriKeyToPubKey(providerName string, prikey []byte) []byte
- func PubKeyToAddress(providerName string, pubkey []byte) string
- func RandomMnemonic(length int) (string, error)
- func Recover(providerName string, sig []byte, hash []byte) ([]byte, error)
- func RegisterEncoding(encoding Encoding)
- func RegisterProvider(provider Provider)
- func Sign(providerName string, prikey []byte, hashed []byte) ([]byte, error)
- func SignWithKey(key Key, hashed []byte) ([]byte, error)
- func ValidAddress(providerName string, address string) bool
- func Verify(providerName string, pubkey []byte, sig []byte, hash []byte) bool
- type AddressProvider
- type EllipticProvider
- type Encoding
- type EncryptProvider
- type Key
- type Property
- type Provider
- type RecoverableProvider
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PriKeyToPubKey ¶
PriKeyToPubKey .
func PubKeyToAddress ¶
PubKeyToAddress .
func RandomMnemonic ¶
RandomMnemonic generate random mnemonic with provide length
func SignWithKey ¶ added in v0.0.5
SignWithKey .
Types ¶
type AddressProvider ¶
type AddressProvider interface { PublicKeyToAddress(pubkey []byte) string PrivateToPublic(privateKey []byte) []byte ValidAddress(address string) bool }
AddressProvider .
type EllipticProvider ¶
EllipticProvider .
type Encoding ¶
type Encoding interface { Name() string Encode(privKey []byte, property Property, writer io.Writer) error Decode(property Property, reader io.Reader) ([]byte, error) }
Encoding the key format encoding facade
type EncryptProvider ¶
type EncryptProvider interface { Encrypt(pubkey []byte, block []byte) ([]byte, error) Decrypt(privkey []byte, block []byte) ([]byte, error) }
EncryptProvider .
type Key ¶
type Key interface { Address() string // address display string PriKey() []byte // private key byte array PubKey() []byte // public key byte array Provider() Provider // provider }
Key blockchain signature alogirthm facade
func FromPriKey ¶
FromPriKey create key with provider name
type Provider ¶
type Provider interface { Name() string // provider unique name RandomKey() (Key, error) // create new random key FromPriKey(priKey []byte) (Key, error) // create key facade with private key bytes Verify(pubkey []byte, sig []byte, hash []byte) bool // verify signature Sign(prikey []byte, hashed []byte) ([]byte, error) // sign the hashed message }
Provider blockchain signature alogrithm provider
Click to show internal directories.
Click to hide internal directories.