@veramo/credential-status 3.1.6-next.158 → 3.1.6-next.163
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.d.ts +3 -4
- package/build/credential-status.d.ts.map +1 -1
- package/build/credential-status.js +12 -2
- package/build/credential-status.js.map +1 -1
- package/build/index.d.ts +0 -1
- package/build/index.d.ts.map +1 -1
- package/build/index.js +0 -15
- package/build/index.js.map +1 -1
- package/package.json +5 -9
- package/src/__tests__/credential-status.test.ts +60 -15
- package/src/credential-status.ts +30 -8
- package/src/index.ts +0 -1
- package/build/types.d.ts +0 -43
- package/build/types.d.ts.map +0 -1
- package/build/types.js +0 -3
- package/build/types.js.map +0 -1
- package/plugin.schema.json +0 -386
- package/src/types.ts +0 -48
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { IAgentPlugin } from '@veramo/core';
|
|
1
|
+
import { IAgentPlugin, ICredentialStatusVerifier } from '@veramo/core';
|
|
2
2
|
import { StatusMethod } from 'credential-status';
|
|
3
|
-
import { ICheckCredentialStatus } from './types';
|
|
4
3
|
/**
|
|
5
|
-
* This plugin implements the {@link @veramo/
|
|
4
|
+
* This plugin implements the {@link @veramo/core#ICredentialStatusVerifier | ICredentialStatusVerifier}
|
|
6
5
|
* interface.
|
|
7
6
|
*
|
|
8
7
|
* This aggregates some {@link credential-status#StatusMethod | credential status implementations} to provide a second
|
|
@@ -21,7 +20,7 @@ import { ICheckCredentialStatus } from './types';
|
|
|
21
20
|
*/
|
|
22
21
|
export declare class CredentialStatusPlugin implements IAgentPlugin {
|
|
23
22
|
private readonly status;
|
|
24
|
-
readonly methods:
|
|
23
|
+
readonly methods: ICredentialStatusVerifier;
|
|
25
24
|
constructor(registry?: Record<string, StatusMethod>);
|
|
26
25
|
private checkCredentialStatus;
|
|
27
26
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"credential-status.d.ts","sourceRoot":"","sources":["../src/credential-status.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"credential-status.d.ts","sourceRoot":"","sources":["../src/credential-status.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,YAAY,EAEZ,yBAAyB,EAE1B,MAAM,cAAc,CAAA;AAErB,OAAO,EAAU,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAExD;;;;;;;;;;;;;;;;;GAiBG;AACH,qBAAa,sBAAuB,YAAW,YAAY;IACzD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAQ;IAC/B,QAAQ,CAAC,OAAO,EAAE,yBAAyB,CAAA;gBAE/B,QAAQ,GAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAM;YAOzC,qBAAqB;CAmBpC"}
|
|
@@ -10,9 +10,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.CredentialStatusPlugin = void 0;
|
|
13
|
+
const utils_1 = require("@veramo/utils");
|
|
13
14
|
const credential_status_1 = require("credential-status");
|
|
14
15
|
/**
|
|
15
|
-
* This plugin implements the {@link @veramo/
|
|
16
|
+
* This plugin implements the {@link @veramo/core#ICredentialStatusVerifier | ICredentialStatusVerifier}
|
|
16
17
|
* interface.
|
|
17
18
|
*
|
|
18
19
|
* This aggregates some {@link credential-status#StatusMethod | credential status implementations} to provide a second
|
|
@@ -38,7 +39,16 @@ class CredentialStatusPlugin {
|
|
|
38
39
|
}
|
|
39
40
|
checkCredentialStatus(args, context) {
|
|
40
41
|
return __awaiter(this, void 0, void 0, function* () {
|
|
41
|
-
|
|
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;
|
|
42
52
|
});
|
|
43
53
|
}
|
|
44
54
|
}
|
|
@@ -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,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
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,qBAAqB,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,22 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
3
|
exports.CredentialStatusPlugin = void 0;
|
|
18
4
|
/* istanbul ignore file */
|
|
19
5
|
var credential_status_1 = require("./credential-status");
|
|
20
6
|
Object.defineProperty(exports, "CredentialStatusPlugin", { enumerable: true, get: function () { return credential_status_1.CredentialStatusPlugin; } });
|
|
21
|
-
__exportStar(require("./types"), exports);
|
|
22
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":"
|
|
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,20 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@veramo/credential-status",
|
|
3
3
|
"description": "Veramo plugin for resolving a credential status",
|
|
4
|
-
"version": "3.1.6-next.
|
|
4
|
+
"version": "3.1.6-next.163+a110e966",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"build": "tsc",
|
|
9
|
-
"
|
|
10
|
-
},
|
|
11
|
-
"veramo": {
|
|
12
|
-
"pluginInterfaces": {
|
|
13
|
-
"ICheckCredentialStatus": "./src/types.ts"
|
|
14
|
-
}
|
|
9
|
+
"extract-api": "yarn veramo dev extract-api"
|
|
15
10
|
},
|
|
16
11
|
"dependencies": {
|
|
17
|
-
"@veramo/core": "^3.1.6-next.
|
|
12
|
+
"@veramo/core": "^3.1.6-next.163+a110e966",
|
|
13
|
+
"@veramo/utils": "^3.1.6-next.163+a110e966",
|
|
18
14
|
"credential-status": "^2.0.3",
|
|
19
15
|
"did-jwt": "^6.2.0",
|
|
20
16
|
"did-resolver": "^3.2.2"
|
|
@@ -38,5 +34,5 @@
|
|
|
38
34
|
"contributors": [],
|
|
39
35
|
"license": "Apache-2.0",
|
|
40
36
|
"keywords": [],
|
|
41
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "a110e96655c940bc8432c040c078a295e5a1fc79"
|
|
42
38
|
}
|
|
@@ -1,40 +1,80 @@
|
|
|
1
|
-
import { createAgent } from '../../../core/src'
|
|
1
|
+
import { createAgent, ICredentialStatusVerifier, VerifiableCredential } from '../../../core/src'
|
|
2
|
+
import { DIDResolverPlugin } from '../../../did-resolver/src'
|
|
2
3
|
import { CredentialStatusPlugin } from '../credential-status'
|
|
3
|
-
import { DIDDocument } from 'did-resolver'
|
|
4
|
+
import { DIDDocument, DIDResolutionOptions, DIDResolutionResult, Resolvable } from 'did-resolver'
|
|
4
5
|
|
|
5
6
|
describe('@veramo/credential-status', () => {
|
|
6
|
-
const
|
|
7
|
+
const referenceDoc: DIDDocument = { id: 'did:example:1234' }
|
|
8
|
+
const referenceCredential: VerifiableCredential = {
|
|
9
|
+
'@context': [],
|
|
10
|
+
issuanceDate: new Date().toISOString(),
|
|
11
|
+
proof: {},
|
|
12
|
+
issuer: referenceDoc.id,
|
|
13
|
+
credentialSubject: {},
|
|
7
14
|
credentialStatus: {
|
|
8
15
|
type: 'ExoticStatusMethod2022',
|
|
9
16
|
id: 'some-exotic-id',
|
|
10
17
|
},
|
|
11
18
|
}
|
|
12
|
-
const referenceDoc = {} as DIDDocument
|
|
13
19
|
|
|
14
20
|
it('should check the credential status', async () => {
|
|
15
|
-
expect.assertions(3)
|
|
16
|
-
const expectedResult = {}
|
|
21
|
+
expect.assertions(3)
|
|
22
|
+
const expectedResult = { revoked: false }
|
|
17
23
|
const checkStatus = jest.fn(async () => expectedResult)
|
|
24
|
+
const agent = createAgent<ICredentialStatusVerifier>({
|
|
25
|
+
plugins: [
|
|
26
|
+
new CredentialStatusPlugin({
|
|
27
|
+
ExoticStatusMethod2022: checkStatus,
|
|
28
|
+
}),
|
|
29
|
+
],
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
const result = await agent.checkCredentialStatus({
|
|
33
|
+
credential: referenceCredential,
|
|
34
|
+
didDocumentOverride: referenceDoc,
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
expect(result).toStrictEqual(expectedResult)
|
|
38
|
+
expect(checkStatus).toBeCalledTimes(1)
|
|
39
|
+
expect(checkStatus).toBeCalledWith(referenceCredential, referenceDoc)
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
it('should check the credential status using DID resolver to get the issuer doc', async () => {
|
|
43
|
+
expect.assertions(4)
|
|
44
|
+
const expectedResult = { revoked: false }
|
|
45
|
+
const checkStatus = jest.fn(async () => expectedResult)
|
|
46
|
+
const fakeResolver: Resolvable = {
|
|
47
|
+
resolve: jest.fn(
|
|
48
|
+
async (didUrl: string, options?: DIDResolutionOptions): Promise<DIDResolutionResult> => {
|
|
49
|
+
return {
|
|
50
|
+
didDocument: { id: didUrl },
|
|
51
|
+
didResolutionMetadata: {},
|
|
52
|
+
didDocumentMetadata: {},
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
),
|
|
56
|
+
}
|
|
18
57
|
const agent = createAgent({
|
|
19
58
|
plugins: [
|
|
20
59
|
new CredentialStatusPlugin({
|
|
21
60
|
ExoticStatusMethod2022: checkStatus,
|
|
22
61
|
}),
|
|
62
|
+
new DIDResolverPlugin({ resolver: fakeResolver }),
|
|
23
63
|
],
|
|
24
64
|
})
|
|
25
65
|
|
|
26
66
|
const result = await agent.checkCredentialStatus({
|
|
27
67
|
credential: referenceCredential,
|
|
28
|
-
didDoc: referenceDoc,
|
|
29
68
|
})
|
|
30
69
|
|
|
31
70
|
expect(result).toStrictEqual(expectedResult)
|
|
32
71
|
expect(checkStatus).toBeCalledTimes(1)
|
|
33
72
|
expect(checkStatus).toBeCalledWith(referenceCredential, referenceDoc)
|
|
73
|
+
expect(fakeResolver.resolve).toBeCalledTimes(1)
|
|
34
74
|
})
|
|
35
75
|
|
|
36
76
|
it('should not perform status check if no `credentialStatus` present', async () => {
|
|
37
|
-
expect.assertions(2)
|
|
77
|
+
expect.assertions(2)
|
|
38
78
|
const checkStatus = jest.fn()
|
|
39
79
|
const agent = createAgent({
|
|
40
80
|
plugins: [
|
|
@@ -46,7 +86,7 @@ describe('@veramo/credential-status', () => {
|
|
|
46
86
|
|
|
47
87
|
const result = await agent.checkCredentialStatus({
|
|
48
88
|
credential: {},
|
|
49
|
-
|
|
89
|
+
didDocumentOverride: referenceDoc,
|
|
50
90
|
})
|
|
51
91
|
|
|
52
92
|
expect(result).toEqual({
|
|
@@ -57,17 +97,22 @@ describe('@veramo/credential-status', () => {
|
|
|
57
97
|
})
|
|
58
98
|
|
|
59
99
|
it('should throw if unknown status check was provided', async () => {
|
|
60
|
-
expect.assertions(1)
|
|
100
|
+
expect.assertions(1)
|
|
61
101
|
const agent = createAgent({
|
|
62
102
|
plugins: [
|
|
63
103
|
new CredentialStatusPlugin({
|
|
64
|
-
NotCalled: jest.fn()
|
|
65
|
-
})
|
|
104
|
+
NotCalled: jest.fn(),
|
|
105
|
+
}),
|
|
66
106
|
],
|
|
67
107
|
})
|
|
68
108
|
|
|
69
|
-
await expect(
|
|
70
|
-
|
|
71
|
-
|
|
109
|
+
await expect(
|
|
110
|
+
agent.checkCredentialStatus({
|
|
111
|
+
credential: referenceCredential,
|
|
112
|
+
didDocumentOverride: referenceDoc,
|
|
113
|
+
}),
|
|
114
|
+
).rejects.toThrow(
|
|
115
|
+
`unknown_method: credentialStatus method ExoticStatusMethod2022 unknown. Validity can not be determined.`,
|
|
116
|
+
)
|
|
72
117
|
})
|
|
73
118
|
})
|
package/src/credential-status.ts
CHANGED
|
@@ -1,9 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import {
|
|
2
|
+
CredentialStatus,
|
|
3
|
+
IAgentContext,
|
|
4
|
+
IAgentPlugin,
|
|
5
|
+
ICheckCredentialStatusArgs,
|
|
6
|
+
ICredentialStatusVerifier,
|
|
7
|
+
IResolver,
|
|
8
|
+
} from '@veramo/core'
|
|
9
|
+
import { extractIssuer, isDefined, resolveDidOrThrow } from '@veramo/utils'
|
|
10
|
+
import { Status, StatusMethod } from 'credential-status'
|
|
4
11
|
|
|
5
12
|
/**
|
|
6
|
-
* This plugin implements the {@link @veramo/
|
|
13
|
+
* This plugin implements the {@link @veramo/core#ICredentialStatusVerifier | ICredentialStatusVerifier}
|
|
7
14
|
* interface.
|
|
8
15
|
*
|
|
9
16
|
* This aggregates some {@link credential-status#StatusMethod | credential status implementations} to provide a second
|
|
@@ -22,7 +29,7 @@ import { ICheckCredentialStatus, ICheckCredentialStatusArgs } from './types'
|
|
|
22
29
|
*/
|
|
23
30
|
export class CredentialStatusPlugin implements IAgentPlugin {
|
|
24
31
|
private readonly status: Status
|
|
25
|
-
readonly methods:
|
|
32
|
+
readonly methods: ICredentialStatusVerifier
|
|
26
33
|
|
|
27
34
|
constructor(registry: Record<string, StatusMethod> = {}) {
|
|
28
35
|
this.status = new Status(registry)
|
|
@@ -31,8 +38,23 @@ export class CredentialStatusPlugin implements IAgentPlugin {
|
|
|
31
38
|
}
|
|
32
39
|
}
|
|
33
40
|
|
|
34
|
-
private async checkCredentialStatus(args: ICheckCredentialStatusArgs, context: IAgentContext<
|
|
35
|
-
|
|
41
|
+
private async checkCredentialStatus(args: ICheckCredentialStatusArgs, context: IAgentContext<IResolver>) {
|
|
42
|
+
let didDoc = args.didDocumentOverride
|
|
43
|
+
if (!didDoc) {
|
|
44
|
+
const issuerDid = extractIssuer(args.credential)
|
|
45
|
+
didDoc = await resolveDidOrThrow(issuerDid, context)
|
|
46
|
+
}
|
|
47
|
+
const statusCheck: CredentialStatus = (await this.status.checkStatus(
|
|
48
|
+
args.credential,
|
|
49
|
+
didDoc,
|
|
50
|
+
)) as CredentialStatus
|
|
51
|
+
if (!isDefined(statusCheck.revoked)) {
|
|
52
|
+
throw new Error(
|
|
53
|
+
`invalid_result: 'revoked' property missing. The Credential Status verification resulted in an ambiguous result: ${JSON.stringify(
|
|
54
|
+
statusCheck,
|
|
55
|
+
)}`,
|
|
56
|
+
)
|
|
57
|
+
}
|
|
58
|
+
return statusCheck
|
|
36
59
|
}
|
|
37
60
|
}
|
|
38
|
-
|
package/src/index.ts
CHANGED
package/build/types.d.ts
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { IAgentContext, IPluginMethodMap, VerifiableCredential } from '@veramo/core';
|
|
2
|
-
import { CredentialStatus } from 'credential-status';
|
|
3
|
-
import { DIDDocument } from 'did-resolver';
|
|
4
|
-
/**
|
|
5
|
-
* Arguments for calling {@link ICheckCredentialStatus.checkCredentialStatus | checkCredentialStatus}.
|
|
6
|
-
*
|
|
7
|
-
* The credential whose status should be checked and the DID document of the credential issuer.
|
|
8
|
-
*
|
|
9
|
-
* See {@link https://www.w3.org/TR/vc-data-model/#status | Credential Status}
|
|
10
|
-
*
|
|
11
|
-
* @beta This API may change without a BREAKING CHANGE notice.
|
|
12
|
-
*/
|
|
13
|
-
export interface ICheckCredentialStatusArgs {
|
|
14
|
-
credential: VerifiableCredential;
|
|
15
|
-
didDoc: DIDDocument;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* This interface defines a plugin that can check the {@link https://www.w3.org/TR/vc-data-model/#status | status} of a
|
|
19
|
-
* {@link @veramo/core#VerifiableCredential | Verifiable Credential}.
|
|
20
|
-
*
|
|
21
|
-
* This is used for the discovery of information about the current status of a verifiable credential, such as whether
|
|
22
|
-
* it is suspended or revoked. The precise contents of the credential status information is determined by the specific
|
|
23
|
-
* `credentialStatus` type definition, and varies depending on factors such as whether it is simple to implement or if
|
|
24
|
-
* it is privacy-enhancing.
|
|
25
|
-
*
|
|
26
|
-
* The result provided by implementations of this plugin depend on whether the implementation of the StatusMethod is
|
|
27
|
-
* available.
|
|
28
|
-
*
|
|
29
|
-
* @see {@link https://www.w3.org/TR/vc-data-model/#status | Credential Status} for data model documentation.
|
|
30
|
-
* @see {@link @veramo/credential-status#CredentialStatusPlugin | CredentialStatusPlugin } for an implementation.
|
|
31
|
-
*
|
|
32
|
-
* @beta This API may change without a BREAKING CHANGE notice.
|
|
33
|
-
*/
|
|
34
|
-
export interface ICheckCredentialStatus extends IPluginMethodMap {
|
|
35
|
-
/**
|
|
36
|
-
* Checks the status of a {@link @veramo/core#VerifiableCredential | Verifiable Credential}.
|
|
37
|
-
*
|
|
38
|
-
* @param args - The credential to be checked, along with the DID document of the issuer.
|
|
39
|
-
* @param context - *RESERVED* This is filled by the framework when the method is called.
|
|
40
|
-
*/
|
|
41
|
-
checkCredentialStatus(args: ICheckCredentialStatusArgs, context: IAgentContext<any>): Promise<CredentialStatus>;
|
|
42
|
-
}
|
|
43
|
-
//# sourceMappingURL=types.d.ts.map
|
package/build/types.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAA;AACpF,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAE1C;;;;;;;;GAQG;AACH,MAAM,WAAW,0BAA0B;IACzC,UAAU,EAAE,oBAAoB,CAAA;IAChC,MAAM,EAAE,WAAW,CAAA;CACpB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,WAAW,sBAAuB,SAAQ,gBAAgB;IAE9D;;;;;OAKG;IACH,qBAAqB,CACnB,IAAI,EAAE,0BAA0B,EAChC,OAAO,EAAE,aAAa,CAAC,GAAG,CAAC,GAC1B,OAAO,CAAC,gBAAgB,CAAC,CAAA;CAC7B"}
|
package/build/types.js
DELETED
package/build/types.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|
package/plugin.schema.json
DELETED
|
@@ -1,386 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"ICheckCredentialStatus": {
|
|
3
|
-
"components": {
|
|
4
|
-
"schemas": {
|
|
5
|
-
"ICheckCredentialStatusArgs": {
|
|
6
|
-
"type": "object",
|
|
7
|
-
"properties": {
|
|
8
|
-
"credential": {
|
|
9
|
-
"$ref": "#/components/schemas/VerifiableCredential"
|
|
10
|
-
},
|
|
11
|
-
"didDoc": {
|
|
12
|
-
"$ref": "#/components/schemas/DIDDocument"
|
|
13
|
-
}
|
|
14
|
-
},
|
|
15
|
-
"required": [
|
|
16
|
-
"credential",
|
|
17
|
-
"didDoc"
|
|
18
|
-
],
|
|
19
|
-
"description": "Arguments for calling {@link ICheckCredentialStatus.checkCredentialStatus | checkCredentialStatus } .\n\nThe credential whose status should be checked and the DID document of the credential issuer.\n\nSee {@link https://www.w3.org/TR/vc-data-model/#status | Credential Status }"
|
|
20
|
-
},
|
|
21
|
-
"VerifiableCredential": {
|
|
22
|
-
"type": "object",
|
|
23
|
-
"properties": {
|
|
24
|
-
"proof": {
|
|
25
|
-
"$ref": "#/components/schemas/ProofType"
|
|
26
|
-
},
|
|
27
|
-
"issuer": {
|
|
28
|
-
"$ref": "#/components/schemas/IssuerType"
|
|
29
|
-
},
|
|
30
|
-
"credentialSubject": {
|
|
31
|
-
"$ref": "#/components/schemas/CredentialSubject"
|
|
32
|
-
},
|
|
33
|
-
"type": {
|
|
34
|
-
"anyOf": [
|
|
35
|
-
{
|
|
36
|
-
"type": "array",
|
|
37
|
-
"items": {
|
|
38
|
-
"type": "string"
|
|
39
|
-
}
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
"type": "string"
|
|
43
|
-
}
|
|
44
|
-
]
|
|
45
|
-
},
|
|
46
|
-
"@context": {
|
|
47
|
-
"anyOf": [
|
|
48
|
-
{
|
|
49
|
-
"type": "array",
|
|
50
|
-
"items": {
|
|
51
|
-
"type": "string"
|
|
52
|
-
}
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
"type": "string"
|
|
56
|
-
}
|
|
57
|
-
]
|
|
58
|
-
},
|
|
59
|
-
"issuanceDate": {
|
|
60
|
-
"type": "string"
|
|
61
|
-
},
|
|
62
|
-
"expirationDate": {
|
|
63
|
-
"type": "string"
|
|
64
|
-
},
|
|
65
|
-
"credentialStatus": {
|
|
66
|
-
"$ref": "#/components/schemas/CredentialStatus"
|
|
67
|
-
},
|
|
68
|
-
"id": {
|
|
69
|
-
"type": "string"
|
|
70
|
-
}
|
|
71
|
-
},
|
|
72
|
-
"required": [
|
|
73
|
-
"@context",
|
|
74
|
-
"credentialSubject",
|
|
75
|
-
"issuanceDate",
|
|
76
|
-
"issuer",
|
|
77
|
-
"proof"
|
|
78
|
-
],
|
|
79
|
-
"description": "Represents a signed Verifiable Credential payload (includes proof), using a JSON representation. See {@link https://www.w3.org/TR/vc-data-model/#credentials | VC data model }"
|
|
80
|
-
},
|
|
81
|
-
"ProofType": {
|
|
82
|
-
"type": "object",
|
|
83
|
-
"properties": {
|
|
84
|
-
"type": {
|
|
85
|
-
"type": "string"
|
|
86
|
-
}
|
|
87
|
-
},
|
|
88
|
-
"description": "A proof property of a Verifiable Credential or Presentation"
|
|
89
|
-
},
|
|
90
|
-
"IssuerType": {
|
|
91
|
-
"anyOf": [
|
|
92
|
-
{
|
|
93
|
-
"type": "object",
|
|
94
|
-
"properties": {
|
|
95
|
-
"id": {
|
|
96
|
-
"type": "string"
|
|
97
|
-
}
|
|
98
|
-
},
|
|
99
|
-
"required": [
|
|
100
|
-
"id"
|
|
101
|
-
]
|
|
102
|
-
},
|
|
103
|
-
{
|
|
104
|
-
"type": "string"
|
|
105
|
-
}
|
|
106
|
-
],
|
|
107
|
-
"description": "The issuer of a Credential or the holder of a Presentation.\n\nThe value of the issuer property MUST be either a URI or an object containing an id property. It is RECOMMENDED that the URI in the issuer or its id be one which, if de-referenced, results in a document containing machine-readable information about the issuer that can be used to verify the information expressed in the credential.\n\nSee {@link https://www.w3.org/TR/vc-data-model/#issuer | Issuer data model }"
|
|
108
|
-
},
|
|
109
|
-
"CredentialSubject": {
|
|
110
|
-
"type": "object",
|
|
111
|
-
"properties": {
|
|
112
|
-
"id": {
|
|
113
|
-
"type": "string"
|
|
114
|
-
}
|
|
115
|
-
},
|
|
116
|
-
"description": "The value of the credentialSubject property is defined as a set of objects that contain one or more properties that are each related to a subject of the verifiable credential. Each object MAY contain an id.\n\nSee {@link https://www.w3.org/TR/vc-data-model/#credential-subject | Credential Subject }"
|
|
117
|
-
},
|
|
118
|
-
"CredentialStatus": {
|
|
119
|
-
"type": "object",
|
|
120
|
-
"properties": {
|
|
121
|
-
"id": {
|
|
122
|
-
"type": "string"
|
|
123
|
-
},
|
|
124
|
-
"type": {
|
|
125
|
-
"type": "string"
|
|
126
|
-
}
|
|
127
|
-
},
|
|
128
|
-
"required": [
|
|
129
|
-
"id",
|
|
130
|
-
"type"
|
|
131
|
-
],
|
|
132
|
-
"description": "Used for the discovery of information about the current status of a verifiable credential, such as whether it is suspended or revoked. The precise contents of the credential status information is determined by the specific `credentialStatus` type definition, and varies depending on factors such as whether it is simple to implement or if it is privacy-enhancing.\n\nSee {@link https://www.w3.org/TR/vc-data-model/#status | Credential Status }"
|
|
133
|
-
},
|
|
134
|
-
"DIDDocument": {
|
|
135
|
-
"type": "object",
|
|
136
|
-
"properties": {
|
|
137
|
-
"authentication": {
|
|
138
|
-
"type": "array",
|
|
139
|
-
"items": {
|
|
140
|
-
"anyOf": [
|
|
141
|
-
{
|
|
142
|
-
"type": "string"
|
|
143
|
-
},
|
|
144
|
-
{
|
|
145
|
-
"$ref": "#/components/schemas/VerificationMethod"
|
|
146
|
-
}
|
|
147
|
-
]
|
|
148
|
-
}
|
|
149
|
-
},
|
|
150
|
-
"assertionMethod": {
|
|
151
|
-
"type": "array",
|
|
152
|
-
"items": {
|
|
153
|
-
"anyOf": [
|
|
154
|
-
{
|
|
155
|
-
"type": "string"
|
|
156
|
-
},
|
|
157
|
-
{
|
|
158
|
-
"$ref": "#/components/schemas/VerificationMethod"
|
|
159
|
-
}
|
|
160
|
-
]
|
|
161
|
-
}
|
|
162
|
-
},
|
|
163
|
-
"keyAgreement": {
|
|
164
|
-
"type": "array",
|
|
165
|
-
"items": {
|
|
166
|
-
"anyOf": [
|
|
167
|
-
{
|
|
168
|
-
"type": "string"
|
|
169
|
-
},
|
|
170
|
-
{
|
|
171
|
-
"$ref": "#/components/schemas/VerificationMethod"
|
|
172
|
-
}
|
|
173
|
-
]
|
|
174
|
-
}
|
|
175
|
-
},
|
|
176
|
-
"capabilityInvocation": {
|
|
177
|
-
"type": "array",
|
|
178
|
-
"items": {
|
|
179
|
-
"anyOf": [
|
|
180
|
-
{
|
|
181
|
-
"type": "string"
|
|
182
|
-
},
|
|
183
|
-
{
|
|
184
|
-
"$ref": "#/components/schemas/VerificationMethod"
|
|
185
|
-
}
|
|
186
|
-
]
|
|
187
|
-
}
|
|
188
|
-
},
|
|
189
|
-
"capabilityDelegation": {
|
|
190
|
-
"type": "array",
|
|
191
|
-
"items": {
|
|
192
|
-
"anyOf": [
|
|
193
|
-
{
|
|
194
|
-
"type": "string"
|
|
195
|
-
},
|
|
196
|
-
{
|
|
197
|
-
"$ref": "#/components/schemas/VerificationMethod"
|
|
198
|
-
}
|
|
199
|
-
]
|
|
200
|
-
}
|
|
201
|
-
},
|
|
202
|
-
"@context": {
|
|
203
|
-
"anyOf": [
|
|
204
|
-
{
|
|
205
|
-
"type": "string",
|
|
206
|
-
"const": "https://www.w3.org/ns/did/v1"
|
|
207
|
-
},
|
|
208
|
-
{
|
|
209
|
-
"type": "string"
|
|
210
|
-
},
|
|
211
|
-
{
|
|
212
|
-
"type": "array",
|
|
213
|
-
"items": {
|
|
214
|
-
"type": "string"
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
]
|
|
218
|
-
},
|
|
219
|
-
"id": {
|
|
220
|
-
"type": "string"
|
|
221
|
-
},
|
|
222
|
-
"alsoKnownAs": {
|
|
223
|
-
"type": "array",
|
|
224
|
-
"items": {
|
|
225
|
-
"type": "string"
|
|
226
|
-
}
|
|
227
|
-
},
|
|
228
|
-
"controller": {
|
|
229
|
-
"anyOf": [
|
|
230
|
-
{
|
|
231
|
-
"type": "string"
|
|
232
|
-
},
|
|
233
|
-
{
|
|
234
|
-
"type": "array",
|
|
235
|
-
"items": {
|
|
236
|
-
"type": "string"
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
]
|
|
240
|
-
},
|
|
241
|
-
"verificationMethod": {
|
|
242
|
-
"type": "array",
|
|
243
|
-
"items": {
|
|
244
|
-
"$ref": "#/components/schemas/VerificationMethod"
|
|
245
|
-
}
|
|
246
|
-
},
|
|
247
|
-
"service": {
|
|
248
|
-
"type": "array",
|
|
249
|
-
"items": {
|
|
250
|
-
"$ref": "#/components/schemas/ServiceEndpoint"
|
|
251
|
-
}
|
|
252
|
-
},
|
|
253
|
-
"publicKey": {
|
|
254
|
-
"type": "array",
|
|
255
|
-
"items": {
|
|
256
|
-
"$ref": "#/components/schemas/VerificationMethod"
|
|
257
|
-
},
|
|
258
|
-
"deprecated": true
|
|
259
|
-
}
|
|
260
|
-
},
|
|
261
|
-
"required": [
|
|
262
|
-
"id"
|
|
263
|
-
]
|
|
264
|
-
},
|
|
265
|
-
"VerificationMethod": {
|
|
266
|
-
"type": "object",
|
|
267
|
-
"properties": {
|
|
268
|
-
"id": {
|
|
269
|
-
"type": "string"
|
|
270
|
-
},
|
|
271
|
-
"type": {
|
|
272
|
-
"type": "string"
|
|
273
|
-
},
|
|
274
|
-
"controller": {
|
|
275
|
-
"type": "string"
|
|
276
|
-
},
|
|
277
|
-
"publicKeyBase58": {
|
|
278
|
-
"type": "string"
|
|
279
|
-
},
|
|
280
|
-
"publicKeyBase64": {
|
|
281
|
-
"type": "string"
|
|
282
|
-
},
|
|
283
|
-
"publicKeyJwk": {
|
|
284
|
-
"$ref": "#/components/schemas/JsonWebKey"
|
|
285
|
-
},
|
|
286
|
-
"publicKeyHex": {
|
|
287
|
-
"type": "string"
|
|
288
|
-
},
|
|
289
|
-
"publicKeyMultibase": {
|
|
290
|
-
"type": "string"
|
|
291
|
-
},
|
|
292
|
-
"blockchainAccountId": {
|
|
293
|
-
"type": "string"
|
|
294
|
-
},
|
|
295
|
-
"ethereumAddress": {
|
|
296
|
-
"type": "string"
|
|
297
|
-
}
|
|
298
|
-
},
|
|
299
|
-
"required": [
|
|
300
|
-
"id",
|
|
301
|
-
"type",
|
|
302
|
-
"controller"
|
|
303
|
-
]
|
|
304
|
-
},
|
|
305
|
-
"JsonWebKey": {
|
|
306
|
-
"type": "object",
|
|
307
|
-
"properties": {
|
|
308
|
-
"alg": {
|
|
309
|
-
"type": "string"
|
|
310
|
-
},
|
|
311
|
-
"crv": {
|
|
312
|
-
"type": "string"
|
|
313
|
-
},
|
|
314
|
-
"e": {
|
|
315
|
-
"type": "string"
|
|
316
|
-
},
|
|
317
|
-
"ext": {
|
|
318
|
-
"type": "boolean"
|
|
319
|
-
},
|
|
320
|
-
"key_ops": {
|
|
321
|
-
"type": "array",
|
|
322
|
-
"items": {
|
|
323
|
-
"type": "string"
|
|
324
|
-
}
|
|
325
|
-
},
|
|
326
|
-
"kid": {
|
|
327
|
-
"type": "string"
|
|
328
|
-
},
|
|
329
|
-
"kty": {
|
|
330
|
-
"type": "string"
|
|
331
|
-
},
|
|
332
|
-
"n": {
|
|
333
|
-
"type": "string"
|
|
334
|
-
},
|
|
335
|
-
"use": {
|
|
336
|
-
"type": "string"
|
|
337
|
-
},
|
|
338
|
-
"x": {
|
|
339
|
-
"type": "string"
|
|
340
|
-
},
|
|
341
|
-
"y": {
|
|
342
|
-
"type": "string"
|
|
343
|
-
}
|
|
344
|
-
},
|
|
345
|
-
"required": [
|
|
346
|
-
"kty"
|
|
347
|
-
],
|
|
348
|
-
"description": "Encapsulates a JSON web key type that includes only the public properties that can be used in DID documents.\n\nThe private properties are intentionally omitted to discourage the use (and accidental disclosure) of private keys in DID documents."
|
|
349
|
-
},
|
|
350
|
-
"ServiceEndpoint": {
|
|
351
|
-
"type": "object",
|
|
352
|
-
"properties": {
|
|
353
|
-
"id": {
|
|
354
|
-
"type": "string"
|
|
355
|
-
},
|
|
356
|
-
"type": {
|
|
357
|
-
"type": "string"
|
|
358
|
-
},
|
|
359
|
-
"serviceEndpoint": {
|
|
360
|
-
"type": "string"
|
|
361
|
-
},
|
|
362
|
-
"description": {
|
|
363
|
-
"type": "string"
|
|
364
|
-
}
|
|
365
|
-
},
|
|
366
|
-
"required": [
|
|
367
|
-
"id",
|
|
368
|
-
"type",
|
|
369
|
-
"serviceEndpoint"
|
|
370
|
-
]
|
|
371
|
-
}
|
|
372
|
-
},
|
|
373
|
-
"methods": {
|
|
374
|
-
"checkCredentialStatus": {
|
|
375
|
-
"description": "Checks the status of a ",
|
|
376
|
-
"arguments": {
|
|
377
|
-
"$ref": "#/components/schemas/ICheckCredentialStatusArgs"
|
|
378
|
-
},
|
|
379
|
-
"returnType": {
|
|
380
|
-
"$ref": "#/components/schemas/CredentialStatus"
|
|
381
|
-
}
|
|
382
|
-
}
|
|
383
|
-
}
|
|
384
|
-
}
|
|
385
|
-
}
|
|
386
|
-
}
|
package/src/types.ts
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { IAgentContext, IPluginMethodMap, VerifiableCredential } from '@veramo/core'
|
|
2
|
-
import { CredentialStatus } from 'credential-status'
|
|
3
|
-
import { DIDDocument } from 'did-resolver'
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Arguments for calling {@link ICheckCredentialStatus.checkCredentialStatus | checkCredentialStatus}.
|
|
7
|
-
*
|
|
8
|
-
* The credential whose status should be checked and the DID document of the credential issuer.
|
|
9
|
-
*
|
|
10
|
-
* See {@link https://www.w3.org/TR/vc-data-model/#status | Credential Status}
|
|
11
|
-
*
|
|
12
|
-
* @beta This API may change without a BREAKING CHANGE notice.
|
|
13
|
-
*/
|
|
14
|
-
export interface ICheckCredentialStatusArgs {
|
|
15
|
-
credential: VerifiableCredential
|
|
16
|
-
didDoc: DIDDocument
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* This interface defines a plugin that can check the {@link https://www.w3.org/TR/vc-data-model/#status | status} of a
|
|
21
|
-
* {@link @veramo/core#VerifiableCredential | Verifiable Credential}.
|
|
22
|
-
*
|
|
23
|
-
* This is used for the discovery of information about the current status of a verifiable credential, such as whether
|
|
24
|
-
* it is suspended or revoked. The precise contents of the credential status information is determined by the specific
|
|
25
|
-
* `credentialStatus` type definition, and varies depending on factors such as whether it is simple to implement or if
|
|
26
|
-
* it is privacy-enhancing.
|
|
27
|
-
*
|
|
28
|
-
* The result provided by implementations of this plugin depend on whether the implementation of the StatusMethod is
|
|
29
|
-
* available.
|
|
30
|
-
*
|
|
31
|
-
* @see {@link https://www.w3.org/TR/vc-data-model/#status | Credential Status} for data model documentation.
|
|
32
|
-
* @see {@link @veramo/credential-status#CredentialStatusPlugin | CredentialStatusPlugin } for an implementation.
|
|
33
|
-
*
|
|
34
|
-
* @beta This API may change without a BREAKING CHANGE notice.
|
|
35
|
-
*/
|
|
36
|
-
export interface ICheckCredentialStatus extends IPluginMethodMap {
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Checks the status of a {@link @veramo/core#VerifiableCredential | Verifiable Credential}.
|
|
40
|
-
*
|
|
41
|
-
* @param args - The credential to be checked, along with the DID document of the issuer.
|
|
42
|
-
* @param context - *RESERVED* This is filled by the framework when the method is called.
|
|
43
|
-
*/
|
|
44
|
-
checkCredentialStatus(
|
|
45
|
-
args: ICheckCredentialStatusArgs,
|
|
46
|
-
context: IAgentContext<any>,
|
|
47
|
-
): Promise<CredentialStatus>
|
|
48
|
-
}
|