@sphereon/ssi-sdk.w3c-vc-api-issuer-rest-client 0.33.1-next.3 → 0.33.1-next.73

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/dist/index.js CHANGED
@@ -1,26 +1,392 @@
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);
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
+ IVcApiIssuerClient: {
13
+ components: {
14
+ schemas: {
15
+ IIssueCredentialArgs: {
16
+ type: "object",
17
+ properties: {
18
+ credential: {
19
+ $ref: "#/components/schemas/CredentialPayload"
20
+ }
21
+ },
22
+ required: ["credential"],
23
+ additionalProperties: false
24
+ },
25
+ CredentialPayload: {
26
+ type: "object",
27
+ properties: {
28
+ issuer: {
29
+ $ref: "#/components/schemas/IssuerType"
30
+ },
31
+ credentialSubject: {
32
+ $ref: "#/components/schemas/CredentialSubject"
33
+ },
34
+ type: {
35
+ type: "array",
36
+ items: {
37
+ type: "string"
38
+ }
39
+ },
40
+ "@context": {
41
+ type: "array",
42
+ items: {
43
+ type: "string"
44
+ }
45
+ },
46
+ issuanceDate: {
47
+ $ref: "#/components/schemas/DateType"
48
+ },
49
+ expirationDate: {
50
+ $ref: "#/components/schemas/DateType"
51
+ },
52
+ credentialStatus: {
53
+ $ref: "#/components/schemas/CredentialStatusReference"
54
+ },
55
+ id: {
56
+ type: "string"
57
+ }
58
+ },
59
+ required: ["issuer"],
60
+ description: "Used as input when creating Verifiable Credentials"
61
+ },
62
+ IssuerType: {
63
+ anyOf: [
64
+ {
65
+ type: "object",
66
+ properties: {
67
+ id: {
68
+ type: "string"
69
+ }
70
+ },
71
+ required: ["id"]
72
+ },
73
+ {
74
+ type: "string"
75
+ }
76
+ ],
77
+ 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 }"
78
+ },
79
+ CredentialSubject: {
80
+ type: "object",
81
+ properties: {
82
+ id: {
83
+ type: "string"
84
+ }
85
+ },
86
+ 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 }"
87
+ },
88
+ DateType: {
89
+ anyOf: [
90
+ {
91
+ type: "string"
92
+ },
93
+ {
94
+ type: "string",
95
+ format: "date-time"
96
+ }
97
+ ],
98
+ description: "Represents an issuance or expiration date for Credentials / Presentations. This is used as input when creating them."
99
+ },
100
+ CredentialStatusReference: {
101
+ type: "object",
102
+ properties: {
103
+ id: {
104
+ type: "string"
105
+ },
106
+ type: {
107
+ type: "string"
108
+ }
109
+ },
110
+ required: ["id", "type"],
111
+ 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 }"
112
+ },
113
+ VerifiableCredentialSP: {
114
+ type: "object",
115
+ properties: {
116
+ issuer: {
117
+ $ref: "#/components/schemas/IssuerType"
118
+ },
119
+ credentialSubject: {
120
+ anyOf: [
121
+ {
122
+ type: "array",
123
+ items: {
124
+ $ref: "#/components/schemas/CredentialSubject"
125
+ }
126
+ },
127
+ {
128
+ $ref: "#/components/schemas/CredentialSubject"
129
+ }
130
+ ]
131
+ },
132
+ type: {
133
+ anyOf: [
134
+ {
135
+ type: "array",
136
+ items: {
137
+ type: "string"
138
+ }
139
+ },
140
+ {
141
+ type: "string"
142
+ }
143
+ ]
144
+ },
145
+ "@context": {
146
+ anyOf: [
147
+ {
148
+ type: "array",
149
+ items: {
150
+ type: "string"
151
+ }
152
+ },
153
+ {
154
+ type: "string"
155
+ }
156
+ ]
157
+ },
158
+ issuanceDate: {
159
+ type: "string"
160
+ },
161
+ expirationDate: {
162
+ type: "string"
163
+ },
164
+ credentialStatus: {
165
+ $ref: "#/components/schemas/CredentialStatusSP"
166
+ },
167
+ id: {
168
+ type: "string"
169
+ },
170
+ validFrom: {
171
+ type: "string"
172
+ },
173
+ validUntil: {
174
+ type: "string"
175
+ },
176
+ proof: {
177
+ anyOf: [
178
+ {
179
+ $ref: "#/components/schemas/CredentialProofSP"
180
+ },
181
+ {
182
+ type: "array",
183
+ items: {
184
+ $ref: "#/components/schemas/CredentialProofSP"
185
+ }
186
+ },
187
+ {
188
+ $ref: "#/components/schemas/ProofType"
189
+ }
190
+ ]
191
+ }
192
+ },
193
+ required: ["@context", "credentialSubject", "issuanceDate", "issuer", "proof"]
194
+ },
195
+ CredentialStatusSP: {
196
+ type: "object",
197
+ properties: {
198
+ id: {
199
+ type: "string"
200
+ },
201
+ type: {
202
+ type: "string"
203
+ },
204
+ revocationListIndex: {
205
+ type: "string"
206
+ },
207
+ revocationListCredential: {
208
+ type: "string"
209
+ }
210
+ },
211
+ required: ["id", "type"]
212
+ },
213
+ CredentialProofSP: {
214
+ type: "object",
215
+ properties: {
216
+ type: {
217
+ anyOf: [
218
+ {
219
+ type: "string"
220
+ },
221
+ {
222
+ $ref: "#/components/schemas/IProofType"
223
+ }
224
+ ]
225
+ },
226
+ created: {
227
+ type: "string"
228
+ },
229
+ proofPurpose: {
230
+ anyOf: [
231
+ {
232
+ $ref: "#/components/schemas/IProofPurpose"
233
+ },
234
+ {
235
+ type: "string"
236
+ }
237
+ ]
238
+ },
239
+ verificationMethod: {
240
+ type: "string"
241
+ },
242
+ challenge: {
243
+ type: "string"
244
+ },
245
+ domain: {
246
+ type: "string"
247
+ },
248
+ proofValue: {
249
+ type: "string"
250
+ },
251
+ jws: {
252
+ type: "string"
253
+ },
254
+ nonce: {
255
+ type: "string"
256
+ },
257
+ requiredRevealStatements: {
258
+ type: "array",
259
+ items: {
260
+ type: "string"
261
+ }
262
+ }
263
+ },
264
+ required: ["type", "created", "proofPurpose", "verificationMethod"],
265
+ additionalProperties: {
266
+ anyOf: [
267
+ {
268
+ type: "string"
269
+ },
270
+ {
271
+ type: "array",
272
+ items: {
273
+ type: "string"
274
+ }
275
+ },
276
+ {
277
+ not: {}
278
+ }
279
+ ]
280
+ }
281
+ },
282
+ IProofType: {
283
+ type: "string",
284
+ enum: [
285
+ "Ed25519Signature2018",
286
+ "Ed25519Signature2020",
287
+ "EcdsaSecp256k1Signature2019",
288
+ "EcdsaSecp256k1RecoverySignature2020",
289
+ "JsonWebSignature2020",
290
+ "RsaSignature2018",
291
+ "GpgSignature2020",
292
+ "JcsEd25519Signature2020",
293
+ "BbsBlsSignatureProof2020",
294
+ "BbsBlsBoundSignatureProof2020",
295
+ "JwtProof2020",
296
+ "SdJwtProof2024",
297
+ "MsoMdocProof2024"
298
+ ]
299
+ },
300
+ IProofPurpose: {
301
+ type: "string",
302
+ enum: [
303
+ "verificationMethod",
304
+ "assertionMethod",
305
+ "authentication",
306
+ "keyAgreement",
307
+ "contactAgreement",
308
+ "capabilityInvocation",
309
+ "capabilityDelegation"
310
+ ]
311
+ },
312
+ ProofType: {
313
+ type: "object",
314
+ properties: {
315
+ type: {
316
+ type: "string"
317
+ }
318
+ },
319
+ description: "A proof property of a {@link VerifiableCredential } or {@link VerifiablePresentation }"
320
+ }
321
+ },
322
+ methods: {
323
+ vcApiClientIssueCredential: {
324
+ description: "",
325
+ arguments: {
326
+ $ref: "#/components/schemas/IIssueCredentialArgs"
327
+ },
328
+ returnType: {
329
+ $ref: "#/components/schemas/VerifiableCredentialSP"
330
+ }
331
+ }
332
+ }
333
+ }
334
+ }
335
+ };
336
+ }
337
+ });
338
+
339
+ // src/types/IVcApiIssuerClient.ts
340
+ var events = /* @__PURE__ */ function(events2) {
341
+ events2["CREDENTIAL_ISSUED"] = "credentialIssued";
342
+ return events2;
343
+ }({});
344
+
345
+ // src/agent/VcApiIssuerClient.ts
346
+ import { fetch } from "cross-fetch";
347
+ var VcApiIssuerClient = class {
348
+ static {
349
+ __name(this, "VcApiIssuerClient");
350
+ }
351
+ schema = schema.IVcApiIssuer;
352
+ methods = {
353
+ vcApiClientIssueCredential: this.vcApiClientIssueCredential.bind(this)
354
+ };
355
+ issueUrl;
356
+ authorizationToken;
357
+ constructor(options) {
358
+ this.issueUrl = options.issueUrl;
359
+ this.authorizationToken = options.authorizationToken;
360
+ }
361
+ /** {@inheritDoc IVcApiIssuer.vcApiClientIssueCredential} */
362
+ async vcApiClientIssueCredential(args, context) {
363
+ return await fetch(this.issueUrl, {
364
+ method: "post",
365
+ headers: {
366
+ Accept: "application/json",
367
+ "Content-Type": "application/json",
368
+ Authorization: `bearer ${this.authorizationToken}`
369
+ },
370
+ body: JSON.stringify({
371
+ credential: args.credential
372
+ })
373
+ }).then(async (response) => {
374
+ if (response.status >= 400) {
375
+ throw new Error(await response.text());
376
+ } else {
377
+ const verifiableCredential = response.json();
378
+ await context.agent.emit(events.CREDENTIAL_ISSUED, verifiableCredential);
379
+ return verifiableCredential;
380
+ }
381
+ });
382
+ }
383
+ };
384
+
385
+ // src/index.ts
386
+ var schema = require_plugin_schema();
387
+ export {
388
+ VcApiIssuerClient,
389
+ events,
390
+ schema
15
391
  };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.VcApiIssuerClient = exports.schema = void 0;
18
- /**
19
- * @public
20
- */
21
- const schema = require('../plugin.schema.json');
22
- exports.schema = schema;
23
- var VcApiIssuerClient_1 = require("./agent/VcApiIssuerClient");
24
- Object.defineProperty(exports, "VcApiIssuerClient", { enumerable: true, get: function () { return VcApiIssuerClient_1.VcApiIssuerClient; } });
25
- __exportStar(require("./types/IVcApiIssuerClient"), exports);
26
392
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
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,+DAA6D;AAApD,sHAAA,iBAAiB,OAAA;AAC1B,6DAA0C"}
1
+ {"version":3,"sources":["../plugin.schema.json","../src/types/IVcApiIssuerClient.ts","../src/agent/VcApiIssuerClient.ts","../src/index.ts"],"sourcesContent":["{\n \"IVcApiIssuerClient\": {\n \"components\": {\n \"schemas\": {\n \"IIssueCredentialArgs\": {\n \"type\": \"object\",\n \"properties\": {\n \"credential\": {\n \"$ref\": \"#/components/schemas/CredentialPayload\"\n }\n },\n \"required\": [\"credential\"],\n \"additionalProperties\": false\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\": [\"issuer\"],\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\": [\"id\"]\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\": [\"id\", \"type\"],\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 \"VerifiableCredentialSP\": {\n \"type\": \"object\",\n \"properties\": {\n \"issuer\": {\n \"$ref\": \"#/components/schemas/IssuerType\"\n },\n \"credentialSubject\": {\n \"anyOf\": [\n {\n \"type\": \"array\",\n \"items\": {\n \"$ref\": \"#/components/schemas/CredentialSubject\"\n }\n },\n {\n \"$ref\": \"#/components/schemas/CredentialSubject\"\n }\n ]\n },\n \"type\": {\n \"anyOf\": [\n {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n }\n },\n {\n \"type\": \"string\"\n }\n ]\n },\n \"@context\": {\n \"anyOf\": [\n {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n }\n },\n {\n \"type\": \"string\"\n }\n ]\n },\n \"issuanceDate\": {\n \"type\": \"string\"\n },\n \"expirationDate\": {\n \"type\": \"string\"\n },\n \"credentialStatus\": {\n \"$ref\": \"#/components/schemas/CredentialStatusSP\"\n },\n \"id\": {\n \"type\": \"string\"\n },\n \"validFrom\": {\n \"type\": \"string\"\n },\n \"validUntil\": {\n \"type\": \"string\"\n },\n \"proof\": {\n \"anyOf\": [\n {\n \"$ref\": \"#/components/schemas/CredentialProofSP\"\n },\n {\n \"type\": \"array\",\n \"items\": {\n \"$ref\": \"#/components/schemas/CredentialProofSP\"\n }\n },\n {\n \"$ref\": \"#/components/schemas/ProofType\"\n }\n ]\n }\n },\n \"required\": [\"@context\", \"credentialSubject\", \"issuanceDate\", \"issuer\", \"proof\"]\n },\n \"CredentialStatusSP\": {\n \"type\": \"object\",\n \"properties\": {\n \"id\": {\n \"type\": \"string\"\n },\n \"type\": {\n \"type\": \"string\"\n },\n \"revocationListIndex\": {\n \"type\": \"string\"\n },\n \"revocationListCredential\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\"id\", \"type\"]\n },\n \"CredentialProofSP\": {\n \"type\": \"object\",\n \"properties\": {\n \"type\": {\n \"anyOf\": [\n {\n \"type\": \"string\"\n },\n {\n \"$ref\": \"#/components/schemas/IProofType\"\n }\n ]\n },\n \"created\": {\n \"type\": \"string\"\n },\n \"proofPurpose\": {\n \"anyOf\": [\n {\n \"$ref\": \"#/components/schemas/IProofPurpose\"\n },\n {\n \"type\": \"string\"\n }\n ]\n },\n \"verificationMethod\": {\n \"type\": \"string\"\n },\n \"challenge\": {\n \"type\": \"string\"\n },\n \"domain\": {\n \"type\": \"string\"\n },\n \"proofValue\": {\n \"type\": \"string\"\n },\n \"jws\": {\n \"type\": \"string\"\n },\n \"nonce\": {\n \"type\": \"string\"\n },\n \"requiredRevealStatements\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n }\n }\n },\n \"required\": [\"type\", \"created\", \"proofPurpose\", \"verificationMethod\"],\n \"additionalProperties\": {\n \"anyOf\": [\n {\n \"type\": \"string\"\n },\n {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n }\n },\n {\n \"not\": {}\n }\n ]\n }\n },\n \"IProofType\": {\n \"type\": \"string\",\n \"enum\": [\n \"Ed25519Signature2018\",\n \"Ed25519Signature2020\",\n \"EcdsaSecp256k1Signature2019\",\n \"EcdsaSecp256k1RecoverySignature2020\",\n \"JsonWebSignature2020\",\n \"RsaSignature2018\",\n \"GpgSignature2020\",\n \"JcsEd25519Signature2020\",\n \"BbsBlsSignatureProof2020\",\n \"BbsBlsBoundSignatureProof2020\",\n \"JwtProof2020\",\n \"SdJwtProof2024\",\n \"MsoMdocProof2024\"\n ]\n },\n \"IProofPurpose\": {\n \"type\": \"string\",\n \"enum\": [\n \"verificationMethod\",\n \"assertionMethod\",\n \"authentication\",\n \"keyAgreement\",\n \"contactAgreement\",\n \"capabilityInvocation\",\n \"capabilityDelegation\"\n ]\n },\n \"ProofType\": {\n \"type\": \"object\",\n \"properties\": {\n \"type\": {\n \"type\": \"string\"\n }\n },\n \"description\": \"A proof property of a {@link VerifiableCredential } or {@link VerifiablePresentation }\"\n }\n },\n \"methods\": {\n \"vcApiClientIssueCredential\": {\n \"description\": \"\",\n \"arguments\": {\n \"$ref\": \"#/components/schemas/IIssueCredentialArgs\"\n },\n \"returnType\": {\n \"$ref\": \"#/components/schemas/VerifiableCredentialSP\"\n }\n }\n }\n }\n }\n}\n","import { CredentialPayload, IAgentContext, IPluginMethodMap } from '@veramo/core'\nimport { VerifiableCredentialSP } from '@sphereon/ssi-sdk.core'\n\nexport interface IVcApiIssuerClient extends IPluginMethodMap {\n vcApiClientIssueCredential(args: IIssueCredentialArgs, context: IRequiredContext): Promise<VerifiableCredentialSP>\n}\n\nexport interface IVcApiIssuerArgs {\n issueUrl: string\n authorizationToken: string\n}\n\nexport interface IIssueCredentialArgs {\n credential: CredentialPayload\n}\n\nexport enum events {\n CREDENTIAL_ISSUED = 'credentialIssued',\n}\n\nexport type IRequiredContext = IAgentContext<Record<string, never>>\n","import { IAgentPlugin } from '@veramo/core'\n\nimport { schema } from '../index'\nimport { events, IIssueCredentialArgs, IRequiredContext, IVcApiIssuerClient, IVcApiIssuerArgs } from '../types/IVcApiIssuerClient'\nimport { VerifiableCredentialSP } from '@sphereon/ssi-sdk.core'\n\nimport { fetch } from 'cross-fetch'\n\n/**\n * {@inheritDoc IVcApiIssuer}\n */\nexport class VcApiIssuerClient implements IAgentPlugin {\n readonly schema = schema.IVcApiIssuer\n readonly methods: IVcApiIssuerClient = {\n vcApiClientIssueCredential: this.vcApiClientIssueCredential.bind(this),\n }\n private readonly issueUrl: string\n private readonly authorizationToken: string\n\n constructor(options: IVcApiIssuerArgs) {\n this.issueUrl = options.issueUrl\n this.authorizationToken = options.authorizationToken\n }\n\n /** {@inheritDoc IVcApiIssuer.vcApiClientIssueCredential} */\n private async vcApiClientIssueCredential(args: IIssueCredentialArgs, context: IRequiredContext): Promise<VerifiableCredentialSP> {\n return await fetch(this.issueUrl, {\n method: 'post',\n headers: {\n Accept: 'application/json',\n 'Content-Type': 'application/json',\n Authorization: `bearer ${this.authorizationToken}`,\n },\n body: JSON.stringify({ credential: args.credential }),\n }).then(async (response) => {\n if (response.status >= 400) {\n throw new Error(await response.text())\n } else {\n const verifiableCredential = response.json()\n await context.agent.emit(events.CREDENTIAL_ISSUED, verifiableCredential)\n return verifiableCredential\n }\n })\n }\n}\n","/**\n * @public\n */\nconst schema = require('../plugin.schema.json')\nexport { schema }\nexport { VcApiIssuerClient } from './agent/VcApiIssuerClient'\nexport * from './types/IVcApiIssuerClient'\n"],"mappings":";;;;;;;;AAAA;AAAA;AAAA;AAAA,MACE,oBAAsB;AAAA,QACpB,YAAc;AAAA,UACZ,SAAW;AAAA,YACT,sBAAwB;AAAA,cACtB,MAAQ;AAAA,cACR,YAAc;AAAA,gBACZ,YAAc;AAAA,kBACZ,MAAQ;AAAA,gBACV;AAAA,cACF;AAAA,cACA,UAAY,CAAC,YAAY;AAAA,cACzB,sBAAwB;AAAA,YAC1B;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,CAAC,QAAQ;AAAA,cACrB,a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AAA,EAAGC,KAAK,OAAOC,aAAAA;AACb,UAAIA,SAASC,UAAU,KAAK;AAC1B,cAAM,IAAIC,MAAM,MAAMF,SAASG,KAAI,CAAA;MACrC,OAAO;AACL,cAAMC,uBAAuBJ,SAASK,KAAI;AAC1C,cAAMhB,QAAQiB,MAAMC,KAAKC,OAAOC,mBAAmBL,oBAAAA;AACnD,eAAOA;MACT;IACF,CAAA;EACF;AACF;;;ACzCA,IAAMM,SAASC;","names":["events","fetch","VcApiIssuerClient","schema","IVcApiIssuer","methods","vcApiClientIssueCredential","bind","issueUrl","authorizationToken","constructor","options","args","context","fetch","method","headers","Accept","Authorization","body","JSON","stringify","credential","then","response","status","Error","text","verifiableCredential","json","agent","emit","events","CREDENTIAL_ISSUED","schema","require"]}
package/package.json CHANGED
@@ -1,22 +1,34 @@
1
1
  {
2
2
  "name": "@sphereon/ssi-sdk.w3c-vc-api-issuer-rest-client",
3
- "version": "0.33.1-next.3+fd1a6fba",
3
+ "version": "0.33.1-next.73+be17b2cb",
4
4
  "source": "src/index.ts",
5
- "main": "dist/index.js",
6
- "types": "dist/index.d.ts",
5
+ "type": "module",
6
+ "main": "./dist/index.cjs",
7
+ "module": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ "react-native": "./dist/index.js",
11
+ "import": {
12
+ "types": "./dist/index.d.ts",
13
+ "import": "./dist/index.js"
14
+ },
15
+ "require": {
16
+ "types": "./dist/index.d.cts",
17
+ "require": "./dist/index.cjs"
18
+ }
19
+ },
7
20
  "veramo": {
8
21
  "pluginInterfaces": {
9
22
  "IVcApiIssuerClient": "./src/types/IVcApiIssuerClient.ts"
10
23
  }
11
24
  },
12
25
  "scripts": {
13
- "build": "tsc --build",
14
- "build:clean": "tsc --build --clean && tsc --build",
26
+ "build": "tsup --config ../../tsup.config.ts --tsconfig ../../tsconfig.tsup.json",
15
27
  "generate-plugin-schema": "ts-node ../../packages/dev/bin/sphereon.js dev generate-plugin-schema"
16
28
  },
17
29
  "dependencies": {
18
- "@sphereon/ssi-sdk.core": "0.33.1-next.3+fd1a6fba",
19
- "@sphereon/ssi-sdk.dev": "0.33.1-next.3+fd1a6fba",
30
+ "@sphereon/ssi-sdk.core": "0.33.1-next.73+be17b2cb",
31
+ "@sphereon/ssi-sdk.dev": "0.33.1-next.73+be17b2cb",
20
32
  "@veramo/core": "4.2.0",
21
33
  "cross-fetch": "^3.1.8"
22
34
  },
@@ -26,8 +38,8 @@
26
38
  "@veramo/remote-server": "4.2.0"
27
39
  },
28
40
  "files": [
29
- "dist/**/*",
30
- "src/**/*",
41
+ "dist",
42
+ "src",
31
43
  "README.md",
32
44
  "plugin.schema.json",
33
45
  "LICENSE"
@@ -47,6 +59,5 @@
47
59
  "API",
48
60
  "Issuer"
49
61
  ],
50
- "nx": {},
51
- "gitHead": "fd1a6fba306a83a73ff7c531db87fa207dbf436d"
62
+ "gitHead": "be17b2cb752a6e5368119259e89a1f2a99f56848"
52
63
  }
@@ -9,9 +9,8 @@
9
9
  "$ref": "#/components/schemas/CredentialPayload"
10
10
  }
11
11
  },
12
- "required": [
13
- "credential"
14
- ]
12
+ "required": ["credential"],
13
+ "additionalProperties": false
15
14
  },
16
15
  "CredentialPayload": {
17
16
  "type": "object",
@@ -47,9 +46,7 @@
47
46
  "type": "string"
48
47
  }
49
48
  },
50
- "required": [
51
- "issuer"
52
- ],
49
+ "required": ["issuer"],
53
50
  "description": "Used as input when creating Verifiable Credentials"
54
51
  },
55
52
  "IssuerType": {
@@ -61,9 +58,7 @@
61
58
  "type": "string"
62
59
  }
63
60
  },
64
- "required": [
65
- "id"
66
- ]
61
+ "required": ["id"]
67
62
  },
68
63
  {
69
64
  "type": "string"
@@ -102,10 +97,7 @@
102
97
  "type": "string"
103
98
  }
104
99
  },
105
- "required": [
106
- "id",
107
- "type"
108
- ],
100
+ "required": ["id", "type"],
109
101
  "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 }"
110
102
  },
111
103
  "VerifiableCredentialSP": {
@@ -188,13 +180,7 @@
188
180
  ]
189
181
  }
190
182
  },
191
- "required": [
192
- "@context",
193
- "credentialSubject",
194
- "issuanceDate",
195
- "issuer",
196
- "proof"
197
- ]
183
+ "required": ["@context", "credentialSubject", "issuanceDate", "issuer", "proof"]
198
184
  },
199
185
  "CredentialStatusSP": {
200
186
  "type": "object",
@@ -212,10 +198,7 @@
212
198
  "type": "string"
213
199
  }
214
200
  },
215
- "required": [
216
- "id",
217
- "type"
218
- ]
201
+ "required": ["id", "type"]
219
202
  },
220
203
  "CredentialProofSP": {
221
204
  "type": "object",
@@ -268,12 +251,7 @@
268
251
  }
269
252
  }
270
253
  },
271
- "required": [
272
- "type",
273
- "created",
274
- "proofPurpose",
275
- "verificationMethod"
276
- ],
254
+ "required": ["type", "created", "proofPurpose", "verificationMethod"],
277
255
  "additionalProperties": {
278
256
  "anyOf": [
279
257
  {
@@ -344,4 +322,4 @@
344
322
  }
345
323
  }
346
324
  }
347
- }
325
+ }
@@ -1,15 +0,0 @@
1
- import { IAgentPlugin } from '@veramo/core';
2
- import { IVcApiIssuerClient, IVcApiIssuerArgs } from '../types/IVcApiIssuerClient';
3
- /**
4
- * {@inheritDoc IVcApiIssuer}
5
- */
6
- export declare class VcApiIssuerClient implements IAgentPlugin {
7
- readonly schema: any;
8
- readonly methods: IVcApiIssuerClient;
9
- private readonly issueUrl;
10
- private readonly authorizationToken;
11
- constructor(options: IVcApiIssuerArgs);
12
- /** {@inheritDoc IVcApiIssuer.vcApiClientIssueCredential} */
13
- private vcApiClientIssueCredential;
14
- }
15
- //# sourceMappingURL=VcApiIssuerClient.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"VcApiIssuerClient.d.ts","sourceRoot":"","sources":["../../src/agent/VcApiIssuerClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAG3C,OAAO,EAAkD,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AAKlI;;GAEG;AACH,qBAAa,iBAAkB,YAAW,YAAY;IACpD,QAAQ,CAAC,MAAM,MAAsB;IACrC,QAAQ,CAAC,OAAO,EAAE,kBAAkB,CAEnC;IACD,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAQ;IACjC,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAQ;gBAE/B,OAAO,EAAE,gBAAgB;IAKrC,4DAA4D;YAC9C,0BAA0B;CAmBzC"}