Documentation ¶
Index ¶
- Variables
- func AppendUint64(t *merlin.Transcript, label []byte, n uint64)
- func NewBIP39Mnemonic() (string, error)
- func PublicAddressToByteArray(add common.Address) []byte
- func PublicKeyToAddress(pub PublicKey) common.Address
- type Erroer
- type KeyType
- type PrivateKey
- type PublicKey
- type SigVerifyFunc
- type SignatureInfo
- type SignatureVerifier
- func (sv *SignatureVerifier) Add(s *SignatureInfo)
- func (sv *SignatureVerifier) Finish() bool
- func (sv *SignatureVerifier) Invalid()
- func (sv *SignatureVerifier) IsInvalid() bool
- func (sv *SignatureVerifier) IsStarted() bool
- func (sv *SignatureVerifier) Remove() *SignatureInfo
- func (sv *SignatureVerifier) Reset()
- func (sv *SignatureVerifier) Start()
Constants ¶
This section is empty.
Variables ¶
var ErrSignatureVerificationFailed = errors.New("failed to verify signature")
Functions ¶
func AppendUint64 ¶ added in v0.3.0
func AppendUint64(t *merlin.Transcript, label []byte, n uint64)
AppendUint64 appends a uint64 to the given transcript using the given label
func NewBIP39Mnemonic ¶ added in v0.3.1
NewBIP39Mnemonic returns a new BIP39-compatible mnemonic
func PublicAddressToByteArray ¶ added in v0.2.0
PublicAddressToByteArray returns []byte address for given PublicKey Address
func PublicKeyToAddress ¶
PublicKeyToAddress returns an ss58 address given a PublicKey see: https://github.com/paritytech/substrate/wiki/External-Address-Format-(SS58) also see: https://github.com/paritytech/substrate/blob/master/primitives/core/src/crypto.rs#L275
Types ¶
type Erroer ¶ added in v0.8.0
type Erroer interface {
Errorf(format string, args ...interface{})
}
Erroer logs formatted messages at the error level.
type KeyType ¶
type KeyType = string
KeyType str
const Ed25519Type KeyType = "ed25519"
Ed25519Type ed25519
const Secp256k1Type KeyType = "secp256k1"
Secp256k1Type secp256k1
const Sr25519Type KeyType = "sr25519"
Sr25519Type sr25519
const UnknownType KeyType = "unknown"
UnknownType is used by the GenericKeystore
type PrivateKey ¶
type PrivateKey interface { Sign(msg []byte) ([]byte, error) Public() (PublicKey, error) Encode() []byte Decode([]byte) error Hex() string }
PrivateKey interface
type PublicKey ¶
type PublicKey interface { Verify(msg, sig []byte) (bool, error) Encode() []byte Decode([]byte) error Address() common.Address Hex() string }
PublicKey interface
type SigVerifyFunc ¶ added in v0.7.0
SigVerifyFunc verifies a signature given a public key and a message
type SignatureInfo ¶ added in v0.7.0
type SignatureInfo struct { PubKey []byte Sign []byte Msg []byte VerifyFunc SigVerifyFunc }
SignatureInfo ...
type SignatureVerifier ¶ added in v0.7.0
type SignatureVerifier struct { sync.RWMutex sync.Once sync.WaitGroup // contains filtered or unexported fields }
SignatureVerifier ...
func NewSignatureVerifier ¶ added in v0.7.0
func NewSignatureVerifier(logger Erroer) *SignatureVerifier
NewSignatureVerifier initialises SignatureVerifier which does background verification of signatures. Start() is called to start the verification process. Finish() is called to stop the verification process. Signatures can be added to the batch using Add().
func (*SignatureVerifier) Add ¶ added in v0.7.0
func (sv *SignatureVerifier) Add(s *SignatureInfo)
Add ...
func (*SignatureVerifier) Finish ¶ added in v0.7.0
func (sv *SignatureVerifier) Finish() bool
Finish waits till batch is finished. Returns true if all the signatures are valid, Otherwise returns false.
func (*SignatureVerifier) Invalid ¶ added in v0.7.0
func (sv *SignatureVerifier) Invalid()
Invalid ...
func (*SignatureVerifier) IsInvalid ¶ added in v0.7.0
func (sv *SignatureVerifier) IsInvalid() bool
IsInvalid ...
func (*SignatureVerifier) IsStarted ¶ added in v0.7.0
func (sv *SignatureVerifier) IsStarted() bool
IsStarted ...
func (*SignatureVerifier) Remove ¶ added in v0.7.0
func (sv *SignatureVerifier) Remove() *SignatureInfo
Remove returns the first signature from the batch. Returns nil if batch is empty.
func (*SignatureVerifier) Reset ¶ added in v0.7.0
func (sv *SignatureVerifier) Reset()
Reset reset the signature verifier for reuse.
func (*SignatureVerifier) Start ¶ added in v0.7.0
func (sv *SignatureVerifier) Start()
Start signature verification in batch.