signer

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2022 License: Apache-2.0 Imports: 8 Imported by: 10

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 ...jsonld.ProcessorOpts) ([]byte, error)

Sign will sign JSON LD document.

type SignatureSuite added in v0.1.3

type SignatureSuite interface {
	// GetCanonicalDocument will return normalized/canonical version of the document
	GetCanonicalDocument(doc map[string]interface{}, opts ...jsonld.ProcessorOpts) ([]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)

	// 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