@veramo/credential-status 4.3.1-next.4 → 4.3.1-next.9

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.
@@ -1,17 +1,5 @@
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");
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 credential_status_1.Status(registry);
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
- 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
- });
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":";;;;;;;;;;;;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,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U,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
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAA"}
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
- var credential_status_1 = require("./credential-status");
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
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,0BAA0B;AAC1B,yDAA4D;AAAnD,2HAAA,sBAAsB,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,0BAA0B;AAC1B,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAA"}
@@ -5,7 +5,7 @@
5
5
  "toolPackages": [
6
6
  {
7
7
  "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.34.0"
8
+ "packageVersion": "7.33.8"
9
9
  }
10
10
  ]
11
11
  }
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.3.1-next.4+1c521a67",
4
+ "version": "4.3.1-next.9+02873401",
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
- "extract-api": "pnpm exec veramo dev extract-api"
10
+ "extract-api": "node ../cli/bin/veramo.js dev extract-api"
10
11
  },
11
12
  "dependencies": {
12
- "@veramo/core": "^4.3.1-next.4+1c521a67",
13
- "@veramo/utils": "^4.3.1-next.4+1c521a67",
13
+ "@veramo/core": "^4.3.1-next.9+02873401",
14
+ "@veramo/utils": "^4.3.1-next.9+02873401",
14
15
  "credential-status": "^2.0.5",
15
16
  "did-jwt": "^6.9.0",
16
17
  "did-resolver": "^4.0.1"
@@ -34,5 +35,10 @@
34
35
  "contributors": [],
35
36
  "license": "Apache-2.0",
36
37
  "keywords": [],
37
- "gitHead": "1c521a6745756649028504ab239e3458462dfe37"
38
+ "type": "module",
39
+ "moduleDirectories": [
40
+ "node_modules",
41
+ "src"
42
+ ],
43
+ "gitHead": "02873401508a8a7d8c999bc12dc1d107a4a5202f"
38
44
  }
@@ -1,7 +1,9 @@
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.js'
4
4
  import { DIDDocument, DIDResolutionOptions, DIDResolutionResult, Resolvable } from 'did-resolver'
5
+ import { StatusMethod } from "credential-status";
6
+ import { jest } from '@jest/globals'
5
7
 
6
8
  describe('@veramo/credential-status', () => {
7
9
  const referenceDoc: DIDDocument = { id: 'did:example:1234' }
@@ -79,6 +81,7 @@ describe('@veramo/credential-status', () => {
79
81
  const agent = createAgent({
80
82
  plugins: [
81
83
  new CredentialStatusPlugin({
84
+ // @ts-ignore
82
85
  ExoticStatusMethod2022: checkStatus,
83
86
  }),
84
87
  ],
@@ -101,7 +104,7 @@ describe('@veramo/credential-status', () => {
101
104
  const agent = createAgent({
102
105
  plugins: [
103
106
  new CredentialStatusPlugin({
104
- NotCalled: jest.fn(),
107
+ NotCalled: jest.fn() as StatusMethod,
105
108
  }),
106
109
  ],
107
110
  })
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'