@veramo/credential-status 4.2.1-unstable.9 → 4.3.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/build/credential-status.js +30 -17
- package/build/credential-status.js.map +1 -1
- package/build/index.d.ts +1 -1
- package/build/index.d.ts.map +1 -1
- package/build/index.js +5 -1
- package/build/index.js.map +1 -1
- package/build/tsdoc-metadata.json +1 -1
- package/package.json +5 -11
- package/src/__tests__/credential-status.test.ts +2 -5
- package/src/index.ts +1 -1
|
@@ -1,5 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.CredentialStatusPlugin = void 0;
|
|
13
|
+
const utils_1 = require("@veramo/utils");
|
|
14
|
+
const credential_status_1 = require("credential-status");
|
|
3
15
|
/**
|
|
4
16
|
* This plugin implements the {@link @veramo/core#ICredentialStatusVerifier | ICredentialStatusVerifier}
|
|
5
17
|
* interface.
|
|
@@ -18,26 +30,27 @@ import { Status } from 'credential-status';
|
|
|
18
30
|
*
|
|
19
31
|
* @beta This API may change without a BREAKING CHANGE notice.
|
|
20
32
|
*/
|
|
21
|
-
|
|
22
|
-
status;
|
|
23
|
-
methods;
|
|
33
|
+
class CredentialStatusPlugin {
|
|
24
34
|
constructor(registry = {}) {
|
|
25
|
-
this.status = new Status(registry);
|
|
35
|
+
this.status = new credential_status_1.Status(registry);
|
|
26
36
|
this.methods = {
|
|
27
37
|
checkCredentialStatus: this.checkCredentialStatus.bind(this),
|
|
28
38
|
};
|
|
29
39
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
40
|
+
checkCredentialStatus(args, context) {
|
|
41
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
42
|
+
let didDoc = args.didDocumentOverride;
|
|
43
|
+
if (!didDoc) {
|
|
44
|
+
const issuerDid = (0, utils_1.extractIssuer)(args.credential);
|
|
45
|
+
didDoc = yield (0, utils_1.resolveDidOrThrow)(issuerDid, context);
|
|
46
|
+
}
|
|
47
|
+
const statusCheck = (yield this.status.checkStatus(args.credential, didDoc));
|
|
48
|
+
if (!(0, utils_1.isDefined)(statusCheck.revoked)) {
|
|
49
|
+
throw new Error(`invalid_result: 'revoked' property missing. The Credential Status verification resulted in an ambiguous result: ${JSON.stringify(statusCheck)}`);
|
|
50
|
+
}
|
|
51
|
+
return statusCheck;
|
|
52
|
+
});
|
|
41
53
|
}
|
|
42
54
|
}
|
|
55
|
+
exports.CredentialStatusPlugin = CredentialStatusPlugin;
|
|
43
56
|
//# sourceMappingURL=credential-status.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"credential-status.js","sourceRoot":"","sources":["../src/credential-status.ts"],"names":[],"mappings":"AAQA,
|
|
1
|
+
{"version":3,"file":"credential-status.js","sourceRoot":"","sources":["../src/credential-status.ts"],"names":[],"mappings":";;;;;;;;;;;;AAQA,yCAA2E;AAC3E,yDAAwD;AAExD;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAa,sBAAsB;IAIjC,YAAY,WAAyC,EAAE;QACrD,IAAI,CAAC,MAAM,GAAG,IAAI,0BAAM,CAAC,QAAQ,CAAC,CAAA;QAClC,IAAI,CAAC,OAAO,GAAG;YACb,qBAAqB,EAAE,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,IAAI,CAAC;SAC7D,CAAA;IACH,CAAC;IAEa,qBAAqB,CAAC,IAAgC,EAAE,OAAiC;;YACrG,IAAI,MAAM,GAAG,IAAI,CAAC,mBAAmB,CAAA;YACrC,IAAI,CAAC,MAAM,EAAE;gBACX,MAAM,SAAS,GAAG,IAAA,qBAAa,EAAC,IAAI,CAAC,UAAU,CAAC,CAAA;gBAChD,MAAM,GAAG,MAAM,IAAA,yBAAiB,EAAC,SAAS,EAAE,OAAO,CAAC,CAAA;aACrD;YACD,MAAM,WAAW,GAAqB,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,WAAW,CAClE,IAAI,CAAC,UAAU,EACf,MAAM,CACP,CAAqB,CAAA;YACtB,IAAI,CAAC,IAAA,iBAAS,EAAC,WAAW,CAAC,OAAO,CAAC,EAAE;gBACnC,MAAM,IAAI,KAAK,CACb,mHAAmH,IAAI,CAAC,SAAS,CAC/H,WAAW,CACZ,EAAE,CACJ,CAAA;aACF;YACD,OAAO,WAAW,CAAA;QACpB,CAAC;KAAA;CACF;AA9BD,wDA8BC"}
|
package/build/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { CredentialStatusPlugin } from './credential-status
|
|
1
|
+
export { CredentialStatusPlugin } from './credential-status';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
package/build/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAA"}
|
package/build/index.js
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CredentialStatusPlugin = void 0;
|
|
1
4
|
/* istanbul ignore file */
|
|
2
|
-
|
|
5
|
+
var credential_status_1 = require("./credential-status");
|
|
6
|
+
Object.defineProperty(exports, "CredentialStatusPlugin", { enumerable: true, get: function () { return credential_status_1.CredentialStatusPlugin; } });
|
|
3
7
|
//# sourceMappingURL=index.js.map
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,0BAA0B;AAC1B,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,0BAA0B;AAC1B,yDAA4D;AAAnD,2HAAA,sBAAsB,OAAA"}
|
package/package.json
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@veramo/credential-status",
|
|
3
3
|
"description": "Veramo plugin for resolving a credential status",
|
|
4
|
-
"version": "4.
|
|
4
|
+
"version": "4.3.0",
|
|
5
5
|
"main": "build/index.js",
|
|
6
|
-
"exports": "./build/index.js",
|
|
7
6
|
"types": "build/index.d.ts",
|
|
8
7
|
"scripts": {
|
|
9
8
|
"build": "tsc",
|
|
10
|
-
"extract-api": "
|
|
9
|
+
"extract-api": "pnpm exec veramo dev extract-api"
|
|
11
10
|
},
|
|
12
11
|
"dependencies": {
|
|
13
|
-
"@veramo/core": "^4.
|
|
14
|
-
"@veramo/utils": "^4.
|
|
12
|
+
"@veramo/core": "^4.3.0",
|
|
13
|
+
"@veramo/utils": "^4.3.0",
|
|
15
14
|
"credential-status": "^2.0.5",
|
|
16
15
|
"did-jwt": "^6.9.0",
|
|
17
16
|
"did-resolver": "^4.0.1"
|
|
@@ -35,10 +34,5 @@
|
|
|
35
34
|
"contributors": [],
|
|
36
35
|
"license": "Apache-2.0",
|
|
37
36
|
"keywords": [],
|
|
38
|
-
"
|
|
39
|
-
"moduleDirectories": [
|
|
40
|
-
"node_modules",
|
|
41
|
-
"src"
|
|
42
|
-
],
|
|
43
|
-
"gitHead": "ba3e5435dc7a09599f6c9af311b40d92162e810a"
|
|
37
|
+
"gitHead": "977662acfa9ee8a08d137e77920a79b3ae256f5d"
|
|
44
38
|
}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { createAgent, ICredentialStatusVerifier, VerifiableCredential } from '../../../core/src'
|
|
2
2
|
import { DIDResolverPlugin } from '../../../did-resolver/src'
|
|
3
|
-
import { CredentialStatusPlugin } from '../credential-status
|
|
3
|
+
import { CredentialStatusPlugin } from '../credential-status'
|
|
4
4
|
import { DIDDocument, DIDResolutionOptions, DIDResolutionResult, Resolvable } from 'did-resolver'
|
|
5
|
-
import { StatusMethod } from "credential-status";
|
|
6
|
-
import { jest } from '@jest/globals'
|
|
7
5
|
|
|
8
6
|
describe('@veramo/credential-status', () => {
|
|
9
7
|
const referenceDoc: DIDDocument = { id: 'did:example:1234' }
|
|
@@ -81,7 +79,6 @@ describe('@veramo/credential-status', () => {
|
|
|
81
79
|
const agent = createAgent({
|
|
82
80
|
plugins: [
|
|
83
81
|
new CredentialStatusPlugin({
|
|
84
|
-
// @ts-ignore
|
|
85
82
|
ExoticStatusMethod2022: checkStatus,
|
|
86
83
|
}),
|
|
87
84
|
],
|
|
@@ -104,7 +101,7 @@ describe('@veramo/credential-status', () => {
|
|
|
104
101
|
const agent = createAgent({
|
|
105
102
|
plugins: [
|
|
106
103
|
new CredentialStatusPlugin({
|
|
107
|
-
NotCalled: jest.fn()
|
|
104
|
+
NotCalled: jest.fn(),
|
|
108
105
|
}),
|
|
109
106
|
],
|
|
110
107
|
})
|
package/src/index.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* istanbul ignore file */
|
|
2
|
-
export { CredentialStatusPlugin } from './credential-status
|
|
2
|
+
export { CredentialStatusPlugin } from './credential-status'
|