api

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

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 PublicKey

type PublicKey struct {
	Type  string
	Value []byte
	JWK   *jwk.JWK
}

PublicKey contains a result of public key resolution.

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

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

SignatureSuite provides common methods for signature suites.

type Signer

type Signer interface {
	// Sign creates a proof using the given Context on the given json LD document.
	Sign(context *Context, jsonLdDoc []byte, opts ...processor.Opts) ([]byte, error)
}

Signer wraps a set of SignerSuite instances and creates proofs on json LD documents.

type SignerSuite

type SignerSuite interface {
	SignatureSuite

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

	// Alg will return algorithm
	Alg() string
}

SignerSuite encapsulates signature suite methods required for signing documents.

type Verifier

type Verifier interface {
	// Verify verifies a json LD proof on a document.
	Verify(jsonLdDoc []byte, opts ...processor.Opts) error
	// VerifyObject verifies a json LD proof on a document unmarshalled following json.Unmarshal conventions.
	VerifyObject(jsonLdObject map[string]interface{}, opts ...processor.Opts) error
}

Verifier wraps a set of VerifierSuite instances and verifies proofs on json LD documents.

type VerifierSuite

type VerifierSuite interface {
	SignatureSuite

	// Verify will verify signature against public key
	Verify(pubKey *PublicKey, doc []byte, signature []byte) error
}

VerifierSuite encapsulates signature suite methods required for signature verification.

Jump to

Keyboard shortcuts

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