@sphereon/ssi-sdk.w3c-vc-api-verifier-rest-client 0.33.1-feature.vcdm2.tsup.31 → 0.33.1-next.2

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.
@@ -0,0 +1,14 @@
1
+ import { IAgentPlugin } from '@veramo/core';
2
+ import { IVcApiVerifierClient, IVcApiVerifierArgs } from '../types/IVcApiVerifierClient';
3
+ /**
4
+ * {@inheritDoc IVcApiVerifier}
5
+ */
6
+ export declare class VcApiVerifierClient implements IAgentPlugin {
7
+ readonly schema: any;
8
+ readonly methods: IVcApiVerifierClient;
9
+ private readonly verifyUrl;
10
+ constructor(options: IVcApiVerifierArgs);
11
+ /** {@inheritDoc IVcApiVerifier.vcApiClientVerifyCredential} */
12
+ private vcApiClientVerifyCredential;
13
+ }
14
+ //# sourceMappingURL=VcApiVerifierClient.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"VcApiVerifierClient.d.ts","sourceRoot":"","sources":["../../src/agent/VcApiVerifierClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAG3C,OAAO,EAGL,oBAAoB,EACpB,kBAAkB,EAGnB,MAAM,+BAA+B,CAAA;AAItC;;GAEG;AACH,qBAAa,mBAAoB,YAAW,YAAY;IACtD,QAAQ,CAAC,MAAM,MAAwC;IACvD,QAAQ,CAAC,OAAO,EAAE,oBAAoB,CAErC;IACD,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAQ;gBAEtB,OAAO,EAAE,kBAAkB;IAIvC,+DAA+D;YACjD,2BAA2B;CAqB1C"}
@@ -0,0 +1,54 @@
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.VcApiVerifierClient = void 0;
13
+ const index_1 = require("../index");
14
+ const IVcApiVerifierClient_1 = require("../types/IVcApiVerifierClient");
15
+ const cross_fetch_1 = require("cross-fetch");
16
+ /**
17
+ * {@inheritDoc IVcApiVerifier}
18
+ */
19
+ class VcApiVerifierClient {
20
+ constructor(options) {
21
+ this.schema = index_1.schema.IVcApiVerfierClientAgentPlugin;
22
+ this.methods = {
23
+ vcApiClientVerifyCredential: this.vcApiClientVerifyCredential.bind(this),
24
+ };
25
+ this.verifyUrl = options.verifyUrl;
26
+ }
27
+ /** {@inheritDoc IVcApiVerifier.vcApiClientVerifyCredential} */
28
+ vcApiClientVerifyCredential(args, context) {
29
+ return __awaiter(this, void 0, void 0, function* () {
30
+ return yield (0, cross_fetch_1.fetch)(this.verifyUrl, {
31
+ method: 'post',
32
+ headers: {
33
+ Accept: 'application/json',
34
+ 'Content-Type': 'application/json',
35
+ },
36
+ body: JSON.stringify({ verifiableCredential: args.credential }),
37
+ })
38
+ .then((response) => __awaiter(this, void 0, void 0, function* () {
39
+ if (response.status >= 400) {
40
+ throw new Error(yield response.text());
41
+ }
42
+ else {
43
+ return response.json();
44
+ }
45
+ }))
46
+ .then((verificationResult) => __awaiter(this, void 0, void 0, function* () {
47
+ yield context.agent.emit(IVcApiVerifierClient_1.events.CREDENTIAL_VERIFIED, verificationResult);
48
+ return verificationResult;
49
+ }));
50
+ });
51
+ }
52
+ }
53
+ exports.VcApiVerifierClient = VcApiVerifierClient;
54
+ //# sourceMappingURL=VcApiVerifierClient.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"VcApiVerifierClient.js","sourceRoot":"","sources":["../../src/agent/Vc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1,39 +1,8 @@
1
- import { IPluginMethodMap, CredentialPayload, IAgentContext, IAgentPlugin } from '@veramo/core';
2
-
3
- interface IVcApiVerifierClient extends IPluginMethodMap {
4
- vcApiClientVerifyCredential(args: IVerifyCredentialArgs, context: IRequiredContext): Promise<IVerifyCredentialResult>;
5
- }
6
- interface IVcApiVerifierArgs {
7
- verifyUrl: string;
8
- }
9
- interface IVerifyCredentialArgs {
10
- credential: CredentialPayload;
11
- }
12
- interface IVerifyCredentialResult {
13
- checks: string[];
14
- errors: string[];
15
- warnings: string[];
16
- }
17
- declare enum events {
18
- CREDENTIAL_VERIFIED = "credentialVerified"
19
- }
20
- type IRequiredContext = IAgentContext<Record<string, never>>;
21
-
22
- /**
23
- * {@inheritDoc IVcApiVerifier}
24
- */
25
- declare class VcApiVerifierClient implements IAgentPlugin {
26
- readonly schema: any;
27
- readonly methods: IVcApiVerifierClient;
28
- private readonly verifyUrl;
29
- constructor(options: IVcApiVerifierArgs);
30
- /** {@inheritDoc IVcApiVerifier.vcApiClientVerifyCredential} */
31
- private vcApiClientVerifyCredential;
32
- }
33
-
34
1
  /**
35
2
  * @public
36
3
  */
37
4
  declare const schema: any;
38
-
39
- export { type IRequiredContext, type IVcApiVerifierArgs, type IVcApiVerifierClient, type IVerifyCredentialArgs, type IVerifyCredentialResult, VcApiVerifierClient, events, schema };
5
+ export { schema };
6
+ export { VcApiVerifierClient } from './agent/VcApiVerifierClient';
7
+ export * from './types/IVcApiVerifierClient';
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,QAAA,MAAM,MAAM,KAAmC,CAAA;AAC/C,OAAO,EAAE,MAAM,EAAE,CAAA;AACjB,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAA;AACjE,cAAc,8BAA8B,CAAA"}
package/dist/index.js CHANGED
@@ -1,218 +1,26 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropNames = Object.getOwnPropertyNames;
3
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
4
- var __commonJS = (cb, mod) => function __require() {
5
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
6
- };
7
-
8
- // plugin.schema.json
9
- var require_plugin_schema = __commonJS({
10
- "plugin.schema.json"(exports, module) {
11
- module.exports = {
12
- IVcApiVerifierClient: {
13
- components: {
14
- schemas: {
15
- IVerifyCredentialArgs: {
16
- type: "object",
17
- properties: {
18
- credential: {
19
- $ref: "#/components/schemas/CredentialPayload"
20
- }
21
- },
22
- required: [
23
- "credential"
24
- ]
25
- },
26
- CredentialPayload: {
27
- type: "object",
28
- properties: {
29
- issuer: {
30
- $ref: "#/components/schemas/IssuerType"
31
- },
32
- credentialSubject: {
33
- $ref: "#/components/schemas/CredentialSubject"
34
- },
35
- type: {
36
- type: "array",
37
- items: {
38
- type: "string"
39
- }
40
- },
41
- "@context": {
42
- type: "array",
43
- items: {
44
- type: "string"
45
- }
46
- },
47
- issuanceDate: {
48
- $ref: "#/components/schemas/DateType"
49
- },
50
- expirationDate: {
51
- $ref: "#/components/schemas/DateType"
52
- },
53
- credentialStatus: {
54
- $ref: "#/components/schemas/CredentialStatusReference"
55
- },
56
- id: {
57
- type: "string"
58
- }
59
- },
60
- required: [
61
- "issuer"
62
- ],
63
- description: "Used as input when creating Verifiable Credentials"
64
- },
65
- IssuerType: {
66
- anyOf: [
67
- {
68
- type: "object",
69
- properties: {
70
- id: {
71
- type: "string"
72
- }
73
- },
74
- required: [
75
- "id"
76
- ]
77
- },
78
- {
79
- type: "string"
80
- }
81
- ],
82
- description: "The issuer of a {@link VerifiableCredential } or the holder of a {@link VerifiablePresentation } .\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 }"
83
- },
84
- CredentialSubject: {
85
- type: "object",
86
- properties: {
87
- id: {
88
- type: "string"
89
- }
90
- },
91
- 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 }"
92
- },
93
- DateType: {
94
- anyOf: [
95
- {
96
- type: "string"
97
- },
98
- {
99
- type: "string",
100
- format: "date-time"
101
- }
102
- ],
103
- description: "Represents an issuance or expiration date for Credentials / Presentations. This is used as input when creating them."
104
- },
105
- CredentialStatusReference: {
106
- type: "object",
107
- properties: {
108
- id: {
109
- type: "string"
110
- },
111
- type: {
112
- type: "string"
113
- }
114
- },
115
- required: [
116
- "id",
117
- "type"
118
- ],
119
- 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 }"
120
- },
121
- IVerifyCredentialResult: {
122
- type: "object",
123
- properties: {
124
- checks: {
125
- type: "array",
126
- items: {
127
- type: "string"
128
- }
129
- },
130
- errors: {
131
- type: "array",
132
- items: {
133
- type: "string"
134
- }
135
- },
136
- warnings: {
137
- type: "array",
138
- items: {
139
- type: "string"
140
- }
141
- }
142
- },
143
- required: [
144
- "checks",
145
- "errors",
146
- "warnings"
147
- ]
148
- }
149
- },
150
- methods: {
151
- vcApiClientVerifyCredential: {
152
- description: "",
153
- arguments: {
154
- $ref: "#/components/schemas/IVerifyCredentialArgs"
155
- },
156
- returnType: {
157
- $ref: "#/components/schemas/IVerifyCredentialResult"
158
- }
159
- }
160
- }
161
- }
162
- }
163
- };
164
- }
165
- });
166
-
167
- // src/types/IVcApiVerifierClient.ts
168
- var events = /* @__PURE__ */ function(events2) {
169
- events2["CREDENTIAL_VERIFIED"] = "credentialVerified";
170
- return events2;
171
- }({});
172
-
173
- // src/agent/VcApiVerifierClient.ts
174
- import { fetch } from "cross-fetch";
175
- var VcApiVerifierClient = class {
176
- static {
177
- __name(this, "VcApiVerifierClient");
178
- }
179
- schema = schema.IVcApiVerfierClientAgentPlugin;
180
- methods = {
181
- vcApiClientVerifyCredential: this.vcApiClientVerifyCredential.bind(this)
182
- };
183
- verifyUrl;
184
- constructor(options) {
185
- this.verifyUrl = options.verifyUrl;
186
- }
187
- /** {@inheritDoc IVcApiVerifier.vcApiClientVerifyCredential} */
188
- async vcApiClientVerifyCredential(args, context) {
189
- return await fetch(this.verifyUrl, {
190
- method: "post",
191
- headers: {
192
- Accept: "application/json",
193
- "Content-Type": "application/json"
194
- },
195
- body: JSON.stringify({
196
- verifiableCredential: args.credential
197
- })
198
- }).then(async (response) => {
199
- if (response.status >= 400) {
200
- throw new Error(await response.text());
201
- } else {
202
- return response.json();
203
- }
204
- }).then(async (verificationResult) => {
205
- await context.agent.emit(events.CREDENTIAL_VERIFIED, verificationResult);
206
- return verificationResult;
207
- });
208
- }
209
- };
210
-
211
- // src/index.ts
212
- var schema = require_plugin_schema();
213
- export {
214
- VcApiVerifierClient,
215
- events,
216
- schema
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);
217
15
  };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.VcApiVerifierClient = exports.schema = void 0;
18
+ /**
19
+ * @public
20
+ */
21
+ const schema = require('../plugin.schema.json');
22
+ exports.schema = schema;
23
+ var VcApiVerifierClient_1 = require("./agent/VcApiVerifierClient");
24
+ Object.defineProperty(exports, "VcApiVerifierClient", { enumerable: true, get: function () { return VcApiVerifierClient_1.VcApiVerifierClient; } });
25
+ __exportStar(require("./types/IVcApiVerifierClient"), exports);
218
26
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../plugin.schema.json","../src/types/IVcApiVerifierClient.ts","../src/agent/VcApiVerifierClient.ts","../src/index.ts"],"sourcesContent":["{\n \"IVcApiVerifierClient\": {\n \"components\": {\n \"schemas\": {\n \"IVerifyCredentialArgs\": {\n \"type\": \"object\",\n \"properties\": {\n \"credential\": {\n \"$ref\": \"#/components/schemas/CredentialPayload\"\n }\n },\n \"required\": [\n \"credential\"\n ]\n },\n \"CredentialPayload\": {\n \"type\": \"object\",\n \"properties\": {\n \"issuer\": {\n \"$ref\": \"#/components/schemas/IssuerType\"\n },\n \"credentialSubject\": {\n \"$ref\": \"#/components/schemas/CredentialSubject\"\n },\n \"type\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n }\n },\n \"@context\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n }\n },\n \"issuanceDate\": {\n \"$ref\": \"#/components/schemas/DateType\"\n },\n \"expirationDate\": {\n \"$ref\": \"#/components/schemas/DateType\"\n },\n \"credentialStatus\": {\n \"$ref\": \"#/components/schemas/CredentialStatusReference\"\n },\n \"id\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"issuer\"\n ],\n \"description\": \"Used as input when creating Verifiable Credentials\"\n },\n \"IssuerType\": {\n \"anyOf\": [\n {\n \"type\": \"object\",\n \"properties\": {\n \"id\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"id\"\n ]\n },\n {\n \"type\": \"string\"\n }\n ],\n \"description\": \"The issuer of a {@link VerifiableCredential } or the holder of a {@link VerifiablePresentation } .\\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 }\"\n },\n \"CredentialSubject\": {\n \"type\": \"object\",\n \"properties\": {\n \"id\": {\n \"type\": \"string\"\n }\n },\n \"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 }\"\n },\n \"DateType\": {\n \"anyOf\": [\n {\n \"type\": \"string\"\n },\n {\n \"type\": \"string\",\n \"format\": \"date-time\"\n }\n ],\n \"description\": \"Represents an issuance or expiration date for Credentials / Presentations. This is used as input when creating them.\"\n },\n \"CredentialStatusReference\": {\n \"type\": \"object\",\n \"properties\": {\n \"id\": {\n \"type\": \"string\"\n },\n \"type\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"id\",\n \"type\"\n ],\n \"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 }\"\n },\n \"IVerifyCredentialResult\": {\n \"type\": \"object\",\n \"properties\": {\n \"checks\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n }\n },\n \"errors\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n }\n },\n \"warnings\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n }\n }\n },\n \"required\": [\n \"checks\",\n \"errors\",\n \"warnings\"\n ]\n }\n },\n \"methods\": {\n \"vcApiClientVerifyCredential\": {\n \"description\": \"\",\n \"arguments\": {\n \"$ref\": \"#/components/schemas/IVerifyCredentialArgs\"\n },\n \"returnType\": {\n \"$ref\": \"#/components/schemas/IVerifyCredentialResult\"\n }\n }\n }\n }\n }\n}","import { CredentialPayload, IAgentContext, IPluginMethodMap } from '@veramo/core'\n\nexport interface IVcApiVerifierClient extends IPluginMethodMap {\n vcApiClientVerifyCredential(args: IVerifyCredentialArgs, context: IRequiredContext): Promise<IVerifyCredentialResult>\n}\n\nexport interface IVcApiVerifierArgs {\n verifyUrl: string\n}\n\nexport interface IVerifyCredentialArgs {\n credential: CredentialPayload\n}\n\nexport interface IVerifyCredentialResult {\n checks: string[]\n errors: string[]\n warnings: string[]\n}\n\nexport enum events {\n CREDENTIAL_VERIFIED = 'credentialVerified',\n}\n\nexport type IRequiredContext = IAgentContext<Record<string, never>>\n","import { IAgentPlugin } from '@veramo/core'\n\nimport { schema } from '../index'\nimport {\n events,\n IRequiredContext,\n IVcApiVerifierClient,\n IVcApiVerifierArgs,\n IVerifyCredentialArgs,\n IVerifyCredentialResult,\n} from '../types/IVcApiVerifierClient'\n\nimport { fetch } from 'cross-fetch'\n\n/**\n * {@inheritDoc IVcApiVerifier}\n */\nexport class VcApiVerifierClient implements IAgentPlugin {\n readonly schema = schema.IVcApiVerfierClientAgentPlugin\n readonly methods: IVcApiVerifierClient = {\n vcApiClientVerifyCredential: this.vcApiClientVerifyCredential.bind(this),\n }\n private readonly verifyUrl: string\n\n constructor(options: IVcApiVerifierArgs) {\n this.verifyUrl = options.verifyUrl\n }\n\n /** {@inheritDoc IVcApiVerifier.vcApiClientVerifyCredential} */\n private async vcApiClientVerifyCredential(args: IVerifyCredentialArgs, context: IRequiredContext): Promise<IVerifyCredentialResult> {\n return await fetch(this.verifyUrl, {\n method: 'post',\n headers: {\n Accept: 'application/json',\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({ verifiableCredential: args.credential }),\n })\n .then(async (response) => {\n if (response.status >= 400) {\n throw new Error(await response.text())\n } else {\n return response.json()\n }\n })\n .then(async (verificationResult) => {\n await context.agent.emit(events.CREDENTIAL_VERIFIED, verificationResult)\n return verificationResult\n })\n }\n}\n","/**\n * @public\n */\nconst schema = require('../plugin.schema.json')\nexport { schema }\nexport { VcApiVerifierClient } from './agent/VcApiVerifierClient'\nexport * from './types/IVcApiVerifierClient'\n"],"mappings":";;;;;;;;AAAA;AAAA;AAAA;AAAA,MACE,sBAAwB;AAAA,QACtB,YAAc;AAAA,UACZ,SAAW;AAAA,YACT,uBAAyB;AAAA,cACvB,MAAQ;AAAA,cACR,YAAc;AAAA,gBACZ,YAAc;AAAA,kBACZ,MAAQ;AAAA,gBACV;AAAA,cACF;AAAA,cACA,UAAY;AAAA,gBACV;AAAA,cACF;AAAA,YACF;AAAA,YACA,mBAAqB;AAAA,cACnB,MAAQ;AAAA,cACR,YAAc;AAAA,gBACZ,QAAU;AAAA,kBACR,MAAQ;AAAA,gBACV;AAAA,gBACA,mBAAqB;AAAA,kBACnB,MAAQ;AAAA,gBACV;AAAA,gBACA,MAAQ;AAAA,kBACN,MAAQ;AAAA,kBACR,OAAS;AAAA,oBACP,MAAQ;AAAA,kBACV;AAAA,gBACF;AAAA,gBACA,YAAY;AAAA,kBACV,MAAQ;AAAA,kBACR,OAAS;AAAA,oBACP,MAAQ;AAAA,kBACV;AAAA,gBACF;AAAA,gBACA,cAAgB;AAAA,kBACd,MAAQ;AAAA,gBACV;AAAA,gBACA,gBAAkB;AAAA,kBAChB,MAAQ;AAAA,gBACV;AAAA,gBACA,kBAAoB;AAAA,kBAClB,MAAQ;AAAA,gBACV;AAAA,gBACA,IAAM;AAAA,kBACJ,MAAQ;AAAA,gBACV;AAAA,cACF;AAAA,cACA,UAAY;AAAA,gBACV;AAAA,cACF;AAAA,cACA,aAAe;AAAA,YACjB;AAAA,YACA,YAAc;AAAA,cACZ,OAAS;AAAA,gBACP;AAAA,kBACE,MAAQ;AAAA,kBACR,YAAc;AAAA,oBACZ,IAAM;AAAA,sBACJ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AAA,cAC7B,aAAe;AAAA,cACf,WAAa;AAAA,gBACX,MAAQ;AAAA,cACV;AAAA,cACA,YAAc;AAAA,gBACZ,MAAQ;AAAA,cACV;AAAA,YACF;AAAA,UACF;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA;AAAA;;;ACpIO,IAAKA,SAAAA,yBAAAA,SAAAA;;SAAAA;;;;ACRZ,SAASC,aAAa;AAKf,IAAMC,sBAAN,MAAMA;EAfb,OAeaA;;;EACFC,SAASA,OAAOC;EAChBC,UAAgC;IACvCC,6BAA6B,KAAKA,4BAA4BC,KAAK,IAAI;EACzE;EACiBC;EAEjBC,YAAYC,SAA6B;AACvC,SAAKF,YAAYE,QAAQF;EAC3B;;EAGA,MAAcF,4BAA4BK,MAA6BC,SAA6D;AAClI,WAAO,MAAMC,MAAM,KAAKL,WAAW;MACjCM,QAAQ;MACRC,SAAS;QACPC,QAAQ;QACR,gBAAgB;MAClB;MACAC,MAAMC,KAAKC,UAAU;QAAEC,sBAAsBT,KAAKU;MAAW,CAAA;IAC/D,CAAA,EACGC,KAAK,OAAOC,aAAAA;AACX,UAAIA,SAASC,UAAU,KAAK;AAC1B,cAAM,IAAIC,MAAM,MAAMF,SAASG,KAAI,CAAA;MACrC,OAAO;AACL,eAAOH,SAASI,KAAI;MACtB;IACF,CAAA,EACCL,KAAK,OAAOM,uBAAAA;AACX,YAAMhB,QAAQiB,MAAMC,KAAKC,OAAOC,qBAAqBJ,kBAAAA;AACrD,aAAOA;IACT,CAAA;EACJ;AACF;;;AC/CA,IAAMK,SAASC;","names":["events","fetch","VcApiVerifierClient","schema","IVcApiVerfierClientAgentPlugin","methods","vcApiClientVerifyCredential","bind","verifyUrl","constructor","options","args","context","fetch","method","headers","Accept","body","JSON","stringify","verifiableCredential","credential","then","response","status","Error","text","json","verificationResult","agent","emit","events","CREDENTIAL_VERIFIED","schema","require"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA;;GAEG;AACH,MAAM,MAAM,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAA;AACtC,wBAAM;AACf,mEAAiE;AAAxD,0HAAA,mBAAmB,OAAA;AAC5B,+DAA4C"}
@@ -0,0 +1,47 @@
1
+ import { CredentialPayload } from '@veramo/core';
2
+ import { IAgentContext } from '@veramo/core';
3
+ import { IAgentPlugin } from '@veramo/core';
4
+ import { IPluginMethodMap } from '@veramo/core';
5
+
6
+ export declare enum events {
7
+ CREDENTIAL_VERIFIED = "credentialVerified"
8
+ }
9
+
10
+ export declare type IRequiredContext = IAgentContext<Record<string, never>>;
11
+
12
+ export declare interface IVcApiVerifierArgs {
13
+ verifyUrl: string;
14
+ }
15
+
16
+ export declare interface IVcApiVerifierClient extends IPluginMethodMap {
17
+ vcApiClientVerifyCredential(args: IVerifyCredentialArgs, context: IRequiredContext): Promise<IVerifyCredentialResult>;
18
+ }
19
+
20
+ export declare interface IVerifyCredentialArgs {
21
+ credential: CredentialPayload;
22
+ }
23
+
24
+ export declare interface IVerifyCredentialResult {
25
+ checks: string[];
26
+ errors: string[];
27
+ warnings: string[];
28
+ }
29
+
30
+ /**
31
+ * @public
32
+ */
33
+ export declare const schema: any;
34
+
35
+ /**
36
+ * {@inheritDoc IVcApiVerifier}
37
+ */
38
+ export declare class VcApiVerifierClient implements IAgentPlugin {
39
+ readonly schema: any;
40
+ readonly methods: IVcApiVerifierClient;
41
+ private readonly verifyUrl;
42
+ constructor(options: IVcApiVerifierArgs);
43
+ /** {@inheritDoc IVcApiVerifier.vcApiClientVerifyCredential} */
44
+ private vcApiClientVerifyCredential;
45
+ }
46
+
47
+ export { }
@@ -0,0 +1,11 @@
1
+ // This file is read by tools that parse documentation comments conforming to the TSDoc standard.
2
+ // It should be published with your NPM package. It should not be tracked by Git.
3
+ {
4
+ "tsdocVersion": "0.12",
5
+ "toolPackages": [
6
+ {
7
+ "packageName": "@microsoft/api-extractor",
8
+ "packageVersion": "7.52.1"
9
+ }
10
+ ]
11
+ }
@@ -0,0 +1,20 @@
1
+ import { CredentialPayload, IAgentContext, IPluginMethodMap } from '@veramo/core';
2
+ export interface IVcApiVerifierClient extends IPluginMethodMap {
3
+ vcApiClientVerifyCredential(args: IVerifyCredentialArgs, context: IRequiredContext): Promise<IVerifyCredentialResult>;
4
+ }
5
+ export interface IVcApiVerifierArgs {
6
+ verifyUrl: string;
7
+ }
8
+ export interface IVerifyCredentialArgs {
9
+ credential: CredentialPayload;
10
+ }
11
+ export interface IVerifyCredentialResult {
12
+ checks: string[];
13
+ errors: string[];
14
+ warnings: string[];
15
+ }
16
+ export declare enum events {
17
+ CREDENTIAL_VERIFIED = "credentialVerified"
18
+ }
19
+ export type IRequiredContext = IAgentContext<Record<string, never>>;
20
+ //# sourceMappingURL=IVcApiVerifierClient.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IVcApiVerifierClient.d.ts","sourceRoot":"","sources":["../../src/types/IVcApiVerifierClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAEjF,MAAM,WAAW,oBAAqB,SAAQ,gBAAgB;IAC5D,2BAA2B,CAAC,IAAI,EAAE,qBAAqB,EAAE,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAA;CACtH;AAED,MAAM,WAAW,kBAAkB;IACjC,SAAS,EAAE,MAAM,CAAA;CAClB;AAED,MAAM,WAAW,qBAAqB;IACpC,UAAU,EAAE,iBAAiB,CAAA;CAC9B;AAED,MAAM,WAAW,uBAAuB;IACtC,MAAM,EAAE,MAAM,EAAE,CAAA;IAChB,MAAM,EAAE,MAAM,EAAE,CAAA;IAChB,QAAQ,EAAE,MAAM,EAAE,CAAA;CACnB;AAED,oBAAY,MAAM;IAChB,mBAAmB,uBAAuB;CAC3C;AAED,MAAM,MAAM,gBAAgB,GAAG,aAAa,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAAA"}
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.events = void 0;
4
+ var events;
5
+ (function (events) {
6
+ events["CREDENTIAL_VERIFIED"] = "credentialVerified";
7
+ })(events || (exports.events = events = {}));
8
+ //# sourceMappingURL=IVcApiVerifierClient.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IVcApiVerifierClient.js","sourceRoot":"","sources":["../../src/types/IVcApiVerifierClient.ts"],"names":[],"mappings":";;;AAoBA,IAAY,MAEX;AAFD,WAAY,MAAM;IAChB,oDAA0C,CAAA;AAC5C,CAAC,EAFW,MAAM,sBAAN,MAAM,QAEjB"}
package/package.json CHANGED
@@ -1,28 +1,17 @@
1
1
  {
2
2
  "name": "@sphereon/ssi-sdk.w3c-vc-api-verifier-rest-client",
3
- "version": "0.33.1-feature.vcdm2.tsup.31+71b615ad",
3
+ "version": "0.33.1-next.2+6f7f40b9",
4
4
  "source": "src/index.ts",
5
- "type": "module",
6
- "main": "./dist/index.cjs",
7
- "module": "./dist/index.js",
8
- "types": "./dist/index.d.ts",
9
- "exports": {
10
- "import": {
11
- "types": "./dist/index.d.ts",
12
- "import": "./dist/index.js"
13
- },
14
- "require": {
15
- "types": "./dist/index.d.cts",
16
- "require": "./dist/index.cjs"
17
- }
18
- },
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
19
7
  "veramo": {
20
8
  "pluginInterfaces": {
21
9
  "IVcApiVerifierClient": "./src/types/IVcApiVerifierClient.ts"
22
10
  }
23
11
  },
24
12
  "scripts": {
25
- "build": "tsup --config ../../tsup.config.ts --tsconfig ../../tsconfig.tsup.json",
13
+ "build": "tsc --build",
14
+ "build:clean": "tsc --build --clean && tsc --build",
26
15
  "generate-plugin-schema": "ts-node ../../packages/dev/bin/sphereon.js dev generate-plugin-schema"
27
16
  },
28
17
  "dependencies": {
@@ -30,14 +19,14 @@
30
19
  "cross-fetch": "^3.1.8"
31
20
  },
32
21
  "devDependencies": {
33
- "@sphereon/ssi-sdk.dev": "^0.33.1-feature.vcdm2.tsup.31+71b615ad",
22
+ "@sphereon/ssi-sdk.dev": "0.33.1-next.2+6f7f40b9",
34
23
  "@veramo/cli": "4.2.0",
35
24
  "@veramo/remote-client": "4.2.0",
36
25
  "@veramo/remote-server": "4.2.0"
37
26
  },
38
27
  "files": [
39
- "dist",
40
- "src",
28
+ "dist/**/*",
29
+ "src/**/*",
41
30
  "README.md",
42
31
  "plugin.schema.json",
43
32
  "LICENSE"
@@ -57,5 +46,6 @@
57
46
  "API",
58
47
  "Verifier"
59
48
  ],
60
- "gitHead": "71b615adbfef8ecd843edb2f3d0c58cb6453cff9"
49
+ "nx": {},
50
+ "gitHead": "6f7f40b94beb385369fede046c3912bd0c053408"
61
51
  }
package/dist/index.cjs DELETED
@@ -1,238 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
7
- var __commonJS = (cb, mod) => function __require() {
8
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
9
- };
10
- var __export = (target, all) => {
11
- for (var name in all)
12
- __defProp(target, name, { get: all[name], enumerable: true });
13
- };
14
- var __copyProps = (to, from, except, desc) => {
15
- if (from && typeof from === "object" || typeof from === "function") {
16
- for (let key of __getOwnPropNames(from))
17
- if (!__hasOwnProp.call(to, key) && key !== except)
18
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
19
- }
20
- return to;
21
- };
22
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
23
-
24
- // plugin.schema.json
25
- var require_plugin_schema = __commonJS({
26
- "plugin.schema.json"(exports, module2) {
27
- module2.exports = {
28
- IVcApiVerifierClient: {
29
- components: {
30
- schemas: {
31
- IVerifyCredentialArgs: {
32
- type: "object",
33
- properties: {
34
- credential: {
35
- $ref: "#/components/schemas/CredentialPayload"
36
- }
37
- },
38
- required: [
39
- "credential"
40
- ]
41
- },
42
- CredentialPayload: {
43
- type: "object",
44
- properties: {
45
- issuer: {
46
- $ref: "#/components/schemas/IssuerType"
47
- },
48
- credentialSubject: {
49
- $ref: "#/components/schemas/CredentialSubject"
50
- },
51
- type: {
52
- type: "array",
53
- items: {
54
- type: "string"
55
- }
56
- },
57
- "@context": {
58
- type: "array",
59
- items: {
60
- type: "string"
61
- }
62
- },
63
- issuanceDate: {
64
- $ref: "#/components/schemas/DateType"
65
- },
66
- expirationDate: {
67
- $ref: "#/components/schemas/DateType"
68
- },
69
- credentialStatus: {
70
- $ref: "#/components/schemas/CredentialStatusReference"
71
- },
72
- id: {
73
- type: "string"
74
- }
75
- },
76
- required: [
77
- "issuer"
78
- ],
79
- description: "Used as input when creating Verifiable Credentials"
80
- },
81
- IssuerType: {
82
- anyOf: [
83
- {
84
- type: "object",
85
- properties: {
86
- id: {
87
- type: "string"
88
- }
89
- },
90
- required: [
91
- "id"
92
- ]
93
- },
94
- {
95
- type: "string"
96
- }
97
- ],
98
- description: "The issuer of a {@link VerifiableCredential } or the holder of a {@link VerifiablePresentation } .\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 }"
99
- },
100
- CredentialSubject: {
101
- type: "object",
102
- properties: {
103
- id: {
104
- type: "string"
105
- }
106
- },
107
- 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 }"
108
- },
109
- DateType: {
110
- anyOf: [
111
- {
112
- type: "string"
113
- },
114
- {
115
- type: "string",
116
- format: "date-time"
117
- }
118
- ],
119
- description: "Represents an issuance or expiration date for Credentials / Presentations. This is used as input when creating them."
120
- },
121
- CredentialStatusReference: {
122
- type: "object",
123
- properties: {
124
- id: {
125
- type: "string"
126
- },
127
- type: {
128
- type: "string"
129
- }
130
- },
131
- required: [
132
- "id",
133
- "type"
134
- ],
135
- 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 }"
136
- },
137
- IVerifyCredentialResult: {
138
- type: "object",
139
- properties: {
140
- checks: {
141
- type: "array",
142
- items: {
143
- type: "string"
144
- }
145
- },
146
- errors: {
147
- type: "array",
148
- items: {
149
- type: "string"
150
- }
151
- },
152
- warnings: {
153
- type: "array",
154
- items: {
155
- type: "string"
156
- }
157
- }
158
- },
159
- required: [
160
- "checks",
161
- "errors",
162
- "warnings"
163
- ]
164
- }
165
- },
166
- methods: {
167
- vcApiClientVerifyCredential: {
168
- description: "",
169
- arguments: {
170
- $ref: "#/components/schemas/IVerifyCredentialArgs"
171
- },
172
- returnType: {
173
- $ref: "#/components/schemas/IVerifyCredentialResult"
174
- }
175
- }
176
- }
177
- }
178
- }
179
- };
180
- }
181
- });
182
-
183
- // src/index.ts
184
- var index_exports = {};
185
- __export(index_exports, {
186
- VcApiVerifierClient: () => VcApiVerifierClient,
187
- events: () => events,
188
- schema: () => schema
189
- });
190
- module.exports = __toCommonJS(index_exports);
191
-
192
- // src/types/IVcApiVerifierClient.ts
193
- var events = /* @__PURE__ */ function(events2) {
194
- events2["CREDENTIAL_VERIFIED"] = "credentialVerified";
195
- return events2;
196
- }({});
197
-
198
- // src/agent/VcApiVerifierClient.ts
199
- var import_cross_fetch = require("cross-fetch");
200
- var VcApiVerifierClient = class {
201
- static {
202
- __name(this, "VcApiVerifierClient");
203
- }
204
- schema = schema.IVcApiVerfierClientAgentPlugin;
205
- methods = {
206
- vcApiClientVerifyCredential: this.vcApiClientVerifyCredential.bind(this)
207
- };
208
- verifyUrl;
209
- constructor(options) {
210
- this.verifyUrl = options.verifyUrl;
211
- }
212
- /** {@inheritDoc IVcApiVerifier.vcApiClientVerifyCredential} */
213
- async vcApiClientVerifyCredential(args, context) {
214
- return await (0, import_cross_fetch.fetch)(this.verifyUrl, {
215
- method: "post",
216
- headers: {
217
- Accept: "application/json",
218
- "Content-Type": "application/json"
219
- },
220
- body: JSON.stringify({
221
- verifiableCredential: args.credential
222
- })
223
- }).then(async (response) => {
224
- if (response.status >= 400) {
225
- throw new Error(await response.text());
226
- } else {
227
- return response.json();
228
- }
229
- }).then(async (verificationResult) => {
230
- await context.agent.emit(events.CREDENTIAL_VERIFIED, verificationResult);
231
- return verificationResult;
232
- });
233
- }
234
- };
235
-
236
- // src/index.ts
237
- var schema = require_plugin_schema();
238
- //# sourceMappingURL=index.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../plugin.schema.json","../src/index.ts","../src/types/IVcApiVerifierClient.ts","../src/agent/VcApiVerifierClient.ts"],"sourcesContent":["{\n \"IVcApiVerifierClient\": {\n \"components\": {\n \"schemas\": {\n \"IVerifyCredentialArgs\": {\n \"type\": \"object\",\n \"properties\": {\n \"credential\": {\n \"$ref\": \"#/components/schemas/CredentialPayload\"\n }\n },\n \"required\": [\n \"credential\"\n ]\n },\n \"CredentialPayload\": {\n \"type\": \"object\",\n \"properties\": {\n \"issuer\": {\n \"$ref\": \"#/components/schemas/IssuerType\"\n },\n \"credentialSubject\": {\n \"$ref\": \"#/components/schemas/CredentialSubject\"\n },\n \"type\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n }\n },\n \"@context\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n }\n },\n \"issuanceDate\": {\n \"$ref\": \"#/components/schemas/DateType\"\n },\n \"expirationDate\": {\n \"$ref\": \"#/components/schemas/DateType\"\n },\n \"credentialStatus\": {\n \"$ref\": \"#/components/schemas/CredentialStatusReference\"\n },\n \"id\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"issuer\"\n ],\n \"description\": \"Used as input when creating Verifiable Credentials\"\n },\n \"IssuerType\": {\n \"anyOf\": [\n {\n \"type\": \"object\",\n \"properties\": {\n \"id\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"id\"\n ]\n },\n {\n \"type\": \"string\"\n }\n ],\n \"description\": \"The issuer of a {@link VerifiableCredential } or the holder of a {@link VerifiablePresentation } .\\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 }\"\n },\n \"CredentialSubject\": {\n \"type\": \"object\",\n \"properties\": {\n \"id\": {\n \"type\": \"string\"\n }\n },\n \"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 }\"\n },\n \"DateType\": {\n \"anyOf\": [\n {\n \"type\": \"string\"\n },\n {\n \"type\": \"string\",\n \"format\": \"date-time\"\n }\n ],\n \"description\": \"Represents an issuance or expiration date for Credentials / Presentations. This is used as input when creating them.\"\n },\n \"CredentialStatusReference\": {\n \"type\": \"object\",\n \"properties\": {\n \"id\": {\n \"type\": \"string\"\n },\n \"type\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"id\",\n \"type\"\n ],\n \"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 }\"\n },\n \"IVerifyCredentialResult\": {\n \"type\": \"object\",\n \"properties\": {\n \"checks\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n }\n },\n \"errors\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n }\n },\n \"warnings\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n }\n }\n },\n \"required\": [\n \"checks\",\n \"errors\",\n \"warnings\"\n ]\n }\n },\n \"methods\": {\n \"vcApiClientVerifyCredential\": {\n \"description\": \"\",\n \"arguments\": {\n \"$ref\": \"#/components/schemas/IVerifyCredentialArgs\"\n },\n \"returnType\": {\n \"$ref\": \"#/components/schemas/IVerifyCredentialResult\"\n }\n }\n }\n }\n }\n}","/**\n * @public\n */\nconst schema = require('../plugin.schema.json')\nexport { schema }\nexport { VcApiVerifierClient } from './agent/VcApiVerifierClient'\nexport * from './types/IVcApiVerifierClient'\n","import { CredentialPayload, IAgentContext, IPluginMethodMap } from '@veramo/core'\n\nexport interface IVcApiVerifierClient extends IPluginMethodMap {\n vcApiClientVerifyCredential(args: IVerifyCredentialArgs, context: IRequiredContext): Promise<IVerifyCredentialResult>\n}\n\nexport interface IVcApiVerifierArgs {\n verifyUrl: string\n}\n\nexport interface IVerifyCredentialArgs {\n credential: CredentialPayload\n}\n\nexport interface IVerifyCredentialResult {\n checks: string[]\n errors: string[]\n warnings: string[]\n}\n\nexport enum events {\n CREDENTIAL_VERIFIED = 'credentialVerified',\n}\n\nexport type IRequiredContext = IAgentContext<Record<string, never>>\n","import { IAgentPlugin } from '@veramo/core'\n\nimport { schema } from '../index'\nimport {\n events,\n IRequiredContext,\n IVcApiVerifierClient,\n IVcApiVerifierArgs,\n IVerifyCredentialArgs,\n IVerifyCredentialResult,\n} from '../types/IVcApiVerifierClient'\n\nimport { fetch } from 'cross-fetch'\n\n/**\n * {@inheritDoc IVcApiVerifier}\n */\nexport class VcApiVerifierClient implements IAgentPlugin {\n readonly schema = schema.IVcApiVerfierClientAgentPlugin\n readonly methods: IVcApiVerifierClient = {\n vcApiClientVerifyCredential: this.vcApiClientVerifyCredential.bind(this),\n }\n private readonly verifyUrl: string\n\n constructor(options: IVcApiVerifierArgs) {\n this.verifyUrl = options.verifyUrl\n }\n\n /** {@inheritDoc IVcApiVerifier.vcApiClientVerifyCredential} */\n private async vcApiClientVerifyCredential(args: IVerifyCredentialArgs, context: IRequiredContext): Promise<IVerifyCredentialResult> {\n return await fetch(this.verifyUrl, {\n method: 'post',\n headers: {\n Accept: 'application/json',\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({ verifiableCredential: args.credential }),\n })\n .then(async (response) => {\n if (response.status >= 400) {\n throw new Error(await response.text())\n } else {\n return response.json()\n }\n })\n .then(async (verificationResult) => {\n await context.agent.emit(events.CREDENTIAL_VERIFIED, verificationResult)\n return verificationResult\n })\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA,gCAAAA,SAAA;AAAA,IAAAA,QAAA;AAAA,MACE,sBAAwB;AAAA,QACtB,YAAc;AAAA,UACZ,SAAW;AAAA,YACT,uBAAyB;AAAA,cACvB,MAAQ;AAAA,cACR,YAAc;AAAA,gBACZ,YAAc;AAAA,kBACZ,MAAQ;AAAA,gBACV;AAAA,cACF;AAAA,cACA,UAAY;AAAA,gBACV;AAAA,cACF;AAAA,YACF;AAAA,YACA,mBAAqB;AAAA,cACnB,MAAQ;AAAA,cACR,YAAc;AAAA,gBACZ,QAAU;AAAA,kBACR,MAAQ;AAAA,gBACV;AAAA,gBACA,mBAAqB;AAAA,kBACnB,MAAQ;AAAA,gBACV;AAAA,gBACA,MAAQ;AAAA,kBACN,MAAQ;AAAA,kBACR,OAAS;AAAA,oBACP,MAAQ;AAAA,kBACV;AAAA,gBACF;AAAA,gBACA,YAAY;AAAA,kBACV,MAAQ;AAAA,kBACR,OAAS;AAAA,oBACP,MAAQ;AAAA,kBACV;AAAA,gBACF;AAAA,gBACA,c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OAAOM,uBAAAA;AACX,YAAMhB,QAAQiB,MAAMC,KAAKC,OAAOC,qBAAqBJ,kBAAAA;AACrD,aAAOA;IACT,CAAA;EACJ;AACF;;;AF/CA,IAAMK,SAASC;","names":["module","events","VcApiVerifierClient","schema","IVcApiVerfierClientAgentPlugin","methods","vcApiClientVerifyCredential","bind","verifyUrl","constructor","options","args","context","fetch","method","headers","Accept","body","JSON","stringify","verifiableCredential","credential","then","response","status","Error","text","json","verificationResult","agent","emit","events","CREDENTIAL_VERIFIED","schema","require"]}
package/dist/index.d.cts DELETED
@@ -1,39 +0,0 @@
1
- import { IPluginMethodMap, CredentialPayload, IAgentContext, IAgentPlugin } from '@veramo/core';
2
-
3
- interface IVcApiVerifierClient extends IPluginMethodMap {
4
- vcApiClientVerifyCredential(args: IVerifyCredentialArgs, context: IRequiredContext): Promise<IVerifyCredentialResult>;
5
- }
6
- interface IVcApiVerifierArgs {
7
- verifyUrl: string;
8
- }
9
- interface IVerifyCredentialArgs {
10
- credential: CredentialPayload;
11
- }
12
- interface IVerifyCredentialResult {
13
- checks: string[];
14
- errors: string[];
15
- warnings: string[];
16
- }
17
- declare enum events {
18
- CREDENTIAL_VERIFIED = "credentialVerified"
19
- }
20
- type IRequiredContext = IAgentContext<Record<string, never>>;
21
-
22
- /**
23
- * {@inheritDoc IVcApiVerifier}
24
- */
25
- declare class VcApiVerifierClient implements IAgentPlugin {
26
- readonly schema: any;
27
- readonly methods: IVcApiVerifierClient;
28
- private readonly verifyUrl;
29
- constructor(options: IVcApiVerifierArgs);
30
- /** {@inheritDoc IVcApiVerifier.vcApiClientVerifyCredential} */
31
- private vcApiClientVerifyCredential;
32
- }
33
-
34
- /**
35
- * @public
36
- */
37
- declare const schema: any;
38
-
39
- export { type IRequiredContext, type IVcApiVerifierArgs, type IVcApiVerifierClient, type IVerifyCredentialArgs, type IVerifyCredentialResult, VcApiVerifierClient, events, schema };