common

package
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2023 License: Apache-2.0 Imports: 6 Imported by: 5

Documentation

Index

Constants

View Source
const (
	CombinedFormatSeparator = "~"

	SDAlgorithmKey = "_sd_alg"
	SDKey          = "_sd"
	CNFKey         = "cnf"
)

CombinedFormatSeparator is disclosure separator.

Variables

This section is empty.

Functions

func GetCNF

func GetCNF(claims map[string]interface{}) (map[string]interface{}, error)

GetCNF returns confirmation claim 'cnf'.

func GetCryptoHash

func GetCryptoHash(sdAlg string) (crypto.Hash, error)

GetCryptoHash returns crypto hash from SD algorithm.

func GetCryptoHashFromClaims

func GetCryptoHashFromClaims(claims map[string]interface{}) (crypto.Hash, error)

GetCryptoHashFromClaims returns crypto hash from claims.

func GetDisclosedClaims

func GetDisclosedClaims(disclosureClaims []*DisclosureClaim, claims map[string]interface{}) (map[string]interface{}, error)

GetDisclosedClaims returns disclosed claims only.

func GetDisclosureDigests

func GetDisclosureDigests(claims map[string]interface{}) (map[string]bool, error)

GetDisclosureDigests returns digests from claims map.

func GetHash

func GetHash(hash crypto.Hash, value string) (string, error)

GetHash calculates hash of data using hash function identified by hash.

func GetKeyFromVC

func GetKeyFromVC(key string, claims map[string]interface{}) (interface{}, bool)

GetKeyFromVC returns key value from VC.

func GetSDAlg

func GetSDAlg(claims map[string]interface{}) (string, error)

GetSDAlg returns SD algorithm from claims.

func KeyExistsInMap

func KeyExistsInMap(key string, m map[string]interface{}) bool

KeyExistsInMap checks if key exists in map.

func SliceToMap

func SliceToMap(ids []string) map[string]bool

SliceToMap converts slice to map.

func VerifyDisclosuresInSDJWT

func VerifyDisclosuresInSDJWT(disclosures []string, signedJWT *afgjwt.JSONWebToken) error

VerifyDisclosuresInSDJWT checks for disclosure inclusion in SD-JWT.

Types

type CombinedFormatForIssuance

type CombinedFormatForIssuance struct {
	SDJWT       string
	Disclosures []string
}

CombinedFormatForIssuance holds SD-JWT and disclosures.

func ParseCombinedFormatForIssuance

func ParseCombinedFormatForIssuance(combinedFormatForIssuance string) *CombinedFormatForIssuance

ParseCombinedFormatForIssuance parses combined format for issuance into CombinedFormatForIssuance parts.

func (*CombinedFormatForIssuance) Serialize

func (cf *CombinedFormatForIssuance) Serialize() string

Serialize will assemble combined format for issuance.

type CombinedFormatForPresentation

type CombinedFormatForPresentation struct {
	SDJWT         string
	Disclosures   []string
	HolderBinding string
}

CombinedFormatForPresentation holds SD-JWT, disclosures and optional holder binding info.

func ParseCombinedFormatForPresentation

func ParseCombinedFormatForPresentation(combinedFormatForPresentation string) *CombinedFormatForPresentation

ParseCombinedFormatForPresentation parses combined format for presentation into CombinedFormatForPresentation parts.

func (*CombinedFormatForPresentation) Serialize

func (cf *CombinedFormatForPresentation) Serialize() string

Serialize will assemble combined format for presentation.

type DisclosureClaim

type DisclosureClaim struct {
	Disclosure string
	Salt       string
	Name       string
	Value      interface{}
}

DisclosureClaim defines claim.

func GetDisclosureClaims

func GetDisclosureClaims(disclosures []string) ([]*DisclosureClaim, error)

GetDisclosureClaims de-codes disclosures.

Jump to

Keyboard shortcuts

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