ecdsa2019

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: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// SuiteType "ecdsa-2019" is the data integrity Type identifier for the suite
	// implementing ecdsa signatures with RDF canonicalization as per this
	// spec:https://www.w3.org/TR/vc-di-ecdsa/#ecdsa-2019
	SuiteType = "ecdsa-2019"
)

Variables

This section is empty.

Functions

func NewSignerInitializer

func NewSignerInitializer(options *SignerInitializerOptions) suite.SignerInitializer

NewSignerInitializer returns a suite.SignerInitializer that initializes an ecdsa-2019 signing Suite with the given SignerInitializerOptions.

func NewVerifierInitializer

func NewVerifierInitializer(options *VerifierInitializerOptions) suite.VerifierInitializer

NewVerifierInitializer returns a suite.VerifierInitializer that initializes an ecdsa-2019 verification Suite with the given VerifierInitializerOptions.

Types

type KMSSigner

type KMSSigner interface {
	// Sign will sign msg using a matching signature primitive in kh key handle of a private key
	// returns:
	// 		signature in []byte
	//		error in case of errors
	Sign(msg []byte, kh interface{}) ([]byte, error)
}

A KMSSigner is able to sign messages.

type Options

type Options struct {
	LDDocumentLoader ld.DocumentLoader
	P256Verifier     Verifier
	P384Verifier     Verifier
	SignerGetter     SignerGetter
}

Options provides initialization options for Suite.

type Signer

type Signer interface {
	// Sign will sign msg using a private key internal to the Signer.
	// returns:
	// 		signature in []byte
	//		error in case of errors
	Sign(msg []byte) ([]byte, error)
}

A Signer is able to sign messages.

type SignerGetter

type SignerGetter func(pub *jwk.JWK) (Signer, error)

SignerGetter returns a Signer, which must sign with the private key matching the public key provided in models.ProofOptions.VerificationMethod.

func WithLocalKMSSigner

func WithLocalKMSSigner(kms models.KeyManager, kmsSigner KMSSigner) SignerGetter

WithLocalKMSSigner returns a SignerGetter that will sign using the given localkms, using the private key matching the given public key.

func WithStaticSigner

func WithStaticSigner(signer Signer) SignerGetter

WithStaticSigner sets the Suite to use a fixed Signer, with externally-chosen signing key.

Use when a signing Suite is initialized for a single signature, then thrown away.

type SignerInitializerOptions

type SignerInitializerOptions struct {
	LDDocumentLoader ld.DocumentLoader
	SignerGetter     SignerGetter
}

SignerInitializerOptions provides options for a SignerInitializer.

type Suite

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

Suite implements the ecdsa-2019 data integrity cryptographic suite.

func (*Suite) CreateProof

func (s *Suite) CreateProof(doc []byte, opts *models.ProofOptions) (*models.Proof, error)

CreateProof implements the ecdsa-2019 cryptographic suite for Add Proof: https://www.w3.org/TR/vc-di-ecdsa/#add-proof-ecdsa-2019

func (*Suite) RequiresCreated

func (s *Suite) RequiresCreated() bool

RequiresCreated returns false, as the ecdsa-2019 cryptographic suite does not require the use of the models.Proof.Created field.

func (*Suite) VerifyProof

func (s *Suite) VerifyProof(doc []byte, proof *models.Proof, opts *models.ProofOptions) error

VerifyProof implements the ecdsa-2019 cryptographic suite for Verify Proof: https://www.w3.org/TR/vc-di-ecdsa/#verify-proof-ecdsa-2019

type SuiteInitializer

type SuiteInitializer func() (suite.Suite, error)

SuiteInitializer is the initializer for Suite.

func New

func New(options *Options) SuiteInitializer

New constructs an initializer for Suite.

type Verifier

type Verifier interface {
	// Verify will verify a signature for the given msg using a matching signature primitive in kh key handle of
	// a public key
	// returns:
	// 		error in case of errors or nil if signature verification was successful
	Verify(pubKey *signatureverifier.PublicKey, msg, signature []byte) error
}

A Verifier is able to verify messages.

type VerifierInitializerOptions

type VerifierInitializerOptions struct {
	LDDocumentLoader ld.DocumentLoader // required
	P256Verifier     Verifier          // optional
	P384Verifier     Verifier          // optional
}

VerifierInitializerOptions provides options for a VerifierInitializer.

Jump to

Keyboard shortcuts

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