@verana-labs/vs-agent-client 2.0.0-dev.10 → 2.0.0-dev.101

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.
Files changed (86) hide show
  1. package/README.md +58 -111
  2. package/build/ApiClient.d.ts +12 -39
  3. package/build/ApiClient.js +13 -40
  4. package/build/ApiClient.js.map +1 -1
  5. package/build/api/AgentApi.d.ts +9 -0
  6. package/build/api/AgentApi.js +19 -0
  7. package/build/api/AgentApi.js.map +1 -0
  8. package/build/api/AnoncredsApi.d.ts +15 -0
  9. package/build/api/AnoncredsApi.js +37 -0
  10. package/build/api/AnoncredsApi.js.map +1 -0
  11. package/build/api/AuthApi.d.ts +8 -0
  12. package/build/api/AuthApi.js +16 -0
  13. package/build/api/AuthApi.js.map +1 -0
  14. package/build/api/DidcommApi.d.ts +44 -0
  15. package/build/api/DidcommApi.js +124 -0
  16. package/build/api/DidcommApi.js.map +1 -0
  17. package/build/api/VtApi.d.ts +17 -0
  18. package/build/api/VtApi.js +51 -0
  19. package/build/api/VtApi.js.map +1 -0
  20. package/build/events.d.ts +7 -0
  21. package/build/events.js +52 -0
  22. package/build/events.js.map +1 -0
  23. package/build/http.d.ts +19 -0
  24. package/build/http.js +61 -0
  25. package/build/http.js.map +1 -0
  26. package/build/index.d.ts +7 -3
  27. package/build/index.js +7 -3
  28. package/build/index.js.map +1 -1
  29. package/build/types/agent.d.ts +10 -0
  30. package/build/types/agent.js +3 -0
  31. package/build/types/agent.js.map +1 -0
  32. package/build/types/anoncreds.d.ts +48 -0
  33. package/build/types/anoncreds.js +3 -0
  34. package/build/types/anoncreds.js.map +1 -0
  35. package/build/types/auth.d.ts +18 -0
  36. package/build/types/auth.js +3 -0
  37. package/build/types/auth.js.map +1 -0
  38. package/build/types/common.d.ts +34 -0
  39. package/build/types/common.js +3 -0
  40. package/build/types/common.js.map +1 -0
  41. package/build/types/didcomm.d.ts +312 -0
  42. package/build/types/didcomm.js +3 -0
  43. package/build/types/didcomm.js.map +1 -0
  44. package/build/types/events.d.ts +193 -0
  45. package/build/types/events.js +3 -0
  46. package/build/types/events.js.map +1 -0
  47. package/build/types/index.d.ts +7 -1
  48. package/build/types/index.js +7 -1
  49. package/build/types/index.js.map +1 -1
  50. package/build/types/vt.d.ts +116 -0
  51. package/build/types/vt.js +3 -0
  52. package/build/types/vt.js.map +1 -0
  53. package/package.json +3 -15
  54. package/build/handlers/ExpressEventHandler.d.ts +0 -71
  55. package/build/handlers/ExpressEventHandler.js +0 -102
  56. package/build/handlers/ExpressEventHandler.js.map +0 -1
  57. package/build/handlers/index.d.ts +0 -1
  58. package/build/handlers/index.js +0 -18
  59. package/build/handlers/index.js.map +0 -1
  60. package/build/services/CredentialTypeService.d.ts +0 -19
  61. package/build/services/CredentialTypeService.js +0 -66
  62. package/build/services/CredentialTypeService.js.map +0 -1
  63. package/build/services/InvitationService.d.ts +0 -16
  64. package/build/services/InvitationService.js +0 -56
  65. package/build/services/InvitationService.js.map +0 -1
  66. package/build/services/MessageService.d.ts +0 -18
  67. package/build/services/MessageService.js +0 -57
  68. package/build/services/MessageService.js.map +0 -1
  69. package/build/services/RevocationRegistryService.d.ts +0 -18
  70. package/build/services/RevocationRegistryService.js +0 -58
  71. package/build/services/RevocationRegistryService.js.map +0 -1
  72. package/build/services/TrustCredentialService.d.ts +0 -33
  73. package/build/services/TrustCredentialService.js +0 -75
  74. package/build/services/TrustCredentialService.js.map +0 -1
  75. package/build/services/index.d.ts +0 -5
  76. package/build/services/index.js +0 -22
  77. package/build/services/index.js.map +0 -1
  78. package/build/types/enums.d.ts +0 -3
  79. package/build/types/enums.js +0 -9
  80. package/build/types/enums.js.map +0 -1
  81. package/build/utils/HttpUtils.d.ts +0 -4
  82. package/build/utils/HttpUtils.js +0 -18
  83. package/build/utils/HttpUtils.js.map +0 -1
  84. package/build/utils/index.d.ts +0 -1
  85. package/build/utils/index.js +0 -18
  86. package/build/utils/index.js.map +0 -1
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@verana-labs/vs-agent-client",
3
3
  "main": "build/index",
4
4
  "types": "build/index",
5
- "version": "2.0.0-dev.10",
5
+ "version": "2.0.0-dev.101",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "https://github.com/verana-labs/vs-agent"
@@ -14,20 +14,8 @@
14
14
  "access": "public"
15
15
  },
16
16
  "license": "Apache-2.0",
17
- "dependencies": {
18
- "class-transformer": "0.5.1",
19
- "class-validator": "0.14.1",
20
- "express": "^4.18.1",
21
- "tslog": "^4.8.2",
22
- "@verana-labs/vs-agent-model": "2.0.0-dev.10"
23
- },
24
- "devDependencies": {
25
- "@nestjs/common": "^10.0.0",
26
- "@types/express": "^4.17.13",
27
- "ts-node-dev": "^2.0.0"
28
- },
29
- "peerDependencies": {
30
- "@credo-ts/core": "0.7.1-pr-2704-20260630143332"
17
+ "engines": {
18
+ "node": ">=18"
31
19
  },
32
20
  "scripts": {
33
21
  "build": "pnpm run clean && pnpm run compile",
@@ -1,71 +0,0 @@
1
- import { Express, Request, Response } from 'express';
2
- type Handler = (req: Request, res: Response) => Promise<void>;
3
- /**
4
- * `ExpressEventHandler` class for defining express event handling methods.
5
- * Extend this class in other projects to implement specific endpoint handlers
6
- * for different types of events. Each method is mapped to an HTTP POST endpoint
7
- * with a specified route on express structure
8
- *
9
- * Usage:
10
- * Extend `EventHandler` in your subclass and implement each method to
11
- * handle incoming events as per the business requirements.
12
- */
13
- export declare class ExpressEventHandler {
14
- private app;
15
- constructor(app: Express);
16
- /**
17
- * Handles the event for updating the state of a connection.
18
- *
19
- * Endpoint: POST `/connection-state-updated`
20
- * Expected Payload: an `Event` object containing the connection state update details.
21
- *
22
- * @param {Event} event - The event object containing the connection state update details.
23
- * @throws {Error} Throws an error if not implemented by subclass.
24
- * @example
25
- * const event = {
26
- * type: "connection-state-updated",
27
- * connectionId: "e2037401-aa91-4302-8927-ac07f06d9d60",
28
- * invitationId: "2232eb0f-643b-4a00-b014-3d1d85b8f4de",
29
- * state: "completed",
30
- * }
31
- */
32
- connectionState(handler: Handler): void;
33
- /**
34
- * Handles the event for updating the state of a message.
35
- *
36
- * Endpoint: POST `/message-state-updated`
37
- * Expected Payload: an `Event` object containing the new message state details.
38
- *
39
- * @param {Event} event - The event object containing the message state update details.
40
- * @throws {Error} Throws an error if not implemented by subclass.
41
- * @example
42
- * const event = {
43
- * type: "message-state-updated",
44
- * messageId: "12345",
45
- * state: "delivered",
46
- * timestamp: "2023-10-01T12:00:00Z",
47
- * connectionId: "conn123"
48
- * }
49
- */
50
- messageStateUpdated(handler: Handler): void;
51
- /**
52
- * Handles the event when a new message is received.
53
- *
54
- * Endpoint: POST `/message-received`
55
- * Expected Payload: an `Event` object containing the message details.
56
- *
57
- * @param {Event} event - The event object containing the message details.
58
- * @throws {Error} Throws an error if not implemented by subclass.
59
- * @example
60
- * const event = {
61
- * type: "message-received",
62
- * message: {
63
- * type: text,
64
- * content: "test"
65
- * },
66
- * timestamp: "2023-10-01T12:00:00Z",
67
- * }
68
- */
69
- messageReceived(handler: Handler): void;
70
- }
71
- export {};
@@ -1,102 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ExpressEventHandler = void 0;
4
- const vs_agent_model_1 = require("@verana-labs/vs-agent-model");
5
- /**
6
- * `ExpressEventHandler` class for defining express event handling methods.
7
- * Extend this class in other projects to implement specific endpoint handlers
8
- * for different types of events. Each method is mapped to an HTTP POST endpoint
9
- * with a specified route on express structure
10
- *
11
- * Usage:
12
- * Extend `EventHandler` in your subclass and implement each method to
13
- * handle incoming events as per the business requirements.
14
- */
15
- class ExpressEventHandler {
16
- constructor(app) {
17
- this.app = app;
18
- }
19
- /**
20
- * Handles the event for updating the state of a connection.
21
- *
22
- * Endpoint: POST `/connection-state-updated`
23
- * Expected Payload: an `Event` object containing the connection state update details.
24
- *
25
- * @param {Event} event - The event object containing the connection state update details.
26
- * @throws {Error} Throws an error if not implemented by subclass.
27
- * @example
28
- * const event = {
29
- * type: "connection-state-updated",
30
- * connectionId: "e2037401-aa91-4302-8927-ac07f06d9d60",
31
- * invitationId: "2232eb0f-643b-4a00-b014-3d1d85b8f4de",
32
- * state: "completed",
33
- * }
34
- */
35
- connectionState(handler) {
36
- this.app.post(`/${vs_agent_model_1.EventType.ConnectionStateUpdated}`, async (req, res) => {
37
- try {
38
- await handler(req, res);
39
- }
40
- catch (error) {
41
- res.status(500).json({ message: 'Internal Server Error', error });
42
- }
43
- });
44
- }
45
- /**
46
- * Handles the event for updating the state of a message.
47
- *
48
- * Endpoint: POST `/message-state-updated`
49
- * Expected Payload: an `Event` object containing the new message state details.
50
- *
51
- * @param {Event} event - The event object containing the message state update details.
52
- * @throws {Error} Throws an error if not implemented by subclass.
53
- * @example
54
- * const event = {
55
- * type: "message-state-updated",
56
- * messageId: "12345",
57
- * state: "delivered",
58
- * timestamp: "2023-10-01T12:00:00Z",
59
- * connectionId: "conn123"
60
- * }
61
- */
62
- messageStateUpdated(handler) {
63
- this.app.post(`/${vs_agent_model_1.EventType.MessageStateUpdated}`, async (req, res) => {
64
- try {
65
- await handler(req, res);
66
- }
67
- catch (error) {
68
- res.status(500).json({ message: 'Internal Server Error', error });
69
- }
70
- });
71
- }
72
- /**
73
- * Handles the event when a new message is received.
74
- *
75
- * Endpoint: POST `/message-received`
76
- * Expected Payload: an `Event` object containing the message details.
77
- *
78
- * @param {Event} event - The event object containing the message details.
79
- * @throws {Error} Throws an error if not implemented by subclass.
80
- * @example
81
- * const event = {
82
- * type: "message-received",
83
- * message: {
84
- * type: text,
85
- * content: "test"
86
- * },
87
- * timestamp: "2023-10-01T12:00:00Z",
88
- * }
89
- */
90
- messageReceived(handler) {
91
- this.app.post(`/${vs_agent_model_1.EventType.MessageReceived}`, async (req, res) => {
92
- try {
93
- await handler(req, res);
94
- }
95
- catch (error) {
96
- res.status(500).json({ message: 'Internal Server Error', error });
97
- }
98
- });
99
- }
100
- }
101
- exports.ExpressEventHandler = ExpressEventHandler;
102
- //# sourceMappingURL=ExpressEventHandler.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ExpressEventHandler.js","sourceRoot":"","sources":["../../src/handlers/ExpressEventHandler.ts"],"names":[],"mappings":";;;AAAA,gEAAuD;AAKvD;;;;;;;;;GASG;AACH,MAAa,mBAAmB;IAG9B,YAAY,GAAY;QACtB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAA;IAChB,CAAC;IAED;;;;;;;;;;;;;;;OAeG;IACI,eAAe,CAAC,OAAgB;QACrC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,0BAAS,CAAC,sBAAsB,EAAE,EAAE,KAAK,EAAE,GAAY,EAAE,GAAa,EAAE,EAAE;YAC1F,IAAI,CAAC;gBACH,MAAM,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;YACzB,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,uBAAuB,EAAE,KAAK,EAAE,CAAC,CAAA;YACnE,CAAC;QACH,CAAC,CAAC,CAAA;IACJ,CAAC;IAED;;;;;;;;;;;;;;;;OAgBG;IACI,mBAAmB,CAAC,OAAgB;QACzC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,0BAAS,CAAC,mBAAmB,EAAE,EAAE,KAAK,EAAE,GAAY,EAAE,GAAa,EAAE,EAAE;YACvF,IAAI,CAAC;gBACH,MAAM,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;YACzB,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,uBAAuB,EAAE,KAAK,EAAE,CAAC,CAAA;YACnE,CAAC;QACH,CAAC,CAAC,CAAA;IACJ,CAAC;IAED;;;;;;;;;;;;;;;;;OAiBG;IACI,eAAe,CAAC,OAAgB;QACrC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,0BAAS,CAAC,eAAe,EAAE,EAAE,KAAK,EAAE,GAAY,EAAE,GAAa,EAAE,EAAE;YACnF,IAAI,CAAC;gBACH,MAAM,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;YACzB,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,uBAAuB,EAAE,KAAK,EAAE,CAAC,CAAA;YACnE,CAAC;QACH,CAAC,CAAC,CAAA;IACJ,CAAC;CACF;AAvFD,kDAuFC"}
@@ -1 +0,0 @@
1
- export * from './ExpressEventHandler';
@@ -1,18 +0,0 @@
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
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./ExpressEventHandler"), exports);
18
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/handlers/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wDAAqC"}
@@ -1,19 +0,0 @@
1
- import { CredentialTypeInfo, CredentialTypeResult, ImportCredentialTypeOptions } from '@verana-labs/vs-agent-model';
2
- import { ApiVersion } from '../types/enums';
3
- /**
4
- * `CredentialTypeService` class for managing credential types and interacting with
5
- * the available endpoints related to credential types in the Agent Service.
6
- *
7
- * This class provides methods for querying, creating, and managing credential types.
8
- * For a list of available endpoints and functionality, refer to the methods within this class.
9
- */
10
- export declare class CredentialTypeService {
11
- private baseURL;
12
- private version;
13
- private url;
14
- constructor(baseURL: string, version: ApiVersion);
15
- import(importData: ImportCredentialTypeOptions): Promise<CredentialTypeInfo>;
16
- export(credentialTypeId: string): Promise<unknown>;
17
- create(credentialType: CredentialTypeInfo): Promise<CredentialTypeInfo>;
18
- getAll(): Promise<CredentialTypeResult[]>;
19
- }
@@ -1,66 +0,0 @@
1
- "use strict";
2
- // src/services/CredentialTypeService.ts
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.CredentialTypeService = void 0;
5
- const tslog_1 = require("tslog");
6
- const logger = new tslog_1.Logger({
7
- name: 'CredentialTypeService',
8
- type: 'pretty',
9
- prettyLogTemplate: '{{logLevelName}} [{{name}}]: ',
10
- });
11
- /**
12
- * `CredentialTypeService` class for managing credential types and interacting with
13
- * the available endpoints related to credential types in the Agent Service.
14
- *
15
- * This class provides methods for querying, creating, and managing credential types.
16
- * For a list of available endpoints and functionality, refer to the methods within this class.
17
- */
18
- class CredentialTypeService {
19
- constructor(baseURL, version) {
20
- this.baseURL = baseURL;
21
- this.version = version;
22
- this.url = `${this.baseURL.replace(/\/$/, '')}/${this.version}/credential-types`;
23
- }
24
- async import(importData) {
25
- logger.info(`Importing credential type ${importData.id}`);
26
- const response = await fetch(`${this.url}/import`, {
27
- method: 'POST',
28
- body: JSON.stringify(importData),
29
- headers: { accept: 'application/json', 'Content-Type': 'application/json' },
30
- });
31
- if (!response.ok)
32
- throw new Error(`Cannot import credential type: status ${response.status}`);
33
- return (await response.json());
34
- }
35
- async export(credentialTypeId) {
36
- logger.info(`Exporting credential type ${credentialTypeId}`);
37
- const response = await fetch(`${this.url}/export/${encodeURIComponent(credentialTypeId)}`, {
38
- method: 'GET',
39
- headers: { accept: 'application/json' },
40
- });
41
- if (!response.ok)
42
- throw new Error(`Cannot export credential type: status ${response.status}}`);
43
- return await response.json();
44
- }
45
- async create(credentialType) {
46
- const response = await fetch(`${this.url}`, {
47
- method: 'POST',
48
- headers: { 'Content-Type': 'application/json' },
49
- body: JSON.stringify(credentialType),
50
- });
51
- return (await response.json());
52
- }
53
- async getAll() {
54
- const response = await fetch(this.url, {
55
- method: 'GET',
56
- headers: { accept: 'application/json', 'Content-Type': 'application/json' },
57
- });
58
- const types = await response.json();
59
- if (!Array.isArray(types)) {
60
- throw new Error('Invalid response from VS Agent');
61
- }
62
- return types.map(value => value);
63
- }
64
- }
65
- exports.CredentialTypeService = CredentialTypeService;
66
- //# sourceMappingURL=CredentialTypeService.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CredentialTypeService.js","sourceRoot":"","sources":["../../src/services/CredentialTypeService.ts"],"names":[],"mappings":";AAAA,wCAAwC;;;AAOxC,iCAA8B;AAI9B,MAAM,MAAM,GAAG,IAAI,cAAM,CAAC;IACxB,IAAI,EAAE,uBAAuB;IAC7B,IAAI,EAAE,QAAQ;IACd,iBAAiB,EAAE,+BAA+B;CACnD,CAAC,CAAA;AAEF;;;;;;GAMG;AACH,MAAa,qBAAqB;IAGhC,YACU,OAAe,EACf,OAAmB;QADnB,YAAO,GAAP,OAAO,CAAQ;QACf,YAAO,GAAP,OAAO,CAAY;QAE3B,IAAI,CAAC,GAAG,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,IAAI,CAAC,OAAO,mBAAmB,CAAA;IAClF,CAAC;IAEM,KAAK,CAAC,MAAM,CAAC,UAAuC;QACzD,MAAM,CAAC,IAAI,CAAC,6BAA6B,UAAU,CAAC,EAAE,EAAE,CAAC,CAAA;QACzD,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,IAAI,CAAC,GAAG,SAAS,EAAE;YACjD,MAAM,EAAE,MAAM;YAC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,CAAC,GAAG,EAAE;YACrC,MAAM,EAAE,KAAK;YACb,OAAO,EAAE,EAAE,MAAM,EAAE,kBAAkB,EAAE,cAAc,EAAE,kBAAkB,EAAE;SAC5E,CAAC,CAAA;QAEF,MAAM,KAAK,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAA;QAEnC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;YAC1B,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAA;QACnD,CAAC;QAED,OAAO,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,KAA6B,CAAC,CAAA;IAC1D,CAAC;CACF;AAxDD,sDAwDC"}
@@ -1,16 +0,0 @@
1
- import { CreateCredentialOfferOptions, CreateCredentialOfferResult, CreateInvitationResult, CreatePresentationRequestOptions, CreatePresentationRequestResult } from '@verana-labs/vs-agent-model';
2
- import { ApiVersion } from '../types/enums';
3
- /**
4
- * `InvitationService` class for interacting with the available endpoints related to invitations.
5
- *
6
- * For a list of available endpoints and functionality, refer to the methods within this class.
7
- */
8
- export declare class InvitationService {
9
- private baseURL;
10
- private version;
11
- private url;
12
- constructor(baseURL: string, version: ApiVersion);
13
- create(): Promise<CreateInvitationResult>;
14
- createPresentationRequest(options: CreatePresentationRequestOptions): Promise<CreatePresentationRequestResult>;
15
- createCredentialOffer(options: CreateCredentialOfferOptions): Promise<CreateCredentialOfferResult>;
16
- }
@@ -1,56 +0,0 @@
1
- "use strict";
2
- // src/services/CredentialTypeService.ts
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.InvitationService = void 0;
5
- const tslog_1 = require("tslog");
6
- const logger = new tslog_1.Logger({
7
- name: 'InvitationService',
8
- type: 'pretty',
9
- prettyLogTemplate: '{{logLevelName}} [{{name}}]: ',
10
- });
11
- /**
12
- * `InvitationService` class for interacting with the available endpoints related to invitations.
13
- *
14
- * For a list of available endpoints and functionality, refer to the methods within this class.
15
- */
16
- class InvitationService {
17
- constructor(baseURL, version) {
18
- this.baseURL = baseURL;
19
- this.version = version;
20
- this.url = `${this.baseURL.replace(/\/$/, '')}/${this.version}/invitation`;
21
- }
22
- async create() {
23
- logger.debug('create()');
24
- const response = await fetch(`${this.url}`, {
25
- method: 'GET',
26
- headers: { accept: 'application/json', 'Content-Type': 'application/json' },
27
- });
28
- if (!response.ok)
29
- throw new Error(`Cannot create credential offer: status ${response.status}`);
30
- return (await response.json());
31
- }
32
- async createPresentationRequest(options) {
33
- logger.info(`createPresentationRequest(): ${JSON.stringify(options)}`);
34
- const response = await fetch(`${this.url}/presentation-request`, {
35
- method: 'POST',
36
- body: JSON.stringify(options),
37
- headers: { accept: 'application/json', 'Content-Type': 'application/json' },
38
- });
39
- if (!response.ok)
40
- throw new Error(`Cannot create presentation request: status ${response.status}`);
41
- return (await response.json());
42
- }
43
- async createCredentialOffer(options) {
44
- logger.info(`createCredentialOffer(): ${JSON.stringify(options)}`);
45
- const response = await fetch(`${this.url}/credential-offer`, {
46
- method: 'POST',
47
- body: JSON.stringify(options),
48
- headers: { accept: 'application/json', 'Content-Type': 'application/json' },
49
- });
50
- if (!response.ok)
51
- throw new Error(`Cannot create credential offer: status ${response.status}`);
52
- return (await response.json());
53
- }
54
- }
55
- exports.InvitationService = InvitationService;
56
- //# sourceMappingURL=InvitationService.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"InvitationService.js","sourceRoot":"","sources":["../../src/services/InvitationService.ts"],"names":[],"mappings":";AAAA,wCAAwC;;;AASxC,iCAA8B;AAI9B,MAAM,MAAM,GAAG,IAAI,cAAM,CAAC;IACxB,IAAI,EAAE,mBAAmB;IACzB,IAAI,EAAE,QAAQ;IACd,iBAAiB,EAAE,+BAA+B;CACnD,CAAC,CAAA;AAEF;;;;GAIG;AACH,MAAa,iBAAiB;IAG5B,YACU,OAAe,EACf,OAAmB;QADnB,YAAO,GAAP,OAAO,CAAQ;QACf,YAAO,GAAP,OAAO,CAAY;QAE3B,IAAI,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AAI,CAAC,4BAA4B,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC,CAAA;QAElE,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,IAAI,CAAC,GAAG,mBAAmB,EAAE;YAC3D,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;YAC7B,OAAO,EAAE,EAAE,MAAM,EAAE,kBAAkB,EAAE,cAAc,EAAE,kBAAkB,EAAE;SAC5E,CAAC,CAAA;QACF,IAAI,CAAC,QAAQ,CAAC,EAAE;YAAE,MAAM,IAAI,KAAK,CAAC,0CAA0C,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAA;QAE9F,OAAO,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAgC,CAAA;IAC/D,CAAC;CACF;AAlDD,8CAkDC"}
@@ -1,18 +0,0 @@
1
- import { BaseMessage } from '@verana-labs/vs-agent-model';
2
- import { ApiVersion } from '../types/enums';
3
- /**
4
- * `MessageService` class for handling message-related endpoints in the Agent Service.
5
- * This class is based on the `BaseMessage` from the `@verana-labs/vs-agent-model` library.
6
- *
7
- * The methods in this class allow for sending messages and managing related tasks.
8
- * For more details on the `BaseMessage` structure and usage, refer to the `@verana-labs/vs-agent-model` library.
9
- */
10
- export declare class MessageService {
11
- private baseURL;
12
- private version;
13
- private url;
14
- constructor(baseURL: string, version: ApiVersion);
15
- send(message: BaseMessage): Promise<{
16
- id: string;
17
- }>;
18
- }
@@ -1,57 +0,0 @@
1
- "use strict";
2
- // src/services/MessageService.ts
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.MessageService = void 0;
5
- const tslog_1 = require("tslog");
6
- const logger = new tslog_1.Logger({
7
- name: 'MessageService',
8
- type: 'pretty',
9
- prettyLogTemplate: '{{logLevelName}} [{{name}}]: ',
10
- });
11
- /**
12
- * `MessageService` class for handling message-related endpoints in the Agent Service.
13
- * This class is based on the `BaseMessage` from the `@verana-labs/vs-agent-model` library.
14
- *
15
- * The methods in this class allow for sending messages and managing related tasks.
16
- * For more details on the `BaseMessage` structure and usage, refer to the `@verana-labs/vs-agent-model` library.
17
- */
18
- class MessageService {
19
- constructor(baseURL, version) {
20
- this.baseURL = baseURL;
21
- this.version = version;
22
- this.url = `${this.baseURL}/${this.version}/message`;
23
- }
24
- async send(message) {
25
- try {
26
- // Log the message content before sending
27
- logger.info(`submitMessage: ${JSON.stringify(message)}`);
28
- // Send the message via POST request
29
- const response = await fetch(this.url, {
30
- method: 'POST',
31
- headers: { 'Content-Type': 'application/json' },
32
- body: JSON.stringify(message),
33
- });
34
- // Log the full response text
35
- const responseText = await response.text();
36
- logger.info(`response: ${responseText}`);
37
- let jsonResponse;
38
- try {
39
- jsonResponse = JSON.parse(responseText);
40
- }
41
- catch (e) {
42
- throw new Error('Invalid JSON response');
43
- }
44
- if (!jsonResponse || typeof jsonResponse.id !== 'string') {
45
- throw new Error('Invalid response structure: Missing or invalid "id"');
46
- }
47
- // Parse and return the JSON response as expected
48
- return jsonResponse;
49
- }
50
- catch (error) {
51
- logger.error(`Failed to send message: ${error}`);
52
- throw new Error('Failed to send message');
53
- }
54
- }
55
- }
56
- exports.MessageService = MessageService;
57
- //# sourceMappingURL=MessageService.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"MessageService.js","sourceRoot":"","sources":["../../src/services/MessageService.ts"],"names":[],"mappings":";AAAA,iCAAiC;;;AAGjC,iCAA8B;AAI9B,MAAM,MAAM,GAAG,IAAI,cAAM,CAAC;IACxB,IAAI,EAAE,gBAAgB;IACtB,IAAI,EAAE,QAAQ;IACd,iBAAiB,EAAE,+BAA+B;CACnD,CAAC,CAAA;AAEF;;;;;;GAMG;AACH,MAAa,cAAc;IAGzB,YACU,OAAe,EACf,OAAmB;QADnB,YAAO,GAAP,OAAO,CAAQ;QACf,YAAO,GAAP,OAAO,CAAY;QAE3B,IAAI,CAAC,GAAG,GAAG,GAAG,IAAI,CAAC,OAAO,IAAI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{ ApiVersion } from '../types/enums';
3
- /**
4
- * `RevocationRegistryService` class for managing credential types and interacting with
5
- * the available endpoints related to credential types in the Agent Service.
6
- *
7
- * This class provides methods for querying, creating, and managing revocation registry on credential types.
8
- * For a list of available endpoints and functionality, refer to the methods within this class.
9
- */
10
- export declare class RevocationRegistryService {
11
- private baseURL;
12
- private version;
13
- private url;
14
- constructor(baseURL: string, version: ApiVersion);
15
- create(options: RevocationRegistryInfo): Promise<string | undefined>;
16
- get(credentialDefinitionId: string): Promise<string[]>;
17
- getAll(): Promise<string[]>;
18
- }
@@ -1,58 +0,0 @@
1
- "use strict";
2
- // src/services/RevocationRegistryService.ts
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.RevocationRegistryService = void 0;
5
- const tslog_1 = require("tslog");
6
- const logger = new tslog_1.Logger({
7
- name: 'RevocationRegistryService',
8
- type: 'pretty',
9
- prettyLogTemplate: '{{logLevelName}} [{{name}}]: ',
10
- });
11
- /**
12
- * `RevocationRegistryService` class for managing credential types and interacting with
13
- * the available endpoints related to credential types in the Agent Service.
14
- *
15
- * This class provides methods for querying, creating, and managing revocation registry on credential types.
16
- * For a list of available endpoints and functionality, refer to the methods within this class.
17
- */
18
- class RevocationRegistryService {
19
- constructor(baseURL, version) {
20
- this.baseURL = baseURL;
21
- this.version = version;
22
- this.url = `${this.baseURL.replace(/\/$/, '')}/${this.version}/credential-types`;
23
- }
24
- async create(options) {
25
- const response = await fetch(`${this.url}/revocationRegistry`, {
26
- method: 'POST',
27
- headers: { 'Content-Type': 'application/json' },
28
- body: JSON.stringify(options),
29
- });
30
- if (!response.ok) {
31
- logger.error(`Failed to create revocation registry`);
32
- return undefined;
33
- }
34
- return await response.text();
35
- }
36
- async get(credentialDefinitionId) {
37
- const response = await fetch(`${this.url}/revocationRegistry?credentialDefinitionId=${encodeURIComponent(credentialDefinitionId)}`, {
38
- method: 'GET',
39
- headers: { 'Content-Type': 'application/json' },
40
- });
41
- if (!response.ok) {
42
- throw new Error(`Failed to fetch revocation definitions: ${response.statusText}`);
43
- }
44
- return (await response.json());
45
- }
46
- async getAll() {
47
- const response = await fetch(`${this.url}/revocationRegistry`, {
48
- method: 'GET',
49
- headers: { 'Content-Type': 'application/json' },
50
- });
51
- if (!response.ok) {
52
- throw new Error(`Failed to fetch revocation registries: ${response.statusText}`);
53
- }
54
- return (await response.json());
55
- }
56
- }
57
- exports.RevocationRegistryService = RevocationRegistryService;
58
- //# sourceMappingURL=RevocationRegistryService.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"RevocationRegistryService.js","sourceRoot":"","sources":["../../src/services/RevocationRegistryService.ts"],"names":[],"mappings":";AAAA,4CAA4C;;;AAG5C,iCAA8B;AAI9B,MAAM,MAAM,GAAG,IAAI,cAAM,CAAC;IACxB,IAAI,EAAE,2BAA2B;IACjC,IAAI,EAAE,QAAQ;IACd,iBAAiB,EAAE,+BAA+B;CACnD,CAAC,CAAA;AAEF;;;;;;GAMG;AACH,MAAa,yBAAyB;IAGpC,YACU,OAAe,EACf,OAAmB;QADnB,YAAO,GAAP,OAAO,CAAQ;QACf,YAAO,GAAP,OAAO,CAAY;QAE3B,IAAI,CAAC,GAAG,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,IAAI,CAAC,OAAO,mBAAmB,CAAA;IAClF,CAAC;IAEM,KAAK,CAAC,MAAM,CAAC,OAA+B;QACjD,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,IAAI,CAAC,GAAG,qBAAqB,EAAE;YAC7D,MAAM,EAAE,MAAM;YACd,OAAO,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE;YAC/C,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;SAC9B,CAAC,CAAA;QAEF,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;YACjB,MAAM,CAAC,KAAK,CAAC,sCAAsC,CAAC,CAAA;YACpD,OAAO,SAAS,CAAA;QAClB,CAAC;QAED,OAAO,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAA;IAC9B,CAAC;IAEM,KAAK,CAAC,GAAG,CAAC,sBAA8B;QAC7C,MAAM,QAAQ,GAAG,MAAM,KAAK,CAC1B,GAAG,IAAI,CAAC,GAAG,8CAA8C,kBAAkB,CAAC,sBAAsB,CAAC,EAAE,EACrG;YACE,MAAM,EAAE,KAAK;YACb,OAAO,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE;SAChD,CACF,CAAA;QAED,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;YACjB,MAAM,IAAI,KAAK,CAAC,2CAA2C,QAAQ,CAAC,UAAU,EAAE,CAAC,CAAA;QACnF,CAAC;QAED,OAAO,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAa,CAAA;IAC5C,CAAC;IAEM,KAAK,CAAC,MAAM;QACjB,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,IAAI,CAAC,GAAG,qBAAqB,EAAE;YAC7D,MAAM,EAAE,KAAK;YACb,OAAO,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE;SAChD,CAAC,CAAA;QAEF,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;YACjB,MAAM,IAAI,KAAK,CAAC,0CAA0C,QAAQ,CAAC,UAAU,EAAE,CAAC,CAAA;QAClF,CAAC;QAED,OAAO,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAa,CAAA;IAC5C,CAAC;CACF;AArDD,8DAqDC"}
@@ -1,33 +0,0 @@
1
- import { CredentialIssuanceRequest, CredentialIssuanceResponse } from '@verana-labs/vs-agent-model';
2
- import { ApiVersion } from '../types/enums';
3
- /**
4
- * Service responsible for managing verifiable credential issuance and revocation
5
- * through the Trust Credential API.
6
- *
7
- * This service interacts with the Verifiable Trust (VT) endpoint of the agent API
8
- * to issue credentials based on a given JSON schema and claim values.
9
- */
10
- export declare class TrustCredentialService {
11
- private baseURL;
12
- private version;
13
- private url;
14
- constructor(baseURL: string, version: ApiVersion);
15
- /**
16
- * Issues a verifiable credential (either W3C JSON-LD or Anoncreds) by sending
17
- * a POST request to the `/issue-credential` endpoint of the Trust Credential API.
18
- *
19
- * This method supports both `jsonld` and `anoncreds` credential formats.
20
- * It requires a JSON Schema credential definition and a set of claims,
21
- * optionally linked to a DID.
22
- *
23
- * @param type - The credential format. Accepted values: `'jsonld' | 'anoncreds'`.
24
- * @param jsonSchemaCredentialId - The URL of the credential JSON schema definition.
25
- * @param claims - A JSON object containing the credential claims.
26
- * @param did - (Optional) A decentralized identifier (DID) associated with the holder.
27
- *
28
- * @returns A `CredentialIssuanceResponse` containing either the DIDComm invitation URL
29
- * or the issued verifiable credential, depending on the credential type.
30
- */
31
- issuance({ format, jsonSchemaCredentialId, claims, did, }: CredentialIssuanceRequest): Promise<CredentialIssuanceResponse>;
32
- revoke(): Promise<void>;
33
- }