commit 7064da4fe89208329717eac1ed3b2b7e6c697a9f
parent 01af64b78a68601b14cf592beea57a298c411904
Author: Marcos Cáceres <caceres_m@apple.com>
Date: Thu, 11 Dec 2025 09:28:46 +0000
Bug 2003209 [wpt PR 56352] - Digital Credentials: implement CANONICAL_REQUEST_OBJECTS with actual mDoc data, a=testonly
Automatic update from web-platform-tests
Digital Credentials: implement CANONICAL_REQUEST_OBJECTS with actual mDoc data (#56352)
* Digital Credentials: implement CANONICAL_REQUEST_OBJECTS with actual mDoc data
- Add CANONICAL_REQUEST_OBJECTS with real mDoc deviceRequest and encryptionInfo data
- Update factory functions to use canonical objects as defaults with data spread
- Refactor internal architecture with new buildRequests and makeOptionsInternal helpers
- Make mediation optional in type definitions (no longer defaults to 'required')
- Add comprehensive data parameter support to config interfaces
- Complete property bag + signal + protocol selection + canonical objects integration
* Digital Credentials: Simplify helper function architecture and add requests parameter
- Add requests parameter to MakeGetOptionsConfig and MakeCreateOptionsConfig interfaces
- Replace complex makeOptionsUnified/makeOptionsInternal system with simpler makeCredentialOptionsFromConfig
- Convert buildRequestsFromProtocols to functional programming approach using .map()
- Remove factory functions (makeOID4VPDict, makeMDocRequest) in favor of inline functions in allMappings
- Make mediation optional in CredentialRequestOptions and CredentialCreationOptions
- Enhance TypeScript annotations with generics for better type safety
- Support empty protocol arrays (protocol: []) for testing scenarios
- Clean up unused imports and improve documentation alignment
* Add data parameter to config interfaces and update tests to use clean data override pattern
- Add data parameter to MakeGetOptionsConfig and MakeCreateOptionsConfig for overriding canonical data
- Wire explicitData parameter through buildRequestsFromProtocols call chain properly
- Update tests to use clean makeGetOptions({data}) pattern instead of manual object construction
- Replace post-construction data manipulation with clean data override during construction
- Maintain separation of concerns: protocol selection automatic, data override optional
--
wpt-commits: db7e90790db81992a56885aafd9163f48566d241
wpt-pr: 56352
Diffstat:
7 files changed, 191 insertions(+), 191 deletions(-)
diff --git a/testing/web-platform/tests/digital-credentials/allow-attribute-with-create.https.html b/testing/web-platform/tests/digital-credentials/allow-attribute-with-create.https.html
@@ -10,7 +10,9 @@
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-vendor.js"></script>
- <script>
+ <script type="module">
+ import { makeCreateOptions } from "./support/helper.js";
+
const hostInfo = get_host_info();
const iframeDetails = [
{
@@ -100,14 +102,13 @@
for (const details of iframeDetails) {
promise_test(async (test) => {
const iframe = await loadIframe(details);
+ test.add_cleanup(() => {
+ document.body.removeChild(iframe);
+ });
const { expectIsAllowed } = details;
const action = "create";
- const options = {
- digital: {
- // Results in TypeError when allowed, NotAllowedError when disallowed
- requests: [],
- },
- };
+ // Results in TypeError when allowed, NotAllowedError when disallowed
+ const options = makeCreateOptions({ protocol: [] });
const { data } = await new Promise((resolve) => {
const callback = (e) => {
if (e.source === iframe.contentWindow) {
@@ -131,11 +132,11 @@
} else {
assert_equals(name, "NotAllowedError", fullMessage);
}
- iframe.remove();
}, `With Create: Policy to use: ${details.policy}, is cross-origin: ${details.crossOrigin}, is allowed by policy: ${details.expectIsAllowed}`);
}
}
+ window.onload = runTests;
</script>
</head>
- <body onload="runTests()"></body>
+ <body></body>
</html>
diff --git a/testing/web-platform/tests/digital-credentials/allow-attribute-with-get.https.html b/testing/web-platform/tests/digital-credentials/allow-attribute-with-get.https.html
@@ -10,7 +10,9 @@
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-vendor.js"></script>
- <script>
+ <script type="module">
+ import { makeGetOptions } from "./support/helper.js";
+
const hostInfo = get_host_info();
const iframeDetails = [
{
@@ -90,6 +92,8 @@
: location.origin
).href;
iframe.dataset.expectIsAllowed = expectIsAllowed;
+ iframe.width = "400";
+ iframe.height = "200";
document.body.appendChild(iframe);
});
iframe.focus();
@@ -100,15 +104,12 @@
for (const details of iframeDetails) {
promise_test(async (test) => {
const iframe = await loadIframe(details);
+ test.add_cleanup(() => {
+ document.body.removeChild(iframe);
+ });
const { expectIsAllowed } = details;
const action = "get";
- const options = {
- digital: {
- // Results in TypeError when allowed (since the requests list is empty),
- // NotAllowedError when disallowed
- requests: [],
- },
- };
+ const options = makeGetOptions({ protocol: [] });
await test_driver.bless("User activation");
const { data } = await new Promise((resolve) => {
const callback = (e) => {
@@ -133,11 +134,12 @@
// When the call is disallowed, it MUST result in a NotAllowedError.
assert_equals(name, "NotAllowedError", fullMessage);
}
- iframe.remove();
+
}, `With Get: Policy to use: ${details.policy}, is cross-origin: ${details.crossOrigin}, is allowed by policy: ${details.expectIsAllowed}`);
}
}
+ window.onload = runTests;
</script>
</head>
- <body onload="runTests()"></body>
+ <body></body>
</html>
diff --git a/testing/web-platform/tests/digital-credentials/create.tentative.https.html b/testing/web-platform/tests/digital-credentials/create.tentative.https.html
@@ -8,8 +8,8 @@
<script src="/resources/testdriver-vendor.js"></script>
<body>
- <iframe id="same-origin"></iframe>
<iframe id="cross-origin" allow="digital-credentials-create"></iframe>
+ <iframe id="same-origin"></iframe>
</body>
<script type="module">
@@ -236,8 +236,7 @@
];
for (const badValue of throwingValues) {
- const options = makeCreateOptions();
- options.digital.requests[0].data = badValue;
+ const options = makeCreateOptions({ data: badValue });
await promise_rejects_js(
t,
diff --git a/testing/web-platform/tests/digital-credentials/dc-types.ts b/testing/web-platform/tests/digital-credentials/dc-types.ts
@@ -33,10 +33,21 @@ export interface MobileDocumentRequest {
*/
export interface MakeGetOptionsConfig {
/**
- * Protocol(s) to use for the request
+ * Protocol(s) to use for the request.
+ * Can be a single protocol, array of protocols, or empty array.
+ * If not provided, uses the default supported protocol.
*/
protocol?: GetProtocol | GetProtocol[];
/**
+ * Explicit credential requests.
+ * When provided, these are used in addition to any protocol-based requests.
+ */
+ requests?: DigitalCredentialGetRequest[];
+ /**
+ * Optional data to override canonical data for protocol-based requests.
+ */
+ data?: MobileDocumentRequest | object;
+ /**
* Credential mediation requirement
*/
mediation?: CredentialMediationRequirement;
@@ -51,10 +62,21 @@ export interface MakeGetOptionsConfig {
*/
export interface MakeCreateOptionsConfig {
/**
- * Protocol(s) to use for the request
+ * Protocol(s) to use for the request.
+ * Can be a single protocol, array of protocols, or empty array.
+ * If not provided, uses the default supported protocol.
*/
protocol?: CreateProtocol | CreateProtocol[];
/**
+ * Explicit credential requests.
+ * When provided, these are used in addition to any protocol-based requests.
+ */
+ requests?: DigitalCredentialCreateRequest[];
+ /**
+ * Optional data to override canonical data for protocol-based requests.
+ */
+ data?: object;
+ /**
* Credential mediation requirement
*/
mediation?: CredentialMediationRequirement;
@@ -87,7 +109,7 @@ export interface DigitalCredentialRequestOptions {
*/
export interface CredentialRequestOptions {
digital: DigitalCredentialRequestOptions;
- mediation: CredentialMediationRequirement;
+ mediation?: CredentialMediationRequirement;
signal?: AbortSignal;
}
@@ -114,7 +136,7 @@ export interface DigitalCredentialCreationOptions {
*/
export interface CredentialCreationOptions {
digital: DigitalCredentialCreationOptions;
- mediation: CredentialMediationRequirement;
+ mediation?: CredentialMediationRequirement;
signal?: AbortSignal;
}
diff --git a/testing/web-platform/tests/digital-credentials/get.tentative.https.html b/testing/web-platform/tests/digital-credentials/get.tentative.https.html
@@ -8,8 +8,8 @@
<script src="/resources/testdriver-vendor.js"></script>
<body>
- <iframe id="same-origin"></iframe>
<iframe id="cross-origin" allow="digital-credentials-get"></iframe>
+ <iframe id="same-origin"></iframe>
</body>
<script type="module">
import { makeGetOptions, sendMessage, loadIframe } from "./support/helper.js";
@@ -31,16 +31,8 @@
promise_test(async (t) => {
const invalidData = [null, undefined, "", 123, true, false];
for (const data of invalidData) {
- const options = {
- digital: {
- requests: [
- {
- data,
- protocol: "openid4vp-v1-unsigned",
- },
- ],
- },
- };
+ const options = makeGetOptions({ data });
+ await test_driver.bless("user activation");
await promise_rejects_js(
t,
TypeError,
@@ -253,8 +245,7 @@ promise_test(async t => {
];
for (const badValue of throwingValues) {
- const options = makeGetOptions();
- options.digital.requests[0].data = badValue;
+ const options = makeGetOptions({ data: badValue });
await promise_rejects_js(
t,
diff --git a/testing/web-platform/tests/digital-credentials/non-fully-active.https.html b/testing/web-platform/tests/digital-credentials/non-fully-active.https.html
@@ -71,7 +71,7 @@
let iframe = await createIframe();
const DOMExceptionCtor = iframe.contentWindow.DOMException;
let stolenNavigator = iframe.contentWindow.navigator;
- const request = makeGetOptions({ protocol: "openid4vp-v1-unsigned" });
+ const request = makeGetOptions();
await test_driver.bless("User activation", null, iframe.contentWindow);
await iframe.focus();
const p = promise_rejects_dom(
diff --git a/testing/web-platform/tests/digital-credentials/support/helper.js b/testing/web-platform/tests/digital-credentials/support/helper.js
@@ -3,17 +3,16 @@
/**
* @typedef {import('../dc-types').GetProtocol} GetProtocol
* @typedef {import('../dc-types').DigitalCredentialGetRequest} DigitalCredentialGetRequest
- * @typedef {import('../dc-types').DigitalCredentialRequestOptions} DigitalCredentialRequestOptions
* @typedef {import('../dc-types').CredentialRequestOptions} CredentialRequestOptions
* @typedef {import('../dc-types').CreateProtocol} CreateProtocol
* @typedef {import('../dc-types').DigitalCredentialCreateRequest} DigitalCredentialCreateRequest
* @typedef {import('../dc-types').CredentialCreationOptions} CredentialCreationOptions
- * @typedef {import('../dc-types').DigitalCredentialCreationOptions} DigitalCredentialCreationOptions
* @typedef {import('../dc-types').SendMessageData} SendMessageData
* @typedef {import('../dc-types').MakeGetOptionsConfig} MakeGetOptionsConfig
* @typedef {import('../dc-types').MakeCreateOptionsConfig} MakeCreateOptionsConfig
* @typedef {import('../dc-types').CredentialMediationRequirement} CredentialMediationRequirement
* @typedef {import('../dc-types').MobileDocumentRequest} MobileDocumentRequest
+ * @typedef {GetProtocol | CreateProtocol} Protocol
*/
/** @type {GetProtocol[]} */
@@ -27,107 +26,145 @@ const GET_PROTOCOLS = /** @type {const} */ ([
/** @type {CreateProtocol[]} */
const CREATE_PROTOCOLS = /** @type {const} */ (["openid4vci"]);
-const SUPPORTED_GET_PROTOCOL = GET_PROTOCOLS.find(
- (protocol) => DigitalCredential.userAgentAllowsProtocol(protocol)
+const SUPPORTED_GET_PROTOCOL = GET_PROTOCOLS.find((protocol) =>
+ DigitalCredential.userAgentAllowsProtocol(protocol)
);
-const SUPPORTED_CREATE_PROTOCOL = CREATE_PROTOCOLS.find(
- (protocol) => DigitalCredential.userAgentAllowsProtocol(protocol)
+const SUPPORTED_CREATE_PROTOCOL = CREATE_PROTOCOLS.find((protocol) =>
+ DigitalCredential.userAgentAllowsProtocol(protocol)
);
+/** @type {Record<Protocol, object | MobileDocumentRequest>} */
+const CANONICAL_REQUEST_OBJECTS = {
+ openid4vci: {
+ /* Canonical object coming soon */
+ },
+ "openid4vp-v1-unsigned": {
+ /* Canonical object coming soon */
+ },
+ "openid4vp-v1-signed": {
+ /* Canonical object coming soon */
+ },
+ "openid4vp-v1-multisigned": {
+ /* Canonical object coming soon */
+ },
+ /** @type MobileDocumentRequest **/
+ "org-iso-mdoc": {
+ deviceRequest:
+ "omd2ZXJzaW9uYzEuMGtkb2NSZXF1ZXN0c4GhbGl0ZW1zUmVxdWVzdNgYWIKiZ2RvY1R5cGV1b3JnLmlzby4xODAxMy41LjEubURMam5hbWVTcGFjZXOhcW9yZy5pc28uMTgwMTMuNS4x9pWthZ2Vfb3Zlcl8yMfRqZ2l2ZW5fbmFtZfRrZmFtaWx5X25hbWX0cmRyaXZpbmdfcHJpdmlsZWdlc_RocG9ydHJhaXT0",
+ encryptionInfo:
+ "gmVkY2FwaaJlbm9uY2VYICBetSsDkKlE_G9JSIHwPzr3ctt6Ol9GgmCH8iGdGQNJcnJlY2lwaWVudFB1YmxpY0tleaQBAiABIVggKKm1iPeuOb9bDJeeJEL4QldYlWvY7F_K8eZkmYdS9PwiWCCm9PLEmosiE_ildsE11lqq4kDkjhfQUKPpbX-Hm1ZSLg",
+ },
+};
+
/**
- * Internal helper to build the request array from validated input.
- * Assumes requestsInputArray is a non-empty array of strings.
- * @private
- * @param {string[]} requestsInputArray - An array of request type strings.
- * @param {CredentialMediationRequirement} mediation - The mediation requirement.
- * @param {Record<string, () => any>} requestMapping - The specific mapping object for the operation type.
- * @param {AbortSignal} [signal] - Optional abort signal.
- * @returns {{ digital: { requests: any[] }, mediation: CredentialMediationRequirement, signal?: AbortSignal }} - The final options structure.
- * @throws {Error} If an unknown request type string is encountered within the array.
+ * Internal helper to create final options from a list of requests.
+ *
+ * @template {DigitalCredentialGetRequest[] | DigitalCredentialCreateRequest[]} TRequests
+ * @template {CredentialRequestOptions | CredentialCreationOptions} TOptions
+ * @param {TRequests} requests
+ * @param {CredentialMediationRequirement} [mediation]
+ * @param {AbortSignal} [signal]
+ * @returns {TOptions}
*/
-function _makeOptionsInternal(requestsInputArray, mediation, requestMapping, signal) {
- const requests = [];
- for (const request of requestsInputArray) {
- const factoryFunction = requestMapping[request];
- if (factoryFunction) {
- requests.push(factoryFunction()); // Call the mapped function
- } else {
- // This error means a string *within the array* was unknown
- throw new Error(`Unknown request type within array: ${request}`);
- }
+function makeOptionsFromRequests(requests, mediation, signal) {
+ /** @type {TOptions} */
+ const options = /** @type {TOptions} */ ({ digital: { requests } });
+
+ if (mediation) {
+ options.mediation = mediation;
}
- /** @type {{ digital: { requests: any[] }, mediation: CredentialMediationRequirement, signal?: AbortSignal }} */
- const result = { digital: { requests }, mediation };
- if (signal !== undefined) {
- result.signal = signal;
+
+ if (signal) {
+ options.signal = signal;
}
- return result;
+
+ return options;
+}
+
+/**
+ * Build requests from protocols, using canonical data for each protocol.
+ * For create operations with explicit data, uses that data for all protocols.
+ *
+ * @template Req
+ * @param {Protocol[]} protocols
+ * @param {Record<string, (data?: MobileDocumentRequest | object) => Req>} mapping
+ * @param {MobileDocumentRequest | object} [explicitData] - Explicit data for create operations
+ * @returns {Req[]}
+ * @throws {Error} If an unknown protocol string is encountered.
+ */
+function buildRequestsFromProtocols(protocols, mapping, explicitData) {
+ return protocols.map((protocol) => {
+ if (!(protocol in mapping)) {
+ throw new Error(`Unknown request type within array: ${protocol}`);
+ }
+ // Use explicit data if provided (for create with data), otherwise canonical data
+ return mapping[protocol](explicitData);
+ });
}
+/** @type {{
+ * get: Record<GetProtocol, (data?: MobileDocumentRequest | object) => DigitalCredentialGetRequest>;
+ * create: Record<CreateProtocol, (data?: object) => DigitalCredentialCreateRequest>;
+ * }} */
const allMappings = {
get: {
- "org-iso-mdoc": () => makeMDocRequest(),
- "openid4vp-v1-unsigned": () => makeOID4VPDict("openid4vp-v1-unsigned"),
- "openid4vp-v1-signed": () => makeOID4VPDict("openid4vp-v1-signed"),
- "openid4vp-v1-multisigned": () => makeOID4VPDict("openid4vp-v1-multisigned"),
+ "org-iso-mdoc": (
+ data = { ...CANONICAL_REQUEST_OBJECTS["org-iso-mdoc"] },
+ ) => {
+ return { protocol: "org-iso-mdoc", data };
+ },
+ "openid4vp-v1-unsigned": (
+ data = { ...CANONICAL_REQUEST_OBJECTS["openid4vp-v1-unsigned"] },
+ ) => {
+ return { protocol: "openid4vp-v1-unsigned", data };
+ },
+ "openid4vp-v1-signed": (
+ data = { ...CANONICAL_REQUEST_OBJECTS["openid4vp-v1-signed"] },
+ ) => {
+ return { protocol: "openid4vp-v1-signed", data };
+ },
+ "openid4vp-v1-multisigned": (
+ data = { ...CANONICAL_REQUEST_OBJECTS["openid4vp-v1-multisigned"] },
+ ) => {
+ return { protocol: "openid4vp-v1-multisigned", data };
+ },
},
create: {
- "openid4vci": () => makeOID4VCIDict(),
+ "openid4vci": (data = { ...CANONICAL_REQUEST_OBJECTS["openid4vci"] }) => {
+ return { protocol: "openid4vci", data };
+ },
},
};
/**
- * Internal unified function to handle option creation logic.
- * Routes calls from specific public functions.
- * @private
- * @param {'get' | 'create'} type - The type of operation.
- * @param {string | string[]} protocol - Protocol(s) to use.
- * @param {CredentialMediationRequirement} mediation - Mediation requirement.
- * @param {AbortSignal} [signal] - Optional abort signal.
- * @returns {{ digital: { requests: any[] }, mediation: CredentialMediationRequirement, signal?: AbortSignal }}
- * @throws {Error} If type is invalid internally, or input strings are invalid.
+ * Generic helper to create credential options from config with protocol already set.
+ * @template {MakeGetOptionsConfig | MakeCreateOptionsConfig} TConfig
+ * @template {DigitalCredentialGetRequest | DigitalCredentialCreateRequest} TRequest
+ * @template {CredentialRequestOptions | CredentialCreationOptions} TOptions
+ * @param {TConfig} config - Configuration options with protocol already defaulted
+ * @param {Record<string, (data?: MobileDocumentRequest | object) => TRequest>} mapping - Protocol to request mapping
+ * @returns {TOptions}
*/
-function _makeOptionsUnified(type, protocol, mediation, signal) {
- // 1. Get mapping (Type validation primarily happens via caller)
- const mapping = allMappings[type];
- // Added safety check, though public functions should prevent this.
- if (!mapping) {
- throw new Error(`Internal error: Invalid options type specified: ${type}`);
- }
+function makeCredentialOptionsFromConfig(config, mapping) {
+ const { protocol, requests = [], data, mediation = "required", signal } = config;
- // 2. Handle single string input
- if (typeof protocol === 'string') {
- if (protocol in mapping) {
- // Valid single string: Pass as array to the core array helper
- return _makeOptionsInternal([protocol], mediation, mapping, signal);
- } else {
- // Invalid single string for this type
- throw new Error(`Unknown request type string '${protocol}' provided for operation type '${type}'`);
- }
+ // Validate that we have either a protocol or requests
+ if (!protocol && !requests?.length) {
+ throw new Error("No protocol. Can't make options.");
}
- // 3. Handle array input
- if (Array.isArray(protocol)) {
- if (protocol.length === 0) {
- // Handle empty array explicitly
- /** @type {{ digital: { requests: any[] }, mediation: CredentialMediationRequirement, signal?: AbortSignal }} */
- const result = { digital: { requests: [] }, mediation };
- if (signal !== undefined) {
- result.signal = signal;
- }
- return result;
- }
- // Pass valid non-empty array to the core array helper
- return _makeOptionsInternal(protocol, mediation, mapping, signal);
- }
+ /** @type {TRequest[]} */
+ const allRequests = [];
+
+ allRequests.push(.../** @type {TRequest[]} */ (requests));
- // 4. Handle invalid input types (neither string nor array)
- /** @type {{ digital: { requests: any[] }, mediation: CredentialMediationRequirement, signal?: AbortSignal }} */
- const result = { digital: { requests: [] }, mediation };
- if (signal !== undefined) {
- result.signal = signal;
+ if (protocol) {
+ const protocolArray = Array.isArray(protocol) ? protocol : [protocol];
+ const protocolRequests = buildRequestsFromProtocols(protocolArray, mapping, data);
+ allRequests.push(...protocolRequests);
}
- return result;
+
+ return /** @type {TOptions} */ (makeOptionsFromRequests(allRequests, mediation, signal));
}
/**
@@ -137,11 +174,14 @@ function _makeOptionsUnified(type, protocol, mediation, signal) {
* @returns {CredentialRequestOptions}
*/
export function makeGetOptions(config = {}) {
- const { protocol = SUPPORTED_GET_PROTOCOL, mediation = "required", signal } = config;
- if (!protocol) {
- throw new Error("No Protocol. Can't make get options.");
- }
- return _makeOptionsUnified('get', protocol, mediation, signal);
+ const configWithDefaults = {
+ protocol: SUPPORTED_GET_PROTOCOL,
+ ...config,
+ };
+
+ return /** @type {CredentialRequestOptions} */ (
+ makeCredentialOptionsFromConfig(configWithDefaults, allMappings.get)
+ );
}
/**
@@ -151,71 +191,14 @@ export function makeGetOptions(config = {}) {
* @returns {CredentialCreationOptions}
*/
export function makeCreateOptions(config = {}) {
- const { protocol = SUPPORTED_CREATE_PROTOCOL, mediation = "required", signal } = config;
- if (!protocol) {
- throw new Error("No protocol. Can't make create options.");
- }
- return _makeOptionsUnified('create', protocol, mediation, signal);
-}
-
-/**
- *
- * @param {string} protocol
- * @param {object} data
- * @returns {DigitalCredentialGetRequest}
- */
-function makeDigitalCredentialGetRequest(protocol = "protocol", data = {}) {
- return {
- protocol,
- data,
- };
-}
-
-/**
- * Representation of an OpenID4VP request.
- *
- * @param {string} identifier
- * @returns {DigitalCredentialGetRequest}
- **/
-function makeOID4VPDict(identifier = "openid4vp-v1-unsigned") {
- return makeDigitalCredentialGetRequest(identifier, {
- // Canonical example of an OpenID4VP request coming soon.
- });
-}
-
-/**
- *
- * @param {string} protocol
- * @param {object} data
- * @returns {DigitalCredentialCreateRequest}
- */
-function makeDigitalCredentialCreateRequest(protocol = "protocol", data = {}) {
- return {
- protocol,
- data,
+ const configWithDefaults = {
+ protocol: SUPPORTED_CREATE_PROTOCOL,
+ ...config,
};
-}
-
-/**
- * Representation of an OpenID4VCI request.
- *
- * @returns {DigitalCredentialCreateRequest}
- **/
-function makeOID4VCIDict() {
- return makeDigitalCredentialCreateRequest("openid4vci", {
- // Canonical example of an OpenID4VCI request coming soon.
- });
-}
-/**
- * Representation of an mDoc request.
- *
- * @returns {DigitalCredentialGetRequest}
- **/
-function makeMDocRequest() {
- return makeDigitalCredentialGetRequest("org-iso-mdoc", {
- // Canonical example of an mDoc request coming soon.
- });
+ return /** @type {CredentialCreationOptions} */ (
+ makeCredentialOptionsFromConfig(configWithDefaults, allMappings.create)
+ );
}
/**
@@ -230,8 +213,8 @@ export function sendMessage(iframe, data) {
if (!iframe.contentWindow) {
reject(
new Error(
- "iframe.contentWindow is undefined, cannot send message (something is wrong with the test that called this)."
- )
+ "iframe.contentWindow is undefined, cannot send message (something is wrong with the test that called this).",
+ ),
);
return;
}
@@ -255,7 +238,9 @@ export function sendMessage(iframe, data) {
export function loadIframe(iframe, url) {
return new Promise((resolve, reject) => {
iframe.addEventListener("load", () => resolve(), { once: true });
- iframe.addEventListener("error", (event) => reject(event.error), { once: true });
+ iframe.addEventListener("error", (event) => reject(event.error), {
+ once: true,
+ });
if (!iframe.isConnected) {
document.body.appendChild(iframe);
}