zcapld

package
v0.0.0-...-7b7c10a Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2022 License: Apache-2.0 Imports: 10 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewHTTPSigner

func NewHTTPSigner(
	verMethod, capability string, action func(*http.Request) (string, error), secrets httpsignatures.Secrets,
	algorithm httpsignatures.SignatureHashAlgorithm) func(*http.Request) (*http.Header, error)

NewHTTPSigner returns a ZCAP-LD based HTTP signer.

Types

type Crypto

type Crypto interface {
	Sign(msg []byte, kh interface{}) ([]byte, error)
	Verify(sig, msg []byte, kh interface{}) error
}

Crypto primitives.

type DIDResolver

type DIDResolver interface {
	Accept(method string) bool
	Read(did string, options ...vdr.DIDMethodOption) (*did.DocResolution, error)
}

DIDResolver resolves DIDs.

type DIDSecrets

type DIDSecrets struct {
	Secrets map[string]httpsignatures.Secrets
}

DIDSecrets only supports DID URLs as key IDs.

func (*DIDSecrets) Get

func (c *DIDSecrets) Get(didURL string) (httpsignatures.Secret, error)

Get resolves the DID URL into a secret.

type DIDSignatureHashAlgorithms

type DIDSignatureHashAlgorithms struct {
	KMS       KMS
	Crypto    Crypto
	Resolvers []DIDResolver
}

DIDSignatureHashAlgorithms is a composition of several DID methods that can create signatures and verify them.

func (*DIDSignatureHashAlgorithms) Algorithm

func (a *DIDSignatureHashAlgorithms) Algorithm() string

Algorithm returns a custom algorithm identifier for the httpsignatures API.

func (*DIDSignatureHashAlgorithms) Create

func (a *DIDSignatureHashAlgorithms) Create(secret httpsignatures.Secret, data []byte) ([]byte, error)

Create a signature over data with the secret.

func (*DIDSignatureHashAlgorithms) Verify

func (a *DIDSignatureHashAlgorithms) Verify(secret httpsignatures.Secret, data, signature []byte) error

Verify the signature over data using the secret.

type KMS

type KMS interface {
	Get(kid string) (interface{}, error)
	PubKeyBytesToHandle([]byte, kms.KeyType) (interface{}, error)
}

KMS key manager.

Jump to

Keyboard shortcuts

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