key

package
v1.2.2-beta.2 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package key defines the key specification types used for HTTP signature verification.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IssuerType

type IssuerType string

IssuerType categorises the authority that vouches for a key's identity.

const (
	IssuerSelf   IssuerType = "self" // Public key provided without a third-party identity. See 'hwk' in Signature-Key spec.
	IssuerIDP    IssuerType = "idp"  // Identity Provider domain name. See 'jwt' and 'jwks_uri' in Signature-Key spec.
	IssuerCARoot IssuerType = "ca"   // CA root thumbprint.
)

type KeyFetcher

type KeyFetcher interface {
	// FetchByKeyID looks up a KeySpec from the 'keyid' metadata parameter on
	// the signature.
	FetchByKeyID(ctx context.Context, rh http.Header, keyID string) (KeySpecer, error)
	// Fetch looks up a KeySpec when keyid is not present in the signature.
	Fetch(ctx context.Context, rh http.Header, md types.MetadataProvider) (KeySpecer, error)
}

KeyFetcher resolves a KeySpec for each incoming signature.

type KeyIdentity

type KeyIdentity struct {
	Identity   string
	IssuerType IssuerType
	Issuer     string
}

KeyIdentity carries the verified identity associated with a key.

type KeySpec

type KeySpec struct {
	KeyID    string
	Identity KeyIdentity // Optional. The key may be associated with an identity.
	Algo     types.Algorithm
	PubKey   crypto.PublicKey
	Secret   []byte // Shared secret for symmetric algorithms.
}

KeySpec is the per-key information needed to verify a signature.

func (KeySpec) KeySpec

func (ks KeySpec) KeySpec() (KeySpec, error)

KeySpec implements KeySpecer.

type KeySpecer

type KeySpecer interface {
	KeySpec() (KeySpec, error)
}

KeySpecer should be implemented by your key/credential store.

Jump to

Keyboard shortcuts

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