@bedrock/vc-delivery 7.8.0 → 7.9.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/helpers.js CHANGED
@@ -56,6 +56,41 @@ export function buildPresentationFromResults({
56
56
  return vp;
57
57
  }
58
58
 
59
+ export function buildVerifyPresentationResults({verifyResult}) {
60
+ /*if(verifyResult.results) {
61
+ // VCALM-compliant result already available, use it or a minimized version
62
+ // of it to avoid hitting exchange storage capacity limits
63
+ }*/
64
+
65
+ // backwards-compatibility: construct VCALM-compliant result
66
+ return {
67
+ verified: verifyResult.verified,
68
+ results: {
69
+ presentation: {
70
+ verified: verifyResult.presentationResult?.verified,
71
+ proof: verifyResult.presentationResult?.results?.map(r => ({
72
+ verified: r.verified,
73
+ input: r.proof
74
+ })),
75
+ },
76
+ credentials: verifyResult.credentialResults?.map(r => ({
77
+ verified: r.verified,
78
+ results: {
79
+ proof: r.results?.map(r => ({
80
+ verified: r.verified,
81
+ input: r.proof
82
+ })),
83
+ credentialStatus: r.statusResult?.results?.map(r => ({
84
+ verified: r.verified,
85
+ input: r.credentialStatus,
86
+ value: r.status
87
+ }))
88
+ }
89
+ }))
90
+ }
91
+ };
92
+ }
93
+
59
94
  export function emitExchangeUpdated({workflow, exchange, step}) {
60
95
  if(!step?.callback?.url) {
61
96
  // no-op when there is no callback to notify
@@ -4,7 +4,9 @@
4
4
  import * as bedrock from '@bedrock/core';
5
5
  import * as exchanges from '../exchanges.js';
6
6
  import {
7
- buildPresentationFromResults, emitExchangeUpdated,
7
+ buildPresentationFromResults,
8
+ buildVerifyPresentationResults,
9
+ emitExchangeUpdated,
8
10
  evaluateExchangeStep
9
11
  } from '../helpers.js';
10
12
  import {getClientBaseUrl, getClientProfile} from './clientProfiles.js';
@@ -264,6 +266,9 @@ export async function processAuthorizationResponse({req, clientProfileId}) {
264
266
  presentation,
265
267
  verifyResult
266
268
  }),
269
+ verifyPresentationResults: buildVerifyPresentationResults({
270
+ verifyResult
271
+ }),
267
272
  openId: {
268
273
  clientProfileId,
269
274
  authorizationRequest,
package/lib/vcapi.js CHANGED
@@ -5,7 +5,9 @@ import * as bedrock from '@bedrock/core';
5
5
  import * as exchanges from './exchanges.js';
6
6
  import {createChallenge as _createChallenge, verify} from './verify.js';
7
7
  import {
8
- buildPresentationFromResults, emitExchangeUpdated,
8
+ buildPresentationFromResults,
9
+ buildVerifyPresentationResults,
10
+ emitExchangeUpdated,
9
11
  evaluateExchangeStep,
10
12
  generateRandom, validateVerifiablePresentation
11
13
  } from './helpers.js';
@@ -245,6 +247,9 @@ export async function processExchange({req, res, workflow, exchangeRecord}) {
245
247
  verifiablePresentation: buildPresentationFromResults({
246
248
  presentation: receivedPresentation,
247
249
  verifyResult
250
+ }),
251
+ verifyPresentationResults: buildVerifyPresentationResults({
252
+ verifyResult
248
253
  })
249
254
  };
250
255
  exchange.variables.results[currentStep] = result;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bedrock/vc-delivery",
3
- "version": "7.8.0",
3
+ "version": "7.9.0",
4
4
  "type": "module",
5
5
  "description": "Bedrock Verifiable Credential Delivery",
6
6
  "main": "./lib/index.js",