@mattrglobal/verifier-sdk-web 1.1.1-unstable.159 → 1.1.1-unstable.160

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.
@@ -1406,6 +1406,14 @@ var PresentationErrorType;
1406
1406
  PresentationErrorType["Unknown"] = "Unknown";
1407
1407
  })(PresentationErrorType || (PresentationErrorType = {}));
1408
1408
 
1409
+ const PresentationSuccessResultValidator = object({
1410
+ sessionId: string(),
1411
+ challenge: string(),
1412
+ credentialQuery: array(CredentialQueryValidator),
1413
+ credentials: optional(array(any())),
1414
+ credentialErrors: optional(array(any()))
1415
+ });
1416
+
1409
1417
  const PresentationResultRelaxValidator = object({
1410
1418
  sessionId: string(),
1411
1419
  challenge: optional(string()),
@@ -1415,6 +1423,18 @@ const PresentationResultRelaxValidator = object({
1415
1423
  error: optional(unknown())
1416
1424
  });
1417
1425
 
1426
+ const PresentationFailureResultValidator = object({
1427
+ sessionId: string(),
1428
+ challenge: string(),
1429
+ credentialQuery: array(CredentialQueryValidator),
1430
+ error: object({
1431
+ type: picklist(Object.values(PresentationErrorType)),
1432
+ message: string()
1433
+ })
1434
+ });
1435
+
1436
+ const PresentationSessionResultValidator = union([ PresentationSuccessResultValidator, PresentationFailureResultValidator ]);
1437
+
1418
1438
  exports.Mode = void 0;
1419
1439
 
1420
1440
  (function(Mode) {
@@ -1868,7 +1888,7 @@ const receiveMessageHandler = options => async event => {
1868
1888
  return;
1869
1889
  }
1870
1890
  onComplete({
1871
- result: "challenge" in result.value ? result.value : undefined,
1891
+ result: isType(PresentationSessionResultValidator)(result.value) ? result.value : undefined,
1872
1892
  sessionId: result.value.sessionId,
1873
1893
  sessionCompletedInRedirect: false
1874
1894
  });
@@ -2009,7 +2029,11 @@ const requestCredentialsWithDigitalCredentialsApi = async options => {
2009
2029
  cause: credentialVerificationResult.error
2010
2030
  });
2011
2031
  }
2012
- return ok(credentialVerificationResult.value);
2032
+ const verificationResult = credentialVerificationResult.value;
2033
+ return ok({
2034
+ result: isType(PresentationSessionResultValidator)(verificationResult) ? verificationResult : undefined,
2035
+ sessionId: sessionId
2036
+ });
2013
2037
  };
2014
2038
 
2015
2039
  const getCredentials = async (request, abortController) => {