Table of Contents

Class ClientMetadata

Namespace
Tessio.Verifier.OpenId4Vp
Assembly
Tessio.Verifier.OpenId4Vp.dll

Builder for the OpenID4VP client_metadata object, producing the JSON string expected by ClientMetadataJson.

public static class ClientMetadata
Inheritance
ClientMetadata
Inherited Members

Remarks

One builder, deliberately. This object used to be assembled independently by the library and by a consuming application, which is invisible to a duplicate detector because the two versions were structurally different while meaning the same thing. They drifted, and the OpenID Foundation conformance suite found the consumer advertising values HAIP rejects long after the library had been fixed. Anything that sends a presentation request should call this rather than hand-rolling the object.

Methods

Build(string, JsonObject?)

Builds client_metadata for a request in the given credential format.

public static string Build(string credentialFormat, JsonObject? responseEncryptionJwk = null)

Parameters

credentialFormat string

dc+sd-jwt or mso_mdoc.

responseEncryptionJwk JsonObject

The public half of the response-encryption key, for direct_post.jwt. Null for direct_post, where there is nothing for the wallet to encrypt to. HAIP requires encrypted responses, so in practice this is supplied.

Returns

string

The client_metadata JSON.

Build(string, JsonObject?, IReadOnlyDictionary<string, JsonNode?>?)

Builds client_metadata as Build(string, JsonObject?) does, adding members a particular wallet asks for beside the standard ones.

public static string Build(string credentialFormat, JsonObject? responseEncryptionJwk, IReadOnlyDictionary<string, JsonNode?>? additionalMembers)

Parameters

credentialFormat string

dc+sd-jwt or mso_mdoc.

responseEncryptionJwk JsonObject

The public half of the response-encryption key, or null.

additionalMembers IReadOnlyDictionary<string, JsonNode>

Members to add, such as a wallet's own relying party metadata. Each value is copied. A member this builder writes itself cannot be replaced from here, so a caller cannot weaken what the standard members advertise.

Returns

string

The client_metadata JSON.

Exceptions

ArgumentException

A name in additionalMembers is one this builder writes.

BuildForFormats(IReadOnlyList<string>, JsonObject?, IReadOnlyDictionary<string, JsonNode?>?)

Builds client_metadata for a request whose DCQL query asks for credentials in several formats, such as one built by AnyOf(params DcqlCredentialQuery[]) offering a PID as an mdoc or as an SD-JWT VC. vp_formats_supported lists every format given, each once.

public static string BuildForFormats(IReadOnlyList<string> credentialFormats, JsonObject? responseEncryptionJwk = null, IReadOnlyDictionary<string, JsonNode?>? additionalMembers = null)

Parameters

credentialFormats IReadOnlyList<string>

The formats the query names, at least one: dc+sd-jwt, mso_mdoc or both.

responseEncryptionJwk JsonObject

The public half of the response-encryption key, or null.

additionalMembers IReadOnlyDictionary<string, JsonNode>

Members to add, as for Build(string, JsonObject?, IReadOnlyDictionary<string, JsonNode?>?).

Returns

string

The client_metadata JSON.

Remarks

SPEC: OpenID4VP 1.0 section 11.1, vp_formats_supported: "An object containing a list of name/value pairs, where the name is a Credential Format Identifier and the value defines format-specific parameters that a Verifier supports." A wallet holding only the format left out would find the request asks for nothing it can answer in. A format other than the two is refused here rather than advertised as SD-JWT VC, as the single format builder does with anything that is not mso_mdoc.

Exceptions

ArgumentException

No format is given, a format is neither of the two, or a name in additionalMembers is one this builder writes.