@bedrock/vc-delivery 6.3.0 → 6.4.0

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
@@ -158,7 +158,7 @@ export async function addRoutes({app, service} = {}) {
158
158
  client_id: `${openIdRoute}/client/authorization/response`,
159
159
  request_uri: `${openIdRoute}/client/authorization/request`
160
160
  });
161
- protocols.OID4VP = `openid4vp://authorize?${searchParams}`;
161
+ protocols.OID4VP = `openid4vp://?${searchParams}`;
162
162
  }
163
163
  res.json({protocols});
164
164
  }));
package/lib/oid4/http.js CHANGED
@@ -60,6 +60,7 @@ export async function createRoutes({
60
60
  batchCredential: `${openIdRoute}/batch_credential`,
61
61
  credential: `${openIdRoute}/credential`,
62
62
  credentialOffer: `${openIdRoute}/credential-offer`,
63
+ nonce: `${openIdRoute}/nonce`,
63
64
  token: `${openIdRoute}/token`,
64
65
  jwks: `${openIdRoute}/jwks`,
65
66
  // OID4VP routes
@@ -264,6 +265,20 @@ export async function createRoutes({
264
265
  res.json(result);
265
266
  }));
266
267
 
268
+ // a credential delivery server endpoint
269
+ // serves a nonce to be used in OID4VCI proofs (if required)
270
+ app.options(routes.nonce, cors());
271
+ app.post(
272
+ routes.nonce,
273
+ cors(),
274
+ getExchange,
275
+ asyncHandler(async (req, res) => {
276
+ // serve exchange ID as nonce
277
+ const exchangeRecord = await req.getExchange();
278
+ const {exchange} = exchangeRecord;
279
+ res.json({c_nonce: exchange.id});
280
+ }));
281
+
267
282
  // a batch credential delivery server endpoint
268
283
  // receives N credential requests and returns N VCs
269
284
  app.options(routes.batchCredential, cors());
@@ -36,14 +36,15 @@ export async function getCredentialIssuerConfig({req}) {
36
36
 
37
37
  const exchangeId = `${workflow.id}/exchanges/${exchange.id}`;
38
38
  return {
39
+ batch_credential_endpoint: `${exchangeId}/openid/batch_credential`,
40
+ credential_configurations_supported,
41
+ credential_endpoint: `${exchangeId}/openid/credential`,
39
42
  credential_issuer: exchangeId,
40
43
  issuer: exchangeId,
41
44
  jwks_uri: `${exchangeId}/openid/jwks`,
42
- token_endpoint: `${exchangeId}/openid/token`,
43
- credential_endpoint: `${exchangeId}/openid/credential`,
44
- batch_credential_endpoint: `${exchangeId}/openid/batch_credential`,
45
45
  'pre-authorized_grant_anonymous_access_supported': true,
46
- credential_configurations_supported
46
+ nonce_endpoint: `${exchangeId}/openid/nonce`,
47
+ token_endpoint: `${exchangeId}/openid/token`
47
48
  };
48
49
  }
49
50
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bedrock/vc-delivery",
3
- "version": "6.3.0",
3
+ "version": "6.4.0",
4
4
  "type": "module",
5
5
  "description": "Bedrock Verifiable Credential Delivery",
6
6
  "main": "./lib/index.js",