signature

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2025 License: Apache-2.0 Imports: 11 Imported by: 1

Documentation

Index

Constants

View Source
const BlsHashPrefix = "BLS"

BlsHashPrefix is the prefix used to verify a BLS scheme signature.

Variables

View Source
var (
	// ErrSignatureMismatch is returned when a verifier detect a wrong signature.
	ErrSignatureMismatch = errors.New("signature mismatch")
	// AllSchemes all the supported scheme.
	AllSchemes = []Scheme{
		NoScheme, Ecdsa, Bls, Eddsa,
	}
	// AllRealSchemes all supported real scheme (excluding NoScheme).
	AllRealSchemes = []Scheme{
		Ecdsa, Bls, Eddsa,
	}
)

Functions

func DigestTxNamespace

func DigestTxNamespace(tx *protoblocktx.Tx, nsIndex int) ([]byte, error)

DigestTxNamespace digests a transactions for a given namespace index.

Types

type BLSVerifier

type BLSVerifier struct {
	// contains filtered or unexported fields
}

BLSVerifier verifies using the BLS scheme.

func NewBLSVerifier

func NewBLSVerifier(key []byte) (*BLSVerifier, error)

NewBLSVerifier instantiate a new BLS scheme verifier.

func (*BLSVerifier) Verify

func (v *BLSVerifier) Verify(digest Digest, signature Signature) error

Verify a digest given a signature.

type BlindWrite

type BlindWrite struct {
	Key   []byte
	Value []byte
}

BlindWrite is a stab for protoblocktx.Write.

type Digest

type Digest = []byte

Digest of a message.

type DigestVerifier

type DigestVerifier interface {
	Verify(Digest, Signature) error
}

DigestVerifier verifies a digest.

type DummyVerifier

type DummyVerifier struct{}

DummyVerifier always return success.

func (*DummyVerifier) Verify

func (*DummyVerifier) Verify(Digest, Signature) error

Verify a digest given a signature.

type EcdsaTxVerifier

type EcdsaTxVerifier struct {
	// contains filtered or unexported fields
}

EcdsaTxVerifier verifies using the ECDSA scheme.

func NewEcdsaVerifier

func NewEcdsaVerifier(key []byte) (*EcdsaTxVerifier, error)

NewEcdsaVerifier instantiate a new ECDSA scheme verifier.

func (*EcdsaTxVerifier) Verify

func (v *EcdsaTxVerifier) Verify(digest Digest, signature Signature) error

Verify a digest given a signature.

type EdDSAVerifier

type EdDSAVerifier struct {
	PublicKey ed25519.PublicKey
}

EdDSAVerifier verifies using the EdDSA scheme.

func (*EdDSAVerifier) Verify

func (v *EdDSAVerifier) Verify(digest Digest, signature Signature) error

Verify a digest given a signature.

type Namespace

type Namespace struct {
	Reads      []Read
	ReadWrites []ReadWrite
	Writes     []BlindWrite
}

Namespace is a stab for protoblocktx.TxNamespace.

type NsVerifier

type NsVerifier struct {
	DigestVerifier
}

NsVerifier verifies a given namespace.

func NewNsVerifier

func NewNsVerifier(scheme Scheme, key []byte) (*NsVerifier, error)

NewNsVerifier creates a new namespace verifier according to the implementation scheme.

func (*NsVerifier) VerifyNs

func (v *NsVerifier) VerifyNs(tx *protoblocktx.Tx, nsIndex int) error

VerifyNs verifies a transaction's namespace signature.

type PrivateKey

type PrivateKey = []byte

PrivateKey to be used.

type PublicKey

type PublicKey = []byte

PublicKey to be used.

type Read

type Read struct {
	Key     []byte
	Version []byte
}

Read is a stab for protoblocktx.Read.

type ReadWrite

type ReadWrite struct {
	Key     []byte
	Version []byte
	Value   []byte
}

ReadWrite is a stab for protoblocktx.ReadWrite.

type Scheme

type Scheme = string

Scheme to be used.

const (
	// NoScheme does nothing.
	NoScheme Scheme = "NONE"
	// Ecdsa use the ECDSA scheme.
	Ecdsa Scheme = "ECDSA"
	// Bls use the BLS scheme.
	Bls Scheme = "BLS"
	// Eddsa use the EDDSA scheme.
	Eddsa Scheme = "EDDSA"
)

Supported schemes.

type Signature

type Signature = []byte

Signature of a message.

type Tx

type Tx struct {
	TxID      string
	Namespace Namespace
}

Tx is a stab for protoblocktx.Tx.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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