signer

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: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

type Context struct {
	SignatureType           string                        // required
	Creator                 string                        // 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
}

Context holds signing options and private key.

type DocumentSigner

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

DocumentSigner implements signing of JSONLD documents.

func New

func New(signatureSuites ...SignatureSuite) *DocumentSigner

New returns new instance of document verifier.

func (*DocumentSigner) Sign

func (signer *DocumentSigner) Sign(
	context *Context,
	jsonLdDoc []byte,
	opts ...processor.Opts,
) ([]byte, error)

Sign will sign JSON LD document.

type SignatureSuite

type SignatureSuite interface {
	// GetCanonicalDocument will return normalized/canonical version of the document
	GetCanonicalDocument(doc map[string]interface{}, opts ...processor.Opts) ([]byte, error)

	// GetDigest returns document digest
	GetDigest(doc []byte) []byte

	// Accept registers this signature suite with the given signature type
	Accept(signatureType string) bool

	// Sign will sign document and return signature
	Sign(doc []byte) ([]byte, error)

	// Alg will return algorithm
	Alg() string

	// CompactProof indicates weather to compact the proof doc before canonization
	CompactProof() bool
}

SignatureSuite encapsulates signature suite methods required for signing documents.

Jump to

Keyboard shortcuts

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