@bedrock/vc-delivery 3.5.0 → 3.5.1

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/lib/http.js CHANGED
@@ -243,11 +243,11 @@ export async function addRoutes({app, service} = {}) {
243
243
  // verify the received VP
244
244
  const expectedChallenge = isInitialStep ? exchange.id : undefined;
245
245
  const {verificationMethod} = await verify({
246
- exchanger, presentation: receivedPresentation, expectedChallenge
246
+ exchanger,
247
+ verifiablePresentationRequest: step.verifiablePresentationRequest,
248
+ presentation: receivedPresentation, expectedChallenge
247
249
  });
248
250
 
249
- // FIXME: ensure VP satisfies step VPR
250
-
251
251
  // store VP results in variables associated with current step
252
252
  if(!exchange.variables.results) {
253
253
  exchange.variables.results = {};
package/lib/verify.js CHANGED
@@ -22,7 +22,7 @@ export async function createChallenge({exchanger} = {}) {
22
22
  }
23
23
 
24
24
  export async function verify({
25
- exchanger, presentation, expectedChallenge
25
+ exchanger, verifiablePresentationRequest, presentation, expectedChallenge
26
26
  } = {}) {
27
27
  // create zcap client for verifying
28
28
  const {zcapClient, zcaps} = await getZcapClient({exchanger});
@@ -34,13 +34,16 @@ export async function verify({
34
34
  checks.push('challenge');
35
35
  }
36
36
  const capability = zcaps.verifyPresentation;
37
- const domain = new URL(exchanger.id).origin;
37
+ const domain = verifiablePresentationRequest.domain ??
38
+ new URL(exchanger.id).origin;
38
39
  const result = await zcapClient.write({
39
40
  capability,
40
41
  json: {
41
42
  options: {
42
43
  // FIXME: support multi-proof presentations?
43
- challenge: expectedChallenge ?? presentation?.proof?.challenge,
44
+ challenge: expectedChallenge ??
45
+ verifiablePresentationRequest.challenge ??
46
+ presentation?.proof?.challenge,
44
47
  domain,
45
48
  checks
46
49
  },
@@ -55,6 +58,8 @@ export async function verify({
55
58
  }
56
59
  } = result;
57
60
 
61
+ // FIXME: ensure VP satisfies VPR
62
+
58
63
  return {verified, challengeUses, verificationMethod};
59
64
  }
60
65
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bedrock/vc-delivery",
3
- "version": "3.5.0",
3
+ "version": "3.5.1",
4
4
  "type": "module",
5
5
  "description": "Bedrock Verifiable Credential Delivery",
6
6
  "main": "./lib/index.js",