@veramo/credential-status 4.3.1-next.9 → 4.3.1-unstable.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.
@@ -1,5 +1,17 @@
1
- import { extractIssuer, isDefined, resolveDidOrThrow } from '@veramo/utils';
2
- import { Status } from 'credential-status';
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
- export class CredentialStatusPlugin {
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
- 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;
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,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,MA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P,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.js';
1
+ export { CredentialStatusPlugin } from './credential-status';
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,wBAAwB,CAAA"}
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
- export { CredentialStatusPlugin } from './credential-status.js';
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
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,0BAA0B;AAC1B,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,0BAA0B;AAC1B,yDAA4D;AAAnD,2HAAA,sBAAsB,OAAA"}
@@ -5,7 +5,7 @@
5
5
  "toolPackages": [
6
6
  {
7
7
  "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.33.8"
8
+ "packageVersion": "7.33.7"
9
9
  }
10
10
  ]
11
11
  }
package/package.json CHANGED
@@ -1,19 +1,18 @@
1
1
  {
2
2
  "name": "@veramo/credential-status",
3
3
  "description": "Veramo plugin for resolving a credential status",
4
- "version": "4.3.1-next.9+02873401",
4
+ "version": "4.3.1-unstable.0+7e89dddf",
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
9
  "extract-api": "node ../cli/bin/veramo.js dev extract-api"
11
10
  },
12
11
  "dependencies": {
13
- "@veramo/core": "^4.3.1-next.9+02873401",
14
- "@veramo/utils": "^4.3.1-next.9+02873401",
12
+ "@veramo/core": "^4.3.1-unstable.0+7e89dddf",
13
+ "@veramo/utils": "^4.3.1-unstable.0+7e89dddf",
15
14
  "credential-status": "^2.0.5",
16
- "did-jwt": "^6.9.0",
15
+ "did-jwt": "^6.11.6",
17
16
  "did-resolver": "^4.0.1"
18
17
  },
19
18
  "devDependencies": {
@@ -35,10 +34,5 @@
35
34
  "contributors": [],
36
35
  "license": "Apache-2.0",
37
36
  "keywords": [],
38
- "type": "module",
39
- "moduleDirectories": [
40
- "node_modules",
41
- "src"
42
- ],
43
- "gitHead": "02873401508a8a7d8c999bc12dc1d107a4a5202f"
37
+ "gitHead": "7e89dddf1043fe91b7b84ad2b2b276fdef33884d"
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.js'
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() as StatusMethod,
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.js'
2
+ export { CredentialStatusPlugin } from './credential-status'