@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.
@@ -165,6 +165,14 @@ var PresentationErrorType;
165
165
  PresentationErrorType["Unknown"] = "Unknown";
166
166
  })(PresentationErrorType || (PresentationErrorType = {}));
167
167
 
168
+ const PresentationSuccessResultValidator = v__namespace.object({
169
+ sessionId: v__namespace.string(),
170
+ challenge: v__namespace.string(),
171
+ credentialQuery: v__namespace.array(CredentialQueryValidator),
172
+ credentials: v__namespace.optional(v__namespace.array(v__namespace.any())),
173
+ credentialErrors: v__namespace.optional(v__namespace.array(v__namespace.any()))
174
+ });
175
+
168
176
  const PresentationResultRelaxValidator = v__namespace.object({
169
177
  sessionId: v__namespace.string(),
170
178
  challenge: v__namespace.optional(v__namespace.string()),
@@ -174,6 +182,18 @@ const PresentationResultRelaxValidator = v__namespace.object({
174
182
  error: v__namespace.optional(v__namespace.unknown())
175
183
  });
176
184
 
185
+ const PresentationFailureResultValidator = v__namespace.object({
186
+ sessionId: v__namespace.string(),
187
+ challenge: v__namespace.string(),
188
+ credentialQuery: v__namespace.array(CredentialQueryValidator),
189
+ error: v__namespace.object({
190
+ type: v__namespace.picklist(Object.values(PresentationErrorType)),
191
+ message: v__namespace.string()
192
+ })
193
+ });
194
+
195
+ const PresentationSessionResultValidator = v__namespace.union([ PresentationSuccessResultValidator, PresentationFailureResultValidator ]);
196
+
177
197
  exports.Mode = void 0;
178
198
 
179
199
  (function(Mode) {
@@ -607,7 +627,7 @@ const receiveMessageHandler = options => async event => {
607
627
  return;
608
628
  }
609
629
  onComplete({
610
- result: "challenge" in result.value ? result.value : undefined,
630
+ result: isType(PresentationSessionResultValidator)(result.value) ? result.value : undefined,
611
631
  sessionId: result.value.sessionId,
612
632
  sessionCompletedInRedirect: false
613
633
  });
@@ -748,7 +768,11 @@ const requestCredentialsWithDigitalCredentialsApi = async options => {
748
768
  cause: credentialVerificationResult.error
749
769
  });
750
770
  }
751
- return neverthrow.ok(credentialVerificationResult.value);
771
+ const verificationResult = credentialVerificationResult.value;
772
+ return neverthrow.ok({
773
+ result: isType(PresentationSessionResultValidator)(verificationResult) ? verificationResult : undefined,
774
+ sessionId: sessionId
775
+ });
752
776
  };
753
777
 
754
778
  const getCredentials = async (request, abortController) => {