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 KeyType
- type Keypair
- 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 ¶
func AppendUint64(t *merlin.Transcript, label []byte, n uint64)
AppendUint64 appends a uint64 to the given transcript using the given label
func NewBIP39Mnemonic ¶
NewBIP39Mnemonic returns a new BIP39-compatible mnemonic
func PublicAddressToByteArray ¶
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 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 Keypair ¶
type Keypair interface { Type() KeyType Sign(msg []byte) ([]byte, error) Public() PublicKey Private() PrivateKey }
Keypair interface
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 ¶
SigVerifyFunc verifies a signature given a public key and a message
type SignatureInfo ¶
type SignatureInfo struct { PubKey []byte Sign []byte Msg []byte VerifyFunc SigVerifyFunc }
SignatureInfo ...
type SignatureVerifier ¶
type SignatureVerifier struct { sync.RWMutex sync.Once sync.WaitGroup // contains filtered or unexported fields }
SignatureVerifier ...
func NewSignatureVerifier ¶
func NewSignatureVerifier(logger log.LeveledLogger) *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) Finish ¶
func (sv *SignatureVerifier) Finish() bool
Finish waits till batch is finished. Returns true if all the signatures are valid, Otherwise returns false.
func (*SignatureVerifier) Remove ¶
func (sv *SignatureVerifier) Remove() *SignatureInfo
Remove returns the first signature from the batch. Returns nil if batch is empty.
func (*SignatureVerifier) Reset ¶
func (sv *SignatureVerifier) Reset()
Reset reset the signature verifier for reuse.
func (*SignatureVerifier) Start ¶
func (sv *SignatureVerifier) Start()
Start signature verification in batch.