predicates

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2024 License: AGPL-3.0 Imports: 4 Imported by: 2

Documentation

Index

Constants

View Source
const MaxBearerBytes = 65536

Variables

This section is empty.

Functions

func EncodeSignature

func EncodeSignature(sig, pubKey []byte) ([]byte, error)

func ExtractPubKey

func ExtractPubKey(ownerProof []byte) ([]byte, error)

func OwnerProofer

func OwnerProofer(signer Signer, pubKey []byte) func([]byte) ([]byte, error)

OwnerProofer returns function which can be used as OwnerProof generator. "pubKey" must be the public key of the "signer". The generator function takes "bytes to sign" as a parameter and returns serialized owner proof (CBOR encoded Signature struct).

func OwnerProoferForSigner

func OwnerProoferForSigner(signer Signer) func([]byte) ([]byte, error)

OwnerProoferForSigner returns OwnerProof generator for the signer. Prefer OwnerProofer(signer, pubKey) variation when pubKey of the signer is also already available.

func OwnerProoferSecp256K1

func OwnerProoferSecp256K1(privKey, pubKey []byte) func([]byte) ([]byte, error)

OwnerProoferSecp256K1 is like OwnerProofer but takes private / public key pair as a parameter. Keys are assumed to be ECDSA keys for the secp256k1 curve.

func RegisterDefaultRunner

func RegisterDefaultRunner(runner PredicateRunner)

func RunPredicate

func RunPredicate(pb PredicateBytes, sig []byte, sigData []byte) error

Types

type P2pkh256Signature

type P2pkh256Signature struct {
	Sig    []byte
	PubKey []byte
	// contains filtered or unexported fields
}

P2pkh256Signature is a signature and public key pair, typically used as owner proof (ie the public key can be used to verify the signature).

type Predicate

type Predicate struct {
	Tag    uint64
	Code   []byte
	Params []byte
	// contains filtered or unexported fields
}

func ExtractPredicate

func ExtractPredicate(predicateBytes []byte) (*Predicate, error)

type PredicateBytes

type PredicateBytes []byte

type PredicateRunner

type PredicateRunner interface {
	Execute(p *Predicate, sig []byte, sigData []byte) error
}

type Signer

type Signer interface {
	SignBytes([]byte) ([]byte, error)
	Verifier() (crypto.Verifier, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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