@veramo/credential-status 4.0.1-next.8 → 4.0.1-unstable.4
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 +17 -30
- 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 +1 -5
- package/build/index.js.map +1 -1
- package/build/tsdoc-metadata.json +1 -1
- package/package.json +10 -4
- package/src/__tests__/credential-status.test.ts +5 -3
- package/src/index.ts +1 -1
|
@@ -1,17 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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");
|
|
1
|
+
import { extractIssuer, isDefined, resolveDidOrThrow } from '@veramo/utils';
|
|
2
|
+
import { Status } from 'credential-status';
|
|
15
3
|
/**
|
|
16
4
|
* This plugin implements the {@link @veramo/core#ICredentialStatusVerifier | ICredentialStatusVerifier}
|
|
17
5
|
* interface.
|
|
@@ -30,27 +18,26 @@ const credential_status_1 = require("credential-status");
|
|
|
30
18
|
*
|
|
31
19
|
* @beta This API may change without a BREAKING CHANGE notice.
|
|
32
20
|
*/
|
|
33
|
-
class CredentialStatusPlugin {
|
|
21
|
+
export class CredentialStatusPlugin {
|
|
22
|
+
status;
|
|
23
|
+
methods;
|
|
34
24
|
constructor(registry = {}) {
|
|
35
|
-
this.status = new
|
|
25
|
+
this.status = new Status(registry);
|
|
36
26
|
this.methods = {
|
|
37
27
|
checkCredentialStatus: this.checkCredentialStatus.bind(this),
|
|
38
28
|
};
|
|
39
29
|
}
|
|
40
|
-
checkCredentialStatus(args, context) {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
return statusCheck;
|
|
52
|
-
});
|
|
30
|
+
async checkCredentialStatus(args, context) {
|
|
31
|
+
let didDoc = args.didDocumentOverride;
|
|
32
|
+
if (!didDoc) {
|
|
33
|
+
const issuerDid = extractIssuer(args.credential);
|
|
34
|
+
didDoc = await resolveDidOrThrow(issuerDid, context);
|
|
35
|
+
}
|
|
36
|
+
const statusCheck = (await this.status.checkStatus(args.credential, didDoc));
|
|
37
|
+
if (!isDefined(statusCheck.revoked)) {
|
|
38
|
+
throw new Error(`invalid_result: 'revoked' property missing. The Credential Status verification resulted in an ambiguous result: ${JSON.stringify(statusCheck)}`);
|
|
39
|
+
}
|
|
40
|
+
return statusCheck;
|
|
53
41
|
}
|
|
54
42
|
}
|
|
55
|
-
exports.CredentialStatusPlugin = CredentialStatusPlugin;
|
|
56
43
|
//# sourceMappingURL=credential-status.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"credential-status.js","sourceRoot":"","sources":["../src/credential-status.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"credential-status.js","sourceRoot":"","sources":["../src/credential-status.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AAC3E,OAAO,EAAE,MAAM,EAAgB,MAAM,mBAAmB,CAAA;AAExD;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,OAAO,sBAAsB;IAChB,MAAM,CAAQ;IACtB,OAAO,CAA2B;IAE3C,YAAY,WAAyC,EAAE;QACrD,IAAI,CAAC,MAAM,GAAG,IAAI,MAAM,CAAC,QAAQ,CAAC,CAAA;QAClC,IAAI,CAAC,OAAO,GAAG;YACb,qBAAqB,EAAE,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,IAAI,CAAC;SAC7D,CAAA;IACH,CAAC;IAEO,KAAK,CAAC,qBAAqB,CAAC,IAAgC,EAAE,OAAiC;QACrG,IAAI,MAAM,GAAG,IAAI,CAAC,mBAAmB,CAAA;QACrC,IAAI,CAAC,MAAM,EAAE;YACX,MAAM,SAAS,GAAG,aAAa,CAAC,IAAI,CAAC,UAAU,CAAC,CAAA;YAChD,MAAM,GAAG,MAAM,iBAAiB,CAAC,SAAS,EAAE,OAAO,CAAC,CAAA;SACrD;QACD,MAAM,WAAW,GAAqB,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,WAAW,CAClE,IAAI,CAAC,UAAU,EACf,MAAM,CACP,CAAqB,CAAA;QACtB,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,OAAO,CAAC,EAAE;YACnC,MAAM,IAAI,KAAK,CACb,mHAAmH,IAAI,CAAC,SAAS,CAC/H,WAAW,CACZ,EAAE,CACJ,CAAA;SACF;QACD,OAAO,WAAW,CAAA;IACpB,CAAC;CACF"}
|
package/build/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { CredentialStatusPlugin } from './credential-status';
|
|
1
|
+
export { CredentialStatusPlugin } from './credential-status.js';
|
|
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,wBAAwB,CAAA"}
|
package/build/index.js
CHANGED
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CredentialStatusPlugin = void 0;
|
|
4
1
|
/* istanbul ignore file */
|
|
5
|
-
|
|
6
|
-
Object.defineProperty(exports, "CredentialStatusPlugin", { enumerable: true, get: function () { return credential_status_1.CredentialStatusPlugin; } });
|
|
2
|
+
export { CredentialStatusPlugin } from './credential-status.js';
|
|
7
3
|
//# 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":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,0BAA0B;AAC1B,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@veramo/credential-status",
|
|
3
3
|
"description": "Veramo plugin for resolving a credential status",
|
|
4
|
-
"version": "4.0.1-
|
|
4
|
+
"version": "4.0.1-unstable.4+a20894d6",
|
|
5
5
|
"main": "build/index.js",
|
|
6
|
+
"exports": "./build/index.js",
|
|
6
7
|
"types": "build/index.d.ts",
|
|
7
8
|
"scripts": {
|
|
8
9
|
"build": "tsc",
|
|
9
10
|
"extract-api": "yarn veramo dev extract-api"
|
|
10
11
|
},
|
|
11
12
|
"dependencies": {
|
|
12
|
-
"@veramo/core": "^4.0.1-
|
|
13
|
-
"@veramo/utils": "^4.0.1-
|
|
13
|
+
"@veramo/core": "^4.0.1-unstable.4+a20894d6",
|
|
14
|
+
"@veramo/utils": "^4.0.1-unstable.4+a20894d6",
|
|
14
15
|
"credential-status": "^2.0.5",
|
|
15
16
|
"did-jwt": "^6.6.0",
|
|
16
17
|
"did-resolver": "^4.0.0"
|
|
@@ -34,5 +35,10 @@
|
|
|
34
35
|
"contributors": [],
|
|
35
36
|
"license": "Apache-2.0",
|
|
36
37
|
"keywords": [],
|
|
37
|
-
"
|
|
38
|
+
"type": "module",
|
|
39
|
+
"moduleDirectories": [
|
|
40
|
+
"node_modules",
|
|
41
|
+
"src"
|
|
42
|
+
],
|
|
43
|
+
"gitHead": "a20894d60b23ab098391dd9d8ff6f96474081dc5"
|
|
38
44
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { createAgent, ICredentialStatusVerifier, VerifiableCredential } from '../../../core/
|
|
2
|
-
import { DIDResolverPlugin } from '../../../did-resolver/
|
|
3
|
-
import { CredentialStatusPlugin } from '
|
|
1
|
+
import { createAgent, ICredentialStatusVerifier, VerifiableCredential } from '../../../core/build/index.js'
|
|
2
|
+
import { DIDResolverPlugin } from '../../../did-resolver/build/index.js'
|
|
3
|
+
import { CredentialStatusPlugin } from '../../build/credential-status.js'
|
|
4
4
|
import { DIDDocument, DIDResolutionOptions, DIDResolutionResult, Resolvable } from 'did-resolver'
|
|
5
|
+
import { jest } from '@jest/globals'
|
|
5
6
|
|
|
6
7
|
describe('@veramo/credential-status', () => {
|
|
7
8
|
const referenceDoc: DIDDocument = { id: 'did:example:1234' }
|
|
@@ -79,6 +80,7 @@ describe('@veramo/credential-status', () => {
|
|
|
79
80
|
const agent = createAgent({
|
|
80
81
|
plugins: [
|
|
81
82
|
new CredentialStatusPlugin({
|
|
83
|
+
// @ts-ignore
|
|
82
84
|
ExoticStatusMethod2022: checkStatus,
|
|
83
85
|
}),
|
|
84
86
|
],
|
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.js'
|