@bedrock/vc-delivery 5.3.1 → 5.3.3

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
@@ -13,6 +13,11 @@ import {ZcapClient} from '@digitalbazaar/ezcap';
13
13
 
14
14
  const {config, util: {BedrockError}} = bedrock;
15
15
 
16
+ const ALLOWED_ERROR_KEYS = [
17
+ 'message', 'name', 'type', 'data', 'errors', 'error', 'details', 'cause',
18
+ 'status'
19
+ ];
20
+
16
21
  export async function evaluateTemplate({
17
22
  workflow, exchange, typedTemplate
18
23
  } = {}) {
@@ -106,8 +111,14 @@ export function decodeLocalId({localId} = {}) {
106
111
  }
107
112
 
108
113
  export function stripStacktrace(error) {
109
- error = serializeError(error);
110
- delete error.stack;
114
+ // serialize error and allow-list specific properties
115
+ const serialized = serializeError(error);
116
+ error = {};
117
+ for(const key of ALLOWED_ERROR_KEYS) {
118
+ if(serialized[key] !== undefined) {
119
+ error[key] = serialized[key];
120
+ }
121
+ }
111
122
  if(error.errors) {
112
123
  error.errors = error.errors.map(stripStacktrace);
113
124
  }
package/lib/verify.js CHANGED
@@ -181,9 +181,9 @@ export async function verifyDidProofJwt({workflow, exchange, jwt} = {}) {
181
181
  if(typeof match === 'string') {
182
182
  match = didDoc?.verificationMethod?.find?.(e => e.id === vm.id);
183
183
  }
184
- if(!(match && Array.isArray(match.controller) ?
184
+ if(!(match && (Array.isArray(match.controller) ?
185
185
  match.controller.includes(vm.controller) :
186
- match.controller === vm.controller)) {
186
+ match.controller === vm.controller))) {
187
187
  throw new BedrockError(
188
188
  `Verification method controller "${issuer}" did not authorize ` +
189
189
  `verification method "${vm.id}" for the purpose of "authentication".`, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bedrock/vc-delivery",
3
- "version": "5.3.1",
3
+ "version": "5.3.3",
4
4
  "type": "module",
5
5
  "description": "Bedrock Verifiable Credential Delivery",
6
6
  "main": "./lib/index.js",