lddocument

package
v1.3.6 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DocumentSigner

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

DocumentSigner implements signing of JSONLD documents.

func NewDocumentSigner

func NewDocumentSigner(signer ProofCreator) *DocumentSigner

NewDocumentSigner returns new instance of document signer.

func (*DocumentSigner) Sign

func (ds *DocumentSigner) Sign(
	context *SigningContext,
	jsonLdObject map[string]interface{},
	opts ...processor.Opts,
) error

Sign will sign JSON LD document.

type DocumentVerifier

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

DocumentVerifier implements JSON LD document proof verification.

func NewDocumentVerifier

func NewDocumentVerifier(proofChecker ProofChecker) *DocumentVerifier

NewDocumentVerifier returns new instance of document wrapped.

func (*DocumentVerifier) Verify

func (dv *DocumentVerifier) Verify(jsonLdDoc []byte, expectedProofIssuer *string, opts ...processor.Opts) error

Verify will verify document proofs.

func (*DocumentVerifier) VerifyObject

func (dv *DocumentVerifier) VerifyObject(jsonLdObject map[string]interface{},
	expectedProofIssuerPtr *string, opts ...processor.Opts) error

VerifyObject will verify document proofs for JSON LD object.

type ProofChecker

type ProofChecker interface {
	// CheckLDProof check ld proof.
	CheckLDProof(proof *proof.Proof, expectedProofIssuer string, msg, signature []byte) error

	// GetLDPCanonicalDocument will return normalized/canonical version of the document.
	GetLDPCanonicalDocument(proof *proof.Proof, doc map[string]interface{}, opts ...processor.Opts) ([]byte, error)

	// GetLDPDigest returns document digest.
	GetLDPDigest(proof *proof.Proof, doc []byte) ([]byte, error)
}

ProofChecker implements JSON LD document proof check.

type ProofCreator

type ProofCreator interface {
	// SignLinkedDocument will sign document and return signature.
	SignLinkedDocument(proof *proof.Proof, keyType kms.KeyType, doc []byte) ([]byte, error)

	// GetLDPCanonicalDocument will return normalized/canonical version of the document
	GetLDPCanonicalDocument(proof *proof.Proof, doc map[string]interface{}, opts ...processor.Opts) ([]byte, error)

	// GetLDPDigest returns document digest
	GetLDPDigest(proof *proof.Proof, doc []byte) ([]byte, error)

	// LDPJWTAlg will return algorithm for jws signature
	LDPJWTAlg(proof *proof.Proof, keyType kms.KeyType) (string, error)
}

ProofCreator encapsulates signature methods required for signing documents.

type SigningContext

type SigningContext struct {
	SignatureType           string                        // required
	Creator                 string                        // required
	KeyType                 kms.KeyType                   // required
	SignatureRepresentation proof.SignatureRepresentation // optional
	Created                 *time.Time                    // optional
	Domain                  string                        // optional
	Nonce                   []byte                        // optional
	VerificationMethod      string                        // optional
	Challenge               string                        // optional
	Purpose                 string                        // optional
	CapabilityChain         []interface{}                 // optional
}

SigningContext holds signing options and private key.

Jump to

Keyboard shortcuts

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