eddsa2022

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2024 License: Apache-2.0 Imports: 15 Imported by: 7

Documentation

Index

Constants

View Source
const (
	// SuiteType "eddsa-rdfc-2022" is the data integrity Type identifier for the suite
	// implementing eddsa signatures with RDF canonicalization as per this
	// spec:https://w3c.github.io/vc-di-eddsa/#verify-proof-eddsa-rdfc-2022
	SuiteType = "eddsa-rdfc-2022"

	// SuiteType2 "eddsa-2022" is the data integrity Type identifier for the suite. Alias (vc playground).
	SuiteType2 = "eddsa-2022"
)

Variables

This section is empty.

Functions

func NewSignerInitializer

func NewSignerInitializer(options *SignerInitializerOptions) suite.SignerInitializer

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

func NewVerifierInitializer

func NewVerifierInitializer(options *VerifierInitializerOptions) suite.VerifierInitializer

NewVerifierInitializer returns a suite.VerifierInitializer that initializes an eddsa-2022 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
	ED25519Verifier  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 WithKMSCryptoWrapper

func WithKMSCryptoWrapper(kmsCrypto wrapperapi.KMSCryptoSigner) SignerGetter

WithKMSCryptoWrapper provides a SignerGetter using the kmscrypto wrapper.

This SignerGetter assumes that the public key JWKs provided were received from the same kmscrypto.KMSCrypto implementation.

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 eddsa-2022 data integrity cryptographic suite.

func (*Suite) CreateProof

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

CreateProof implements the eddsa-2022 cryptographic suite for Add Proof.

func (*Suite) RequiresCreated

func (s *Suite) RequiresCreated() bool

RequiresCreated returns false, as the eddsa-2022 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 eddsa-2022 cryptographic suite for CheckJWTProof Proof.

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(signature, msg []byte, pubKey *pubkey.PublicKey) error
}

A Verifier is able to verify messages.

type VerifierInitializerOptions

type VerifierInitializerOptions struct {
	LDDocumentLoader ld.DocumentLoader // required
	Ed25519Verifier  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