suite

package
v0.0.0-...-64dd8ac Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2024 License: Apache-2.0 Imports: 3 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrSignerNotDefined = errors.New("signer is not defined")

ErrSignerNotDefined is returned when Sign() is called but signer option is not defined.

View Source
var ErrVerifierNotDefined = errors.New("verifier is not defined")

ErrVerifierNotDefined is returned when Verify() is called but verifier option is not defined.

Functions

This section is empty.

Types

type CryptoSigner

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

CryptoSigner defines signer based on crypto.

func NewCryptoSigner

func NewCryptoSigner(cr crypto.Crypto, kh interface{}) *CryptoSigner

NewCryptoSigner creates a new CryptoSigner.

func (*CryptoSigner) Alg

func (s *CryptoSigner) Alg() string

Alg return alg.

func (*CryptoSigner) Sign

func (s *CryptoSigner) Sign(msg []byte) ([]byte, error)

Sign will sign document and return signature.

type CryptoVerifier

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

CryptoVerifier defines signature verifier based on crypto.

func NewCryptoVerifier

func NewCryptoVerifier(cr crypto.Crypto) *CryptoVerifier

NewCryptoVerifier creates a new CryptoVerifier.

func (*CryptoVerifier) Verify

func (v *CryptoVerifier) Verify(kh *api.PublicKey, msg, signature []byte) error

Verify will verify a signature.

type Opt

type Opt func(opts *SignatureSuite)

Opt is the SignatureSuite option.

func WithCompactProof

func WithCompactProof() Opt

WithCompactProof indicates that proof compaction is needed, by default it is not done.

func WithSigner

func WithSigner(s signer) Opt

WithSigner defines a signer for the Signature Suite.

func WithVerifier

func WithVerifier(v verifier) Opt

WithVerifier defines a verifier for the Signature Suite.

type SignatureSuite

type SignatureSuite struct {
	Signer         signer
	Verifier       verifier
	CompactedProof bool
}

SignatureSuite defines general signature suite structure.

func InitSuiteOptions

func InitSuiteOptions(suite *SignatureSuite, opts ...Opt) *SignatureSuite

InitSuiteOptions initializes signature suite with options.

func (*SignatureSuite) Alg

func (s *SignatureSuite) Alg() string

Alg will return algorithm.

func (*SignatureSuite) CompactProof

func (s *SignatureSuite) CompactProof() bool

CompactProof indicates weather to compact the proof doc before canonization.

func (*SignatureSuite) Sign

func (s *SignatureSuite) Sign(data []byte) ([]byte, error)

Sign will sign input data.

func (*SignatureSuite) Verify

func (s *SignatureSuite) Verify(pubKeyValue *api.PublicKey, doc, signature []byte) error

Verify will verify a signature.

Directories

Path Synopsis
Package ecdsasecp256k1signature2019 implements the EcdsaSecp256k1Signature2019 signature suite for the Linked Data Signatures specification (https://w3c-dvcg.github.io/lds-ecdsa-secp256k1-2019/).
Package ecdsasecp256k1signature2019 implements the EcdsaSecp256k1Signature2019 signature suite for the Linked Data Signatures specification (https://w3c-dvcg.github.io/lds-ecdsa-secp256k1-2019/).
Package ed25519signature2018 implements the Ed25519Signature2018 signature suite for the Linked Data Signatures [LD-SIGNATURES] specification.
Package ed25519signature2018 implements the Ed25519Signature2018 signature suite for the Linked Data Signatures [LD-SIGNATURES] specification.
Package ed25519signature2020 implements the Ed25519Signature2020 signature suite for the Linked Data Signatures [LD-SIGNATURES] specification.
Package ed25519signature2020 implements the Ed25519Signature2020 signature suite for the Linked Data Signatures [LD-SIGNATURES] specification.
Package jsonwebsignature2020 implements the JsonWebSignature2020 signature suite for the Linked Data Signatures specification (https://github.com/transmute-industries/lds-jws2020).
Package jsonwebsignature2020 implements the JsonWebSignature2020 signature suite for the Linked Data Signatures specification (https://github.com/transmute-industries/lds-jws2020).

Jump to

Keyboard shortcuts

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