crypto

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2024 License: LGPL-3.0 Imports: 9 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
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

func NewBIP39Mnemonic() (string, error)

NewBIP39Mnemonic returns a new BIP39-compatible mnemonic

func PublicAddressToByteArray added in v0.2.0

func PublicAddressToByteArray(add common.Address) []byte

PublicAddressToByteArray returns []byte address for given PublicKey Address

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

type SigVerifyFunc func(pubkey, sig, msg []byte) (err error)

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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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