@mattrglobal/verifier-sdk-web 2.0.0-preview-digital-credential-api.3 → 2.0.0-preview-digital-credential-api.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +43 -35
- package/dist/lib/verifier-js-no-deps.cjs.js +23 -12
- package/dist/lib/verifier-js-no-deps.cjs.js.map +1 -1
- package/dist/lib/verifier-js.cjs.js +121 -121
- package/dist/lib/verifier-js.cjs.js.map +1 -1
- package/dist/typings/verifier/types/credential-presentation.d.ts +46 -35
- package/dist/typings/verifier/types/verifier-web-sdk.d.ts +2 -0
- package/dist/typings/verifier/utils.d.ts +6 -6
- package/dist/verifier-js.development.js +112 -112
- package/dist/verifier-js.development.js.map +1 -1
- package/dist/verifier-js.production.esm.js +3 -3
- package/dist/verifier-js.production.esm.js.map +1 -1
- package/dist/verifier-js.production.js +3 -3
- package/dist/verifier-js.production.js.map +1 -1
- package/package.json +3 -3
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
import * as v from "valibot";
|
|
2
|
-
/*** mobile-credential-framework https://github.com/mattrinternal/opencore/tree/master/packages/mobile-credential-framework/src/types ***/
|
|
3
2
|
export declare enum MobileCredentialVerificationReasonType {
|
|
3
|
+
/** Credential has expired */
|
|
4
4
|
Expired = "expired",
|
|
5
|
-
|
|
5
|
+
/** Credential is not yet active */
|
|
6
|
+
Inactive = "inactive",
|
|
7
|
+
/** Credential has been revoked permanently and a new credential must be issued */
|
|
8
|
+
StatusRevoked = "invalid",
|
|
9
|
+
/** Credential has been suspended and must be re-activated before use */
|
|
10
|
+
StatusSuspended = "suspended",
|
|
11
|
+
/** The Credentials status could not be resolved or verified */
|
|
12
|
+
StatusUnknown = "unknown"
|
|
6
13
|
}
|
|
7
14
|
export declare enum ClaimType {
|
|
8
15
|
Boolean = "boolean",
|
|
@@ -28,43 +35,53 @@ export type MobileCredentialError = {
|
|
|
28
35
|
readonly docType: string;
|
|
29
36
|
readonly errorCode: MobileCredentialResponseErrorCode;
|
|
30
37
|
};
|
|
31
|
-
/*** mobile-credential-framework end ***/
|
|
32
|
-
/*** credential-presentation https://github.com/mattrinternal/platform/tree/master/libraries/platform-api-types/src/api-types/credential-presentation ***/
|
|
33
38
|
export declare enum OpenidPresentationCredentialProfileSupported {
|
|
34
39
|
MOBILE = "mobile"
|
|
35
40
|
}
|
|
36
41
|
export type CredentialQueryClaim = {
|
|
42
|
+
/**
|
|
43
|
+
* `intentToRetain` (Optional): When set to `true`, the holder will be indicated that the verifier intends to retain this claim beyond the verification workflow. Defaults to `false` when not specified.
|
|
44
|
+
*/
|
|
37
45
|
intentToRetain?: boolean;
|
|
38
46
|
};
|
|
39
47
|
/**
|
|
40
48
|
* Credential query
|
|
41
49
|
* @example
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
* "
|
|
45
|
-
* "
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
|
|
50
|
-
*
|
|
51
|
-
*
|
|
50
|
+
* // The following example credential query will request the `birthdate` and `portrait` claims from a `mobile` credential `profile` with `org.iso.18013.5.1.mDL` as a `docType`:
|
|
51
|
+
* {
|
|
52
|
+
* "profile": "mobile",
|
|
53
|
+
* "docType": "org.iso.18013.5.1.mDL",
|
|
54
|
+
* "nameSpaces": {
|
|
55
|
+
* "org.iso.18013.5.1": {
|
|
56
|
+
* "birthdate": {
|
|
57
|
+
"intentToRetain": false
|
|
58
|
+
* },
|
|
59
|
+
* "portrait": {
|
|
60
|
+
* "intentToRetain": false
|
|
52
61
|
* },
|
|
53
|
-
* "resident_postal_code":{
|
|
54
|
-
* "intentToRetain":
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
* "intentToRetain":true
|
|
60
|
-
* }
|
|
61
|
-
* }
|
|
62
|
-
* }
|
|
63
|
-
* }
|
|
62
|
+
* "resident_postal_code": {
|
|
63
|
+
* "intentToRetain": false
|
|
64
|
+
* }
|
|
65
|
+
* },
|
|
66
|
+
* }
|
|
67
|
+
* }
|
|
64
68
|
*/
|
|
65
69
|
export type CredentialQuery = {
|
|
70
|
+
/**
|
|
71
|
+
* Credential format of the credential that will be verified. Currently only mobile (mDocs) is supported.
|
|
72
|
+
*/
|
|
66
73
|
profile: OpenidPresentationCredentialProfileSupported;
|
|
74
|
+
/**
|
|
75
|
+
* the mDL’s type. Confirm with the certificate issuer for what docType they are issuing. Some common examples include:
|
|
76
|
+
* * Mobile Driver Licence (`org.iso.18013.5.1.mDL`).
|
|
77
|
+
* * PhotoID (`org.iso.23220.photoid.1`).
|
|
78
|
+
* * Mobile Vehicle Registration Card (`org.iso.7367.1.mVRC`).
|
|
79
|
+
* * Health certificate (`org.micov.vtr.1`).
|
|
80
|
+
*/
|
|
67
81
|
docType: string;
|
|
82
|
+
/**
|
|
83
|
+
* Each namespace corresponds to a group of claims included in the credential. These can be claims that are part of a specific standard, jurisdiction or any other reference. The namespace would usually correspond to the requested `docType`.
|
|
84
|
+
*/
|
|
68
85
|
nameSpaces: {
|
|
69
86
|
[nameSpace: string]: {
|
|
70
87
|
[claim: string]: CredentialQueryClaim;
|
|
@@ -104,8 +121,6 @@ export declare enum PresentationErrorType {
|
|
|
104
121
|
*/
|
|
105
122
|
Unknown = "Unknown"
|
|
106
123
|
}
|
|
107
|
-
/*** credential-presentation end ***/
|
|
108
|
-
/*** mobile-credential https://github.com/mattrinternal/platform/tree/master/libraries/platform-api-types/src/api-types/mobile-credential ***/
|
|
109
124
|
export type ValidityInfoRequest = {
|
|
110
125
|
signed: string;
|
|
111
126
|
validFrom: string;
|
|
@@ -169,17 +184,15 @@ export type Claim = {
|
|
|
169
184
|
export type MobileCredentialPresentationCredential = {
|
|
170
185
|
docType: string;
|
|
171
186
|
validityInfo: ValidityInfoRequest;
|
|
172
|
-
branding?: CredentialBranding;
|
|
173
|
-
claims?: Record<string, Record<string, Claim>>;
|
|
174
|
-
claimErrors?: Record<string, Record<string, MobileCredentialResponseErrorCode>>;
|
|
175
|
-
verificationResult: MobileCredentialVerificationResult;
|
|
176
187
|
issuerInfo: {
|
|
177
188
|
commonName: string;
|
|
178
189
|
trustedIssuerId: string;
|
|
179
190
|
};
|
|
191
|
+
verificationResult: MobileCredentialVerificationResult;
|
|
192
|
+
branding?: CredentialBranding;
|
|
193
|
+
claims?: Record<string, Record<string, Claim>>;
|
|
194
|
+
claimErrors?: Record<string, Record<string, MobileCredentialResponseErrorCode>>;
|
|
180
195
|
};
|
|
181
|
-
/*** mobile-credential end ***/
|
|
182
|
-
/*** session result https://github.com/mattrinternal/platform/tree/master/libraries/platform-api-types/src/api-types/credential-presentation/sessionResult.ts ***/
|
|
183
196
|
/**
|
|
184
197
|
* The result of a credential presentation request, default response or set `resultAvailableInFrontChannel: true` as verifier's configuration
|
|
185
198
|
*/
|
|
@@ -231,8 +244,6 @@ export type ExchangeSessionResultRequest = {
|
|
|
231
244
|
readonly responseCode: string;
|
|
232
245
|
};
|
|
233
246
|
export type ExchangeSessionResultResponse = PresentationSessionResult | PresentationHiddenResult;
|
|
234
|
-
/*** session result end ***/
|
|
235
|
-
/*** session https://github.com/mattrinternal/platform/tree/master/libraries/platform-api-types/src/api-types/credential-presentation/session.ts ***/
|
|
236
247
|
export type CreateSessionRequest = v.InferOutput<typeof CreateSessionRequestValidator>;
|
|
237
248
|
export declare const CreateSessionRequestValidator: v.ObjectSchema<{
|
|
238
249
|
readonly credentialQuery: v.ArraySchema<v.ObjectSchema<{
|
|
@@ -308,12 +308,14 @@ export type HandleRedirectCallbackResponse = {
|
|
|
308
308
|
*/
|
|
309
309
|
export type InitialiseOptions = {
|
|
310
310
|
apiBaseUrl: string;
|
|
311
|
+
applicationId?: string;
|
|
311
312
|
digitalCredentialsApiProtocol?: string;
|
|
312
313
|
enableDigitalCredentialsApiSameDeviceFlow?: boolean;
|
|
313
314
|
enableDigitalCredentialsApiCrossDeviceFlow?: boolean;
|
|
314
315
|
};
|
|
315
316
|
export declare const InitialiseOptionsValidator: v.ObjectSchema<{
|
|
316
317
|
readonly apiBaseUrl: v.StringSchema<undefined>;
|
|
318
|
+
readonly applicationId: v.OptionalSchema<v.StringSchema<undefined>, never>;
|
|
317
319
|
readonly enableDigitalCredentialsApiSameDeviceFlow: v.OptionalSchema<v.BooleanSchema<undefined>, never>;
|
|
318
320
|
readonly enableDigitalCredentialsApiCrossDeviceFlow: v.OptionalSchema<v.BooleanSchema<undefined>, never>;
|
|
319
321
|
}, undefined>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Result } from "neverthrow";
|
|
2
2
|
import { SafeFetchValidateRespondError } from "../common/safeFetch";
|
|
3
|
-
import { CreateSessionRequest, CreateSessionResponse, ExchangeSessionResultResponse, CreateDigitalCredentialsApiSessionResponse } from "./types";
|
|
3
|
+
import { CreateSessionRequest, CreateSessionResponse, ExchangeSessionResultResponse, InitialiseOptions, CreateDigitalCredentialsApiSessionResponse } from "./types";
|
|
4
4
|
/**
|
|
5
5
|
* Generates a challenge string using the window.crypto API.
|
|
6
6
|
*
|
|
@@ -22,12 +22,11 @@ export declare const getHashParamValue: (hash: string, param: string) => string
|
|
|
22
22
|
* @param challenge - The challenge for the session.
|
|
23
23
|
* @param redirectUri - The redirect URI for the session.
|
|
24
24
|
* @param apiBaseUrl - The base URL of the API.
|
|
25
|
-
* @param
|
|
25
|
+
* @param applicationId - optional, The ID of the verifier application, if not provided the default application ID will be used.
|
|
26
|
+
* @param walletProviderId - optional, The ID of the wallet provider, if not provided the default wallet provider will be used.
|
|
26
27
|
* @returns A promise that resolves to a result containing either the created session response or an error.
|
|
27
28
|
*/
|
|
28
|
-
export declare const createSession: ({ credentialQuery, challenge, redirectUri, apiBaseUrl, walletProviderId, }: CreateSessionRequest &
|
|
29
|
-
apiBaseUrl: string;
|
|
30
|
-
}) => Promise<Result<CreateSessionResponse, SafeFetchValidateRespondError>>;
|
|
29
|
+
export declare const createSession: ({ credentialQuery, challenge, redirectUri, apiBaseUrl, applicationId, walletProviderId, }: CreateSessionRequest & InitialiseOptions) => Promise<Result<CreateSessionResponse, SafeFetchValidateRespondError>>;
|
|
31
30
|
/**
|
|
32
31
|
* Exchange the result of a session using the provided parameters.
|
|
33
32
|
*
|
|
@@ -77,9 +76,10 @@ export declare const createDigitalCredentialsApiSession: ({ credentialQuery, cha
|
|
|
77
76
|
* @param apiBaseUrl - The base URL of the API.
|
|
78
77
|
* @returns A promise that resolves to a result containing either the session result response or an error.
|
|
79
78
|
*/
|
|
80
|
-
export declare const getDigitalCredentialsApiSessionResult: ({ challenge, sessionId, response, apiBaseUrl, }: {
|
|
79
|
+
export declare const getDigitalCredentialsApiSessionResult: ({ challenge, sessionId, response, apiBaseUrl, protocol, }: {
|
|
81
80
|
challenge: string;
|
|
82
81
|
sessionId: string;
|
|
83
82
|
response: any;
|
|
84
83
|
apiBaseUrl: string;
|
|
84
|
+
protocol: string;
|
|
85
85
|
}) => Promise<Result<any, SafeFetchValidateRespondError>>;
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
* Do Not Translate or Localize
|
|
8
8
|
*
|
|
9
9
|
* Bundle of @mattrglobal/verifier-sdk-web
|
|
10
|
-
* Generated: 2025-
|
|
11
|
-
* Version: 2.0.0-preview-digital-credential-api.
|
|
10
|
+
* Generated: 2025-03-25
|
|
11
|
+
* Version: 2.0.0-preview-digital-credential-api.4
|
|
12
12
|
* Dependencies:
|
|
13
13
|
*
|
|
14
14
|
* neverthrow -- 4.3.0
|
|
@@ -426,6 +426,73 @@
|
|
|
426
426
|
};
|
|
427
427
|
ResultAsync.fromPromise;
|
|
428
428
|
ResultAsync.fromSafePromise;
|
|
429
|
+
function _arrayLikeToArray(r, a) {
|
|
430
|
+
(null == a || a > r.length) && (a = r.length);
|
|
431
|
+
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
432
|
+
return n;
|
|
433
|
+
}
|
|
434
|
+
function _arrayWithoutHoles(r) {
|
|
435
|
+
if (Array.isArray(r)) return _arrayLikeToArray(r);
|
|
436
|
+
}
|
|
437
|
+
function _createForOfIteratorHelper(r, e) {
|
|
438
|
+
var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
439
|
+
if (!t) {
|
|
440
|
+
if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) {
|
|
441
|
+
t && (r = t);
|
|
442
|
+
var n = 0, F = function() {};
|
|
443
|
+
return {
|
|
444
|
+
s: F,
|
|
445
|
+
n: function() {
|
|
446
|
+
return n >= r.length ? {
|
|
447
|
+
done: !0
|
|
448
|
+
} : {
|
|
449
|
+
done: !1,
|
|
450
|
+
value: r[n++]
|
|
451
|
+
};
|
|
452
|
+
},
|
|
453
|
+
e: function(r) {
|
|
454
|
+
throw r;
|
|
455
|
+
},
|
|
456
|
+
f: F
|
|
457
|
+
};
|
|
458
|
+
}
|
|
459
|
+
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
460
|
+
}
|
|
461
|
+
var o, a = !0, u = !1;
|
|
462
|
+
return {
|
|
463
|
+
s: function() {
|
|
464
|
+
t = t.call(r);
|
|
465
|
+
},
|
|
466
|
+
n: function() {
|
|
467
|
+
var r = t.next();
|
|
468
|
+
return a = r.done, r;
|
|
469
|
+
},
|
|
470
|
+
e: function(r) {
|
|
471
|
+
u = !0, o = r;
|
|
472
|
+
},
|
|
473
|
+
f: function() {
|
|
474
|
+
try {
|
|
475
|
+
a || null == t.return || t.return();
|
|
476
|
+
} finally {
|
|
477
|
+
if (u) throw o;
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
};
|
|
481
|
+
}
|
|
482
|
+
function _defineProperty(e, r, t) {
|
|
483
|
+
return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
484
|
+
value: t,
|
|
485
|
+
enumerable: !0,
|
|
486
|
+
configurable: !0,
|
|
487
|
+
writable: !0
|
|
488
|
+
}) : e[r] = t, e;
|
|
489
|
+
}
|
|
490
|
+
function _iterableToArray(r) {
|
|
491
|
+
if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
|
|
492
|
+
}
|
|
493
|
+
function _nonIterableSpread() {
|
|
494
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
495
|
+
}
|
|
429
496
|
function ownKeys(e, r) {
|
|
430
497
|
var t = Object.keys(e);
|
|
431
498
|
if (Object.getOwnPropertySymbols) {
|
|
@@ -447,6 +514,23 @@
|
|
|
447
514
|
}
|
|
448
515
|
return e;
|
|
449
516
|
}
|
|
517
|
+
function _toConsumableArray(r) {
|
|
518
|
+
return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread();
|
|
519
|
+
}
|
|
520
|
+
function _toPrimitive(t, r) {
|
|
521
|
+
if ("object" != typeof t || !t) return t;
|
|
522
|
+
var e = t[Symbol.toPrimitive];
|
|
523
|
+
if (void 0 !== e) {
|
|
524
|
+
var i = e.call(t, r || "default");
|
|
525
|
+
if ("object" != typeof i) return i;
|
|
526
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
527
|
+
}
|
|
528
|
+
return ("string" === r ? String : Number)(t);
|
|
529
|
+
}
|
|
530
|
+
function _toPropertyKey(t) {
|
|
531
|
+
var i = _toPrimitive(t, "string");
|
|
532
|
+
return "symbol" == typeof i ? i : i + "";
|
|
533
|
+
}
|
|
450
534
|
function _typeof(o) {
|
|
451
535
|
"@babel/helpers - typeof";
|
|
452
536
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
@@ -455,107 +539,12 @@
|
|
|
455
539
|
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
456
540
|
}, _typeof(o);
|
|
457
541
|
}
|
|
458
|
-
function
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
enumerable: true,
|
|
464
|
-
configurable: true,
|
|
465
|
-
writable: true
|
|
466
|
-
});
|
|
467
|
-
} else {
|
|
468
|
-
obj[key] = value;
|
|
542
|
+
function _unsupportedIterableToArray(r, a) {
|
|
543
|
+
if (r) {
|
|
544
|
+
if ("string" == typeof r) return _arrayLikeToArray(r, a);
|
|
545
|
+
var t = {}.toString.call(r).slice(8, -1);
|
|
546
|
+
return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
|
|
469
547
|
}
|
|
470
|
-
return obj;
|
|
471
|
-
}
|
|
472
|
-
function _toConsumableArray(arr) {
|
|
473
|
-
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
|
474
|
-
}
|
|
475
|
-
function _arrayWithoutHoles(arr) {
|
|
476
|
-
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
|
|
477
|
-
}
|
|
478
|
-
function _iterableToArray(iter) {
|
|
479
|
-
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
480
|
-
}
|
|
481
|
-
function _unsupportedIterableToArray(o, minLen) {
|
|
482
|
-
if (!o) return;
|
|
483
|
-
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
484
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
485
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
486
|
-
if (n === "Map" || n === "Set") return Array.from(o);
|
|
487
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
488
|
-
}
|
|
489
|
-
function _arrayLikeToArray(arr, len) {
|
|
490
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
491
|
-
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
492
|
-
return arr2;
|
|
493
|
-
}
|
|
494
|
-
function _nonIterableSpread() {
|
|
495
|
-
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
496
|
-
}
|
|
497
|
-
function _createForOfIteratorHelper(o, allowArrayLike) {
|
|
498
|
-
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
|
|
499
|
-
if (!it) {
|
|
500
|
-
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
|
|
501
|
-
if (it) o = it;
|
|
502
|
-
var i = 0;
|
|
503
|
-
var F = function() {};
|
|
504
|
-
return {
|
|
505
|
-
s: F,
|
|
506
|
-
n: function() {
|
|
507
|
-
if (i >= o.length) return {
|
|
508
|
-
done: true
|
|
509
|
-
};
|
|
510
|
-
return {
|
|
511
|
-
done: false,
|
|
512
|
-
value: o[i++]
|
|
513
|
-
};
|
|
514
|
-
},
|
|
515
|
-
e: function(e) {
|
|
516
|
-
throw e;
|
|
517
|
-
},
|
|
518
|
-
f: F
|
|
519
|
-
};
|
|
520
|
-
}
|
|
521
|
-
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
522
|
-
}
|
|
523
|
-
var normalCompletion = true, didErr = false, err;
|
|
524
|
-
return {
|
|
525
|
-
s: function() {
|
|
526
|
-
it = it.call(o);
|
|
527
|
-
},
|
|
528
|
-
n: function() {
|
|
529
|
-
var step = it.next();
|
|
530
|
-
normalCompletion = step.done;
|
|
531
|
-
return step;
|
|
532
|
-
},
|
|
533
|
-
e: function(e) {
|
|
534
|
-
didErr = true;
|
|
535
|
-
err = e;
|
|
536
|
-
},
|
|
537
|
-
f: function() {
|
|
538
|
-
try {
|
|
539
|
-
if (!normalCompletion && it.return != null) it.return();
|
|
540
|
-
} finally {
|
|
541
|
-
if (didErr) throw err;
|
|
542
|
-
}
|
|
543
|
-
}
|
|
544
|
-
};
|
|
545
|
-
}
|
|
546
|
-
function _toPrimitive(input, hint) {
|
|
547
|
-
if (typeof input !== "object" || input === null) return input;
|
|
548
|
-
var prim = input[Symbol.toPrimitive];
|
|
549
|
-
if (prim !== undefined) {
|
|
550
|
-
var res = prim.call(input, hint || "default");
|
|
551
|
-
if (typeof res !== "object") return res;
|
|
552
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
553
|
-
}
|
|
554
|
-
return (hint === "string" ? String : Number)(input);
|
|
555
|
-
}
|
|
556
|
-
function _toPropertyKey(arg) {
|
|
557
|
-
var key = _toPrimitive(arg, "string");
|
|
558
|
-
return typeof key === "symbol" ? key : String(key);
|
|
559
548
|
}
|
|
560
549
|
var store;
|
|
561
550
|
function getGlobalConfig(config2) {
|
|
@@ -1274,6 +1263,9 @@
|
|
|
1274
1263
|
(function(MobileCredentialVerificationReasonType) {
|
|
1275
1264
|
MobileCredentialVerificationReasonType["Expired"] = "expired";
|
|
1276
1265
|
MobileCredentialVerificationReasonType["Inactive"] = "inactive";
|
|
1266
|
+
MobileCredentialVerificationReasonType["StatusRevoked"] = "invalid";
|
|
1267
|
+
MobileCredentialVerificationReasonType["StatusSuspended"] = "suspended";
|
|
1268
|
+
MobileCredentialVerificationReasonType["StatusUnknown"] = "unknown";
|
|
1277
1269
|
})(exports.MobileCredentialVerificationReasonType || (exports.MobileCredentialVerificationReasonType = {}));
|
|
1278
1270
|
exports.ClaimType = void 0;
|
|
1279
1271
|
(function(ClaimType) {
|
|
@@ -1387,6 +1379,7 @@
|
|
|
1387
1379
|
})(exports.RequestCredentialsErrorType || (exports.RequestCredentialsErrorType = {}));
|
|
1388
1380
|
const InitialiseOptionsValidator = object({
|
|
1389
1381
|
apiBaseUrl: string(),
|
|
1382
|
+
applicationId: optional(string()),
|
|
1390
1383
|
enableDigitalCredentialsApiSameDeviceFlow: optional(_boolean()),
|
|
1391
1384
|
enableDigitalCredentialsApiCrossDeviceFlow: optional(_boolean())
|
|
1392
1385
|
});
|
|
@@ -1449,12 +1442,14 @@
|
|
|
1449
1442
|
const urlParams = new URLSearchParams(hash.split("#")[1]);
|
|
1450
1443
|
return urlParams.get(param);
|
|
1451
1444
|
};
|
|
1452
|
-
const createSession = async ({credentialQuery: credentialQuery, challenge: challenge, redirectUri: redirectUri, apiBaseUrl: apiBaseUrl, walletProviderId: walletProviderId}) => {
|
|
1453
|
-
const postData = Object.assign(Object.assign({
|
|
1445
|
+
const createSession = async ({credentialQuery: credentialQuery, challenge: challenge, redirectUri: redirectUri, apiBaseUrl: apiBaseUrl, applicationId: applicationId, walletProviderId: walletProviderId}) => {
|
|
1446
|
+
const postData = Object.assign(Object.assign(Object.assign({
|
|
1454
1447
|
credentialQuery: credentialQuery,
|
|
1455
1448
|
challenge: challenge
|
|
1456
1449
|
}, redirectUri ? {
|
|
1457
1450
|
redirectUri: redirectUri
|
|
1451
|
+
} : {}), applicationId ? {
|
|
1452
|
+
applicationId: applicationId
|
|
1458
1453
|
} : {}), walletProviderId ? {
|
|
1459
1454
|
walletProviderId: walletProviderId
|
|
1460
1455
|
} : {});
|
|
@@ -1527,7 +1522,7 @@
|
|
|
1527
1522
|
}, protocol && {
|
|
1528
1523
|
protocol: protocol
|
|
1529
1524
|
});
|
|
1530
|
-
const responseResult = await safeFetch(`${apiBaseUrl}/v2/presentations/sessions/
|
|
1525
|
+
const responseResult = await safeFetch(`${apiBaseUrl}/v2/presentations/sessions/web/request`, {
|
|
1531
1526
|
method: "POST",
|
|
1532
1527
|
headers: {
|
|
1533
1528
|
"Content-Type": "application/json"
|
|
@@ -1546,13 +1541,14 @@
|
|
|
1546
1541
|
}
|
|
1547
1542
|
return ok(data);
|
|
1548
1543
|
};
|
|
1549
|
-
const getDigitalCredentialsApiSessionResult = async ({challenge: challenge, sessionId: sessionId, response: response, apiBaseUrl: apiBaseUrl}) => {
|
|
1544
|
+
const getDigitalCredentialsApiSessionResult = async ({challenge: challenge, sessionId: sessionId, response: response, apiBaseUrl: apiBaseUrl, protocol: protocol}) => {
|
|
1550
1545
|
const postData = {
|
|
1551
1546
|
challenge: challenge,
|
|
1552
1547
|
sessionId: sessionId,
|
|
1553
|
-
response: response
|
|
1548
|
+
response: response,
|
|
1549
|
+
protocol: protocol
|
|
1554
1550
|
};
|
|
1555
|
-
const fetchResultFn = async () => await safeFetch(`${apiBaseUrl}/v2/presentations/sessions/
|
|
1551
|
+
const fetchResultFn = async () => await safeFetch(`${apiBaseUrl}/v2/presentations/sessions/web/response`, {
|
|
1556
1552
|
method: "POST",
|
|
1557
1553
|
headers: {
|
|
1558
1554
|
"Content-Type": "application/json"
|
|
@@ -1662,16 +1658,18 @@
|
|
|
1662
1658
|
modalContainer.appendChild(style);
|
|
1663
1659
|
modalContainer.appendChild(iframe);
|
|
1664
1660
|
document.body.appendChild(modalContainer);
|
|
1665
|
-
modalContainer.setAttribute("style", "background: rgba(0, 0, 0, 0.5) !important; position: fixed !important; top: 0 !important; left: 0 !important; width: 100% !important; height: 100% !important;");
|
|
1661
|
+
modalContainer.setAttribute("style", "background: rgba(0, 0, 0, 0.5) !important; position: fixed !important; top: 0 !important; left: 0 !important; width: 100% !important; height: 100% !important; z-index: 999;");
|
|
1662
|
+
modalContainer.setAttribute("class", "mattr-verifier-modal-container");
|
|
1666
1663
|
return modalContainer;
|
|
1667
1664
|
};
|
|
1668
1665
|
const requestCredentialsCrossDevice = async options => {
|
|
1669
1666
|
const {challenge: challenge, walletProviderId: walletProviderId, credentialQuery: credentialQuery, crossDeviceCallback: crossDeviceCallback, initialiseOptions: initialiseOptions} = options;
|
|
1670
|
-
const {apiBaseUrl: apiBaseUrl} = initialiseOptions;
|
|
1667
|
+
const {apiBaseUrl: apiBaseUrl, applicationId: applicationId} = initialiseOptions;
|
|
1671
1668
|
const createSessionResult = await createSession({
|
|
1672
1669
|
credentialQuery: credentialQuery,
|
|
1673
1670
|
challenge: challenge,
|
|
1674
1671
|
apiBaseUrl: apiBaseUrl,
|
|
1672
|
+
applicationId: applicationId,
|
|
1675
1673
|
walletProviderId: walletProviderId
|
|
1676
1674
|
});
|
|
1677
1675
|
if (createSessionResult.isErr()) {
|
|
@@ -1705,7 +1703,7 @@
|
|
|
1705
1703
|
})(SameDeviceRequestCredentialsErrorMessage$1 || (SameDeviceRequestCredentialsErrorMessage$1 = {}));
|
|
1706
1704
|
const requestCredentialsSameDevice = async options => {
|
|
1707
1705
|
const {challenge: challenge, credentialQuery: credentialQuery, redirectUri: redirectUri, walletProviderId: walletProviderId, initialiseOptions: initialiseOptions} = options;
|
|
1708
|
-
const {apiBaseUrl: apiBaseUrl} = initialiseOptions;
|
|
1706
|
+
const {apiBaseUrl: apiBaseUrl, applicationId: applicationId} = initialiseOptions;
|
|
1709
1707
|
window.localStorage.setItem(LocalStorageKey.challenge, challenge);
|
|
1710
1708
|
const storedChallenge = window.localStorage.getItem(LocalStorageKey.challenge);
|
|
1711
1709
|
if (!storedChallenge) {
|
|
@@ -1719,6 +1717,7 @@
|
|
|
1719
1717
|
challenge: storedChallenge,
|
|
1720
1718
|
redirectUri: redirectUri,
|
|
1721
1719
|
apiBaseUrl: apiBaseUrl,
|
|
1720
|
+
applicationId: applicationId,
|
|
1722
1721
|
walletProviderId: walletProviderId
|
|
1723
1722
|
});
|
|
1724
1723
|
if (createSessionResult.isErr()) {
|
|
@@ -1785,7 +1784,8 @@
|
|
|
1785
1784
|
challenge: challenge,
|
|
1786
1785
|
sessionId: sessionId,
|
|
1787
1786
|
response: response,
|
|
1788
|
-
apiBaseUrl: apiBaseUrl
|
|
1787
|
+
apiBaseUrl: apiBaseUrl,
|
|
1788
|
+
protocol: digitalCredentialsApiProtocol !== null && digitalCredentialsApiProtocol !== void 0 ? digitalCredentialsApiProtocol : "preview"
|
|
1789
1789
|
});
|
|
1790
1790
|
if (result.isOk()) {
|
|
1791
1791
|
return ok({
|