Skip to content

Generate disclosureFrame ad hoc using the metadata during issuance #200

@gsiou

Description

@gsiou

Problem Statement

Right now, supported credential configurations include hard-coded disclosureFrame objects that will be passed in the sd-jwt-js library to properly generate sd claims during credential issuance. Moreover, the disclosureFrame of said configurations uses an older data format not supported anymore by the library. A helper function is utilized to maintain compatibility, but at a loss of the more expressive structure of the new disclosure frame.

Helper function: (wallet-enterprise/src/lib/signer.ts)

		function disclosureFrameConvert(obj: any) {
			const result: any = {};
			const sd = [];

			for (const [key, value] of Object.entries(obj)) {
				if (value === true) {
					sd.push(key);
				} else if (typeof value === 'object' && value !== null) {
					result[key] = disclosureFrameConvert(value);
				}
			}

			if (sd.length > 0) {
				result["_sd"] = sd;
			}

			return result;
		}

Example:
wallet-enterprise/src/credentials/SupportedCredentialsConfiguration/PIDSupportedCredentialSdJwtVCDM_VC.ts

const disclosureFrame = {
			family_name: true,
			birth_family_name: true,
			given_name: true,
			birth_given_name: true,
			personal_administrative_number: true,
			place_of_birth: {
				country: true,
				region: true,
				locality: true
			},
			birthdate: true,
			address: {
				formatted: true,
				country: true,
				region: true,
				locality: true,
				postal_code: true,
				street_address: true,
				house_number: true
			},
			age_equal_or_over: {
				"14": true,
				"18": true,
				"16": true,
				"65": true,
				"21": true,
			},
			age_in_years: true,
			age_birth_year: true,
			issuing_authority: false,
			issuing_country: false,
			issuing_jurisdiction: false,
			document_number: true,
			date_of_issuance: true,
			date_of_expiry: false,
			sex: true,
			nationalities: true,
			email: true,
			phone_number: true,
			picture: true,
			trust_anchor: false
		}

The structure expected by the library is documented here: https://github.com/openwallet-foundation/sd-jwt-js/blob/main/docs/0.x/disclosureframe.md


Proposed Solution (Optional)

The disclosure frame information should be generated dynamically utilizing the metadata of the SDjwt credential configurations. Instead of a hardcoded object, a method must be implemented that will on-the-fly produce the disclosure frame with the latest format required by the sd-jwt-js library. We should make sure that arrays, nesting and other non-trivial types work as intended.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions