issuer

package
v0.0.0-...-57c6170 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Claims

type Claims jwt.Claims

Claims defines JSON Web Token Claims (https://tools.ietf.org/html/rfc7519#section-4)

type NewOpt

type NewOpt func(opts *newOpts)

NewOpt is the SD-JWT New option.

func WithAudience

func WithAudience(audience string) NewOpt

WithAudience is an option for SD-JWT payload.

func WithDecoyDigests

func WithDecoyDigests(flag bool) NewOpt

WithDecoyDigests is an option for adding decoy digests(default is false).

func WithExpiry

func WithExpiry(expiry *jwt.NumericDate) NewOpt

WithExpiry is an option for SD-JWT payload.

func WithHashAlgorithm

func WithHashAlgorithm(alg crypto.Hash) NewOpt

WithHashAlgorithm is an option for hashing disclosures.

func WithHolderPublicKey

func WithHolderPublicKey(jwk *jwk.JWK) NewOpt

WithHolderPublicKey is an option for SD-JWT payload.

func WithID

func WithID(id string) NewOpt

WithID is an option for SD-JWT payload.

func WithIssuedAt

func WithIssuedAt(issuedAt *jwt.NumericDate) NewOpt

WithIssuedAt is an option for SD-JWT payload.

func WithJSONMarshaller

func WithJSONMarshaller(jsonMarshal func(v interface{}) ([]byte, error)) NewOpt

WithJSONMarshaller is option is for marshalling disclosure.

func WithJTI

func WithJTI(jti string) NewOpt

WithJTI is an option for SD-JWT payload.

func WithNonSelectivelyDisclosableClaims

func WithNonSelectivelyDisclosableClaims(nonSDClaims []string) NewOpt

WithNonSelectivelyDisclosableClaims is an option for provide claim names that should be ignored when creating selectively disclosable claims. For example if you would like to not selectively disclose id and degree type from the following claims: {

"degree": {
   "degree": "MIT",
   "type": "BachelorDegree",
 },
 "name": "Jayden Doe",
 "id": "did:example:ebfeb1f712ebc6f1c276e12ec21",
}

you should specify the following array: []string{"id", "degree.type"}.

func WithNotBefore

func WithNotBefore(notBefore *jwt.NumericDate) NewOpt

WithNotBefore is an option for SD-JWT payload.

func WithSaltFnc

func WithSaltFnc(fnc func() (string, error)) NewOpt

WithSaltFnc is option is for marshalling disclosure.

func WithStructuredClaims

func WithStructuredClaims(flag bool) NewOpt

WithStructuredClaims is an option for handling structured claims(default is false).

func WithSubject

func WithSubject(subject string) NewOpt

WithSubject is an option for SD-JWT payload.

type SelectiveDisclosureJWT

type SelectiveDisclosureJWT struct {
	SignedJWT   *afgjwt.JSONWebToken
	Disclosures []string
}

SelectiveDisclosureJWT defines Selective Disclosure JSON Web Token (https://tools.ietf.org/html/rfc7519)

func New

func New(issuer string, claims interface{}, headers jose.Headers,
	signer jose.Signer, opts ...NewOpt) (*SelectiveDisclosureJWT, error)

New creates new signed Selective Disclosure JWT based on input claims.

func NewFromVC

func NewFromVC(vc map[string]interface{}, headers jose.Headers,
	signer jose.Signer, opts ...NewOpt) (*SelectiveDisclosureJWT, error)

NewFromVC creates new signed Selective Disclosure JWT based on vc.

func (*SelectiveDisclosureJWT) DecodeClaims

func (j *SelectiveDisclosureJWT) DecodeClaims(c interface{}) error

DecodeClaims fills input c with claims of a token.

func (*SelectiveDisclosureJWT) LookupStringHeader

func (j *SelectiveDisclosureJWT) LookupStringHeader(name string) string

LookupStringHeader makes look up of particular header with string value.

func (*SelectiveDisclosureJWT) Serialize

func (j *SelectiveDisclosureJWT) Serialize(detached bool) (string, error)

Serialize makes (compact) serialization of token.

Jump to

Keyboard shortcuts

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