Documentation ¶
Index ¶
- Constants
- func FormatCryptoHashAlg(sdAlg crypto.Hash) (string, error)
- func GetCNF(claims map[string]interface{}) (map[string]interface{}, error)
- func GetCryptoHashFromClaims(claims map[string]interface{}) (crypto.Hash, error)
- func GetDisclosedClaims(disclosureClaims []*DisclosureClaim, claims map[string]interface{}) (map[string]interface{}, error)
- func GetDisclosureDigests(claims map[string]interface{}) (map[string]bool, error)
- func GetHash(hash crypto.Hash, value string) (string, error)
- func GetKeyFromVC(key string, claims map[string]interface{}) (interface{}, bool)
- func GetSDAlg(claims map[string]interface{}) (string, error)
- func KeyExistsInMap(key string, m map[string]interface{}) bool
- func ParseCryptoHashAlg(sdAlg string) (crypto.Hash, error)
- func SliceToMap(ids []string) map[string]bool
- func VerifyDisclosuresInSDJWT(disclosures []string, signedJWT *afgjwt.JSONWebToken) error
- func VerifyJWT(signedJWT *afgjwt.JSONWebToken, leeway time.Duration) error
- func VerifySigningAlg(joseHeaders jose.Headers, secureAlgs []string) error
- func VerifyTyp(joseHeaders jose.Headers, expectedTyp string) error
- type CombinedFormatForIssuance
- type CombinedFormatForPresentation
- type DisclosureClaim
- type DisclosureClaimType
- type SDJWTVersion
Constants ¶
const ( CombinedFormatSeparator = "~" SDAlgorithmKey = "_sd_alg" SDKey = "_sd" CNFKey = "cnf" ArrayElementDigestKey = "..." )
CombinedFormatSeparator is disclosure separator.
const ( // SDJWTVersionDefault default SD-JWT version for compatibility purposes. SDJWTVersionDefault = SDJWTVersionV2 // SDJWTVersionV2 SD-JWT v2 spec. SDJWTVersionV2 = SDJWTVersion(2) // SDJWTVersionV5 SD-JWT v5 spec. SDJWTVersionV5 = SDJWTVersion(5) )
const ( // DisclosureClaimTypeUnknown default type for disclosure claim. DisclosureClaimTypeUnknown = DisclosureClaimType(0) // DisclosureClaimTypeArrayElement array element. DisclosureClaimTypeArrayElement = DisclosureClaimType(2) // DisclosureClaimTypeObject object. DisclosureClaimTypeObject = DisclosureClaimType(3) // DisclosureClaimTypePlainText object. DisclosureClaimTypePlainText = DisclosureClaimType(3) )
Variables ¶
This section is empty.
Functions ¶
func FormatCryptoHashAlg ¶ added in v1.1.0
FormatCryptoHashAlg returns algorithm name.
func GetCryptoHashFromClaims ¶
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 ¶
GetDisclosureDigests returns digests from claims map considering either SDKey and array elements that are objects with one key, that key being ... and referring to a string.
func GetKeyFromVC ¶
GetKeyFromVC returns key value from VC.
func KeyExistsInMap ¶
KeyExistsInMap checks if key exists in map.
func ParseCryptoHashAlg ¶ added in v1.1.0
ParseCryptoHashAlg returns crypto hash from SD algorithm.
func VerifyDisclosuresInSDJWT ¶
func VerifyDisclosuresInSDJWT( disclosures []string, signedJWT *afgjwt.JSONWebToken, ) error
VerifyDisclosuresInSDJWT checks for disclosure inclusion in SD-JWT.
func VerifyJWT ¶
func VerifyJWT(signedJWT *afgjwt.JSONWebToken, leeway time.Duration) error
VerifyJWT checks that the JWT is valid using nbf, iat, and exp claims (if provided in the JWT).
func VerifySigningAlg ¶
VerifySigningAlg ensures that a signing algorithm was used that was deemed secure for the application. The none algorithm MUST NOT be accepted.
Types ¶
type CombinedFormatForIssuance ¶
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 // Holder Verification JWT. // For SD JWT V2 field contains Holder Binding JWT data. // For SD JWT V5 field contains Key Binding JWT data. HolderVerification 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 { Digest string Disclosure string Salt string Elements int Type DisclosureClaimType Version SDJWTVersion Name string Value interface{} IsValueParsed bool }
DisclosureClaim defines claim.
func GetDisclosureClaims ¶
func GetDisclosureClaims( disclosures []string, hash crypto.Hash, ) ([]*DisclosureClaim, error)
GetDisclosureClaims de-codes disclosures.
type DisclosureClaimType ¶
type DisclosureClaimType int
DisclosureClaimType disclosure claim type, used for sd-jwt v5+.
type SDJWTVersion ¶
type SDJWTVersion int
SDJWTVersion represents version SD-JWT according to spec version.