@bedrock/vc-verifier 21.0.3 → 21.1.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/di.js +8 -8
- package/lib/status.js +13 -5
- package/package.json +2 -1
package/lib/di.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Copyright (c) 2018-2024 Digital Bazaar, Inc. All rights reserved.
|
|
3
3
|
*/
|
|
4
4
|
import * as vc from '@digitalbazaar/vc';
|
|
5
|
-
import {checkStatus} from './status.js';
|
|
5
|
+
import {checkStatus as _checkStatus} from './status.js';
|
|
6
6
|
import {createDocumentLoader} from './documentLoader.js';
|
|
7
7
|
import {createSuites} from './suites.js';
|
|
8
8
|
|
|
@@ -10,13 +10,15 @@ export async function verifyCredential({config, credential, checks} = {}) {
|
|
|
10
10
|
const documentLoader = await createDocumentLoader({config});
|
|
11
11
|
const suite = createSuites();
|
|
12
12
|
|
|
13
|
+
// only check credential status when option is set
|
|
14
|
+
const checkStatus = checks.includes('credentialStatus') ?
|
|
15
|
+
_checkStatus : () => ({verified: true});
|
|
16
|
+
|
|
13
17
|
const result = await vc.verifyCredential({
|
|
14
18
|
credential,
|
|
15
19
|
documentLoader,
|
|
16
20
|
suite,
|
|
17
|
-
|
|
18
|
-
checkStatus: checks.includes('credentialStatus') ?
|
|
19
|
-
checkStatus : () => ({verified: true})
|
|
21
|
+
checkStatus
|
|
20
22
|
});
|
|
21
23
|
// if proof should have been checked but wasn't due to an error,
|
|
22
24
|
// try to run the check again using the VC's issuance date
|
|
@@ -28,9 +30,7 @@ export async function verifyCredential({config, credential, checks} = {}) {
|
|
|
28
30
|
documentLoader,
|
|
29
31
|
suite,
|
|
30
32
|
now: new Date(credential.issuanceDate),
|
|
31
|
-
|
|
32
|
-
checkStatus: checks.includes('credentialStatus') ?
|
|
33
|
-
checkStatus : () => ({verified: true})
|
|
33
|
+
checkStatus
|
|
34
34
|
});
|
|
35
35
|
if(proofResult.verified) {
|
|
36
36
|
// overlay original (failed) results on top of proof results
|
|
@@ -57,7 +57,7 @@ export async function verifyPresentation({
|
|
|
57
57
|
documentLoader: await createDocumentLoader({config}),
|
|
58
58
|
suite: createSuites(),
|
|
59
59
|
unsignedPresentation: !checks.includes('proof'),
|
|
60
|
-
checkStatus
|
|
60
|
+
checkStatus: _checkStatus
|
|
61
61
|
};
|
|
62
62
|
return vc.verify(verifyOptions);
|
|
63
63
|
}
|
package/lib/status.js
CHANGED
|
@@ -1,24 +1,32 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Copyright (c) 2019-
|
|
2
|
+
* Copyright (c) 2019-2024 Digital Bazaar, Inc. All rights reserved.
|
|
3
3
|
*/
|
|
4
|
+
import {
|
|
5
|
+
checkStatus as bitstringStatusListCheckStatus,
|
|
6
|
+
statusTypeMatches as bitstringStatusListStatusTypeMatches
|
|
7
|
+
} from '@digitalbazaar/vc-bitstring-status-list';
|
|
4
8
|
import {
|
|
5
9
|
checkStatus as revocationListCheckStatus,
|
|
6
10
|
statusTypeMatches as revocationListStatusTypeMatches
|
|
7
11
|
} from '@digitalbazaar/vc-revocation-list';
|
|
8
12
|
import {
|
|
9
|
-
checkStatus as
|
|
10
|
-
statusTypeMatches as
|
|
13
|
+
checkStatus as statusList2020CheckStatus,
|
|
14
|
+
statusTypeMatches as statusList2020StatusTypeMatches
|
|
11
15
|
} from '@digitalbazaar/vc-status-list';
|
|
12
16
|
import assert from 'assert-plus';
|
|
13
17
|
|
|
14
18
|
const handlerMap = new Map();
|
|
19
|
+
handlerMap.set('BitstringStatusListEntry', {
|
|
20
|
+
checkStatus: bitstringStatusListCheckStatus,
|
|
21
|
+
statusTypeMatches: bitstringStatusListStatusTypeMatches
|
|
22
|
+
});
|
|
15
23
|
handlerMap.set('RevocationList2020Status', {
|
|
16
24
|
checkStatus: revocationListCheckStatus,
|
|
17
25
|
statusTypeMatches: revocationListStatusTypeMatches
|
|
18
26
|
});
|
|
19
27
|
handlerMap.set('StatusList2021Entry', {
|
|
20
|
-
checkStatus:
|
|
21
|
-
statusTypeMatches:
|
|
28
|
+
checkStatus: statusList2020CheckStatus,
|
|
29
|
+
statusTypeMatches: statusList2020StatusTypeMatches
|
|
22
30
|
});
|
|
23
31
|
|
|
24
32
|
export async function checkStatus(options = {}) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bedrock/vc-verifier",
|
|
3
|
-
"version": "21.0
|
|
3
|
+
"version": "21.1.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Bedrock VC Verifier",
|
|
6
6
|
"main": "./lib/index.js",
|
|
@@ -37,6 +37,7 @@
|
|
|
37
37
|
"@digitalbazaar/eddsa-2022-cryptosuite": "^1.0.0",
|
|
38
38
|
"@digitalbazaar/eddsa-rdfc-2022-cryptosuite": "^1.1.0",
|
|
39
39
|
"@digitalbazaar/vc": "^7.0.0",
|
|
40
|
+
"@digitalbazaar/vc-bitstring-status-list": "^2.0.0",
|
|
40
41
|
"@digitalbazaar/vc-revocation-list": "^7.0.0",
|
|
41
42
|
"@digitalbazaar/vc-status-list": "^8.0.0",
|
|
42
43
|
"assert-plus": "^1.0.0",
|