@bedrock/vc-verifier 23.4.0 → 23.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.
@@ -99,10 +99,10 @@ export async function createDocumentLoader({
99
99
  // use web loader if configured and instance config allows it (or it is
100
100
  // allowed by an allow list) and the url starts with `http` (and the core
101
101
  // config allows it, i.e., `webLoader` exists)
102
- const allowRemoteContexts = !config.verifyOptions?.documentLoader ||
102
+ const allowRemote = !config.verifyOptions?.documentLoader ||
103
103
  config.verifyOptions.documentLoader.allowRemoteContexts ||
104
104
  remoteUrlAllowList?.has(url);
105
- if(allowRemoteContexts &&
105
+ if(allowRemote &&
106
106
  url.startsWith('http') && e.name === 'NotFoundError' && webLoader) {
107
107
  return webLoader(url);
108
108
  }
package/lib/status.js CHANGED
@@ -62,6 +62,14 @@ export function createCheckStatus({config} = {}) {
62
62
  const credentialStatuses = Array.isArray(credentialStatus) ?
63
63
  credentialStatus : [credentialStatus];
64
64
 
65
+ // handle case that terse status has no published revocation or
66
+ // suspension lists, so credential status is empty, i.e., no status
67
+ // to check; a future revision might return the expanded BSL entries
68
+ // with a default `false` status value for each status purpose
69
+ if(credentialStatuses.length === 0) {
70
+ return {verified: true};
71
+ }
72
+
65
73
  // combination of different status types not supported at this time
66
74
  const expectedType = credentialStatuses?.[0]?.type;
67
75
  if(credentialStatuses.some(({type}) => type !== expectedType)) {
@@ -108,8 +116,22 @@ export function createCheckStatus({config} = {}) {
108
116
  credential,
109
117
  documentLoader
110
118
  };
111
- return await handlers.checkStatus(options);
119
+ const result = await handlers.checkStatus(options);
120
+ if(result.error) {
121
+ throw result.error;
122
+ }
123
+ return result;
112
124
  } catch(error) {
125
+ if(!(error instanceof BedrockError)) {
126
+ // always expose cause message and name; expose cause details as
127
+ // BedrockError if error is marked public
128
+ const details = error.details?.public ? error.details : {};
129
+ error = new BedrockError(error.message, {
130
+ name: error.name || 'OperationError',
131
+ details: {...details, public: true},
132
+ cause: error
133
+ });
134
+ }
113
135
  return {verified: false, error};
114
136
  }
115
137
  };
@@ -226,7 +248,7 @@ async function _fetchStatusListIfExists({expanded, cache}) {
226
248
  cache.set(statusListCredential, document);
227
249
  return true;
228
250
  } catch(e) {
229
- if(e.message === 'NotFoundError') {
251
+ if(e.name === 'NotFoundError') {
230
252
  // ok for a terse bitstring list to not exist
231
253
  return false;
232
254
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bedrock/vc-verifier",
3
- "version": "23.4.0",
3
+ "version": "23.5.1",
4
4
  "type": "module",
5
5
  "description": "Bedrock VC Verifier",
6
6
  "main": "./lib/index.js",
@@ -63,7 +63,7 @@
63
63
  "@bedrock/did-io": "^10.4.0",
64
64
  "@bedrock/express": "^8.3.1",
65
65
  "@bedrock/https-agent": "^4.1.0",
66
- "@bedrock/jsonld-document-loader": "^5.2.0",
66
+ "@bedrock/jsonld-document-loader": "^5.2.1",
67
67
  "@bedrock/mongodb": "^11.0.0",
68
68
  "@bedrock/multikey-context": "^3.0.0",
69
69
  "@bedrock/security-context": "^9.0.0",