@verana-labs/vs-agent-sdk 1.10.1
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/LICENSE +201 -0
- package/build/agent/VsAgent.d.ts +66 -0
- package/build/agent/VsAgent.js +276 -0
- package/build/agent/VsAgent.js.map +1 -0
- package/build/agent/createVsAgent.d.ts +50 -0
- package/build/agent/createVsAgent.js +43 -0
- package/build/agent/createVsAgent.js.map +1 -0
- package/build/credentials/FullTailsFileService.d.ts +17 -0
- package/build/credentials/FullTailsFileService.js +76 -0
- package/build/credentials/FullTailsFileService.js.map +1 -0
- package/build/did/CachedDocumentLoader.d.ts +35 -0
- package/build/did/CachedDocumentLoader.js +139 -0
- package/build/did/CachedDocumentLoader.js.map +1 -0
- package/build/did/CachedWebDidResolver.d.ts +9 -0
- package/build/did/CachedWebDidResolver.js +44 -0
- package/build/did/CachedWebDidResolver.js.map +1 -0
- package/build/did/WebDidRegistrar.d.ts +34 -0
- package/build/did/WebDidRegistrar.js +110 -0
- package/build/did/WebDidRegistrar.js.map +1 -0
- package/build/did/legacyDidWeb.d.ts +10 -0
- package/build/did/legacyDidWeb.js +41 -0
- package/build/did/legacyDidWeb.js.map +1 -0
- package/build/index.d.ts +24 -0
- package/build/index.js +68 -0
- package/build/index.js.map +1 -0
- package/build/plugins/setupBaseDidComm.d.ts +15 -0
- package/build/plugins/setupBaseDidComm.js +82 -0
- package/build/plugins/setupBaseDidComm.js.map +1 -0
- package/build/transports/HttpInboundTransport.d.ts +28 -0
- package/build/transports/HttpInboundTransport.js +132 -0
- package/build/transports/HttpInboundTransport.js.map +1 -0
- package/build/transports/VsAgentWsInboundTransport.d.ts +30 -0
- package/build/transports/VsAgentWsInboundTransport.js +143 -0
- package/build/transports/VsAgentWsInboundTransport.js.map +1 -0
- package/build/transports/VsAgentWsOutboundTransport.d.ts +20 -0
- package/build/transports/VsAgentWsOutboundTransport.js +129 -0
- package/build/transports/VsAgentWsOutboundTransport.js.map +1 -0
- package/build/types.d.ts +30 -0
- package/build/types.js +5 -0
- package/build/types.js.map +1 -0
- package/build/utils/agent.d.ts +20 -0
- package/build/utils/agent.js +49 -0
- package/build/utils/agent.js.map +1 -0
- package/build/utils/data.d.ts +1 -0
- package/build/utils/data.js +255 -0
- package/build/utils/data.js.map +1 -0
- package/build/utils/parsers.d.ts +11 -0
- package/build/utils/parsers.js +36 -0
- package/build/utils/parsers.js.map +1 -0
- package/build/utils/util.d.ts +3 -0
- package/build/utils/util.js +151 -0
- package/build/utils/util.js.map +1 -0
- package/build/utils/webhook.d.ts +13 -0
- package/build/utils/webhook.js +56 -0
- package/build/utils/webhook.js.map +1 -0
- package/build/utils/webhookEvent.d.ts +5 -0
- package/build/utils/webhookEvent.js +26 -0
- package/build/utils/webhookEvent.js.map +1 -0
- package/package.json +53 -0
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getEcsSchemas = getEcsSchemas;
|
|
4
|
+
function getEcsSchemas(publicApiBaseUrl) {
|
|
5
|
+
return {
|
|
6
|
+
'ecs-org': `{
|
|
7
|
+
"$id": "${publicApiBaseUrl}/vt/cs/v1/js/ecs-org",
|
|
8
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
9
|
+
"title": "OrganizationCredential",
|
|
10
|
+
"description": "Identifies a legal organization that operates one or more Verifiable Services.",
|
|
11
|
+
"type": "object",
|
|
12
|
+
"properties": {
|
|
13
|
+
"credentialSubject": {
|
|
14
|
+
"type": "object",
|
|
15
|
+
"properties": {
|
|
16
|
+
"id": {
|
|
17
|
+
"type": "string",
|
|
18
|
+
"format": "uri",
|
|
19
|
+
"maxLength": 2048
|
|
20
|
+
},
|
|
21
|
+
"name": {
|
|
22
|
+
"type": "string",
|
|
23
|
+
"minLength": 1,
|
|
24
|
+
"maxLength": 512
|
|
25
|
+
},
|
|
26
|
+
"logo": {
|
|
27
|
+
"type": "string",
|
|
28
|
+
"format": "uri",
|
|
29
|
+
"maxLength": 1400000,
|
|
30
|
+
"pattern": "^data:image/(png|jpeg|svg\\\\+xml);base64,"
|
|
31
|
+
},
|
|
32
|
+
"registryId": {
|
|
33
|
+
"type": "string",
|
|
34
|
+
"minLength": 1,
|
|
35
|
+
"maxLength": 256
|
|
36
|
+
},
|
|
37
|
+
"registryUri": {
|
|
38
|
+
"type": "string",
|
|
39
|
+
"format": "uri",
|
|
40
|
+
"maxLength": 4096
|
|
41
|
+
},
|
|
42
|
+
"address": {
|
|
43
|
+
"type": "string",
|
|
44
|
+
"minLength": 1,
|
|
45
|
+
"maxLength": 1024
|
|
46
|
+
},
|
|
47
|
+
"countryCode": {
|
|
48
|
+
"type": "string",
|
|
49
|
+
"minLength": 2,
|
|
50
|
+
"maxLength": 2,
|
|
51
|
+
"pattern": "^[A-Z]{2}$"
|
|
52
|
+
},
|
|
53
|
+
"legalJurisdiction": {
|
|
54
|
+
"type": "string",
|
|
55
|
+
"minLength": 1,
|
|
56
|
+
"maxLength": 64,
|
|
57
|
+
"pattern": "^[A-Z]{2}(-[A-Z0-9]{1,3})?$"
|
|
58
|
+
},
|
|
59
|
+
"organizationKind": {
|
|
60
|
+
"type": "string",
|
|
61
|
+
"minLength": 1,
|
|
62
|
+
"maxLength": 64
|
|
63
|
+
},
|
|
64
|
+
"lei": {
|
|
65
|
+
"type": "string",
|
|
66
|
+
"pattern": "^[A-Z0-9]{20}$"
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
"required": [
|
|
70
|
+
"id",
|
|
71
|
+
"name",
|
|
72
|
+
"logo",
|
|
73
|
+
"registryId",
|
|
74
|
+
"address",
|
|
75
|
+
"countryCode"
|
|
76
|
+
]
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}`,
|
|
80
|
+
'ecs-person': `{
|
|
81
|
+
"$id": "${publicApiBaseUrl}/vt/cs/v1/js/ecs-person",
|
|
82
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
83
|
+
"title": "PersonaCredential",
|
|
84
|
+
"description": "Identifies a Persona (human-controlled avatar) that operates one or more Verifiable Services.",
|
|
85
|
+
"type": "object",
|
|
86
|
+
"properties": {
|
|
87
|
+
"credentialSubject": {
|
|
88
|
+
"type": "object",
|
|
89
|
+
"properties": {
|
|
90
|
+
"id": {
|
|
91
|
+
"type": "string",
|
|
92
|
+
"format": "uri",
|
|
93
|
+
"maxLength": 2048
|
|
94
|
+
},
|
|
95
|
+
"name": {
|
|
96
|
+
"type": "string",
|
|
97
|
+
"minLength": 1,
|
|
98
|
+
"maxLength": 256
|
|
99
|
+
},
|
|
100
|
+
"avatar": {
|
|
101
|
+
"type": "string",
|
|
102
|
+
"format": "uri",
|
|
103
|
+
"maxLength": 1400000,
|
|
104
|
+
"pattern": "^data:image/(png|jpeg|svg\\\\+xml);base64,"
|
|
105
|
+
},
|
|
106
|
+
"description": {
|
|
107
|
+
"type": "string",
|
|
108
|
+
"minLength": 0,
|
|
109
|
+
"maxLength": 16384
|
|
110
|
+
},
|
|
111
|
+
"descriptionFormat": {
|
|
112
|
+
"type": "string",
|
|
113
|
+
"enum": [
|
|
114
|
+
"text/plain",
|
|
115
|
+
"text/markdown"
|
|
116
|
+
],
|
|
117
|
+
"default": "text/plain"
|
|
118
|
+
},
|
|
119
|
+
"controllerCountryCode": {
|
|
120
|
+
"type": "string",
|
|
121
|
+
"minLength": 2,
|
|
122
|
+
"maxLength": 2,
|
|
123
|
+
"pattern": "^[A-Z]{2}$"
|
|
124
|
+
},
|
|
125
|
+
"controllerJurisdiction": {
|
|
126
|
+
"type": "string",
|
|
127
|
+
"minLength": 1,
|
|
128
|
+
"maxLength": 64,
|
|
129
|
+
"pattern": "^[A-Z]{2}(-[A-Z0-9]{1,3})?$"
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
"required": [
|
|
133
|
+
"id",
|
|
134
|
+
"name",
|
|
135
|
+
"controllerCountryCode"
|
|
136
|
+
]
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}`,
|
|
140
|
+
'ecs-service': `{
|
|
141
|
+
"$id": "${publicApiBaseUrl}/vt/cs/v1/js/ecs-service",
|
|
142
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
143
|
+
"title": "ServiceCredential",
|
|
144
|
+
"description": "Identifies a Verifiable Service and defines the minimum trust and access requirements required to interact with it.",
|
|
145
|
+
"type": "object",
|
|
146
|
+
"properties": {
|
|
147
|
+
"credentialSubject": {
|
|
148
|
+
"type": "object",
|
|
149
|
+
"properties": {
|
|
150
|
+
"id": {
|
|
151
|
+
"type": "string",
|
|
152
|
+
"format": "uri",
|
|
153
|
+
"maxLength": 2048
|
|
154
|
+
},
|
|
155
|
+
"name": {
|
|
156
|
+
"type": "string",
|
|
157
|
+
"minLength": 1,
|
|
158
|
+
"maxLength": 512
|
|
159
|
+
},
|
|
160
|
+
"type": {
|
|
161
|
+
"type": "string",
|
|
162
|
+
"minLength": 1,
|
|
163
|
+
"maxLength": 128
|
|
164
|
+
},
|
|
165
|
+
"description": {
|
|
166
|
+
"type": "string",
|
|
167
|
+
"maxLength": 4096
|
|
168
|
+
},
|
|
169
|
+
"descriptionFormat": {
|
|
170
|
+
"type": "string",
|
|
171
|
+
"enum": [
|
|
172
|
+
"text/plain",
|
|
173
|
+
"text/markdown"
|
|
174
|
+
],
|
|
175
|
+
"default": "text/plain"
|
|
176
|
+
},
|
|
177
|
+
"logo": {
|
|
178
|
+
"type": "string",
|
|
179
|
+
"format": "uri",
|
|
180
|
+
"maxLength": 1400000,
|
|
181
|
+
"pattern": "^data:image/(png|jpeg|svg\\\\+xml);base64,"
|
|
182
|
+
},
|
|
183
|
+
"minimumAgeRequired": {
|
|
184
|
+
"type": "integer",
|
|
185
|
+
"minimum": 0,
|
|
186
|
+
"maximum": 255
|
|
187
|
+
},
|
|
188
|
+
"termsAndConditions": {
|
|
189
|
+
"type": "string",
|
|
190
|
+
"format": "uri",
|
|
191
|
+
"maxLength": 4096
|
|
192
|
+
},
|
|
193
|
+
"termsAndConditionsDigestSri": {
|
|
194
|
+
"type": "string",
|
|
195
|
+
"maxLength": 256
|
|
196
|
+
},
|
|
197
|
+
"privacyPolicy": {
|
|
198
|
+
"type": "string",
|
|
199
|
+
"format": "uri",
|
|
200
|
+
"maxLength": 4096
|
|
201
|
+
},
|
|
202
|
+
"privacyPolicyDigestSri": {
|
|
203
|
+
"type": "string",
|
|
204
|
+
"maxLength": 256
|
|
205
|
+
}
|
|
206
|
+
},
|
|
207
|
+
"required": [
|
|
208
|
+
"id",
|
|
209
|
+
"name",
|
|
210
|
+
"type",
|
|
211
|
+
"description",
|
|
212
|
+
"logo",
|
|
213
|
+
"minimumAgeRequired",
|
|
214
|
+
"termsAndConditions",
|
|
215
|
+
"privacyPolicy"
|
|
216
|
+
]
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
}`,
|
|
220
|
+
'ecs-user-agent': `{
|
|
221
|
+
"$id": "${publicApiBaseUrl}/vt/cs/v1/js/ecs-user-agent",
|
|
222
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
223
|
+
"title": "UserAgentCredential",
|
|
224
|
+
"description": "Identifies a User Agent instance and the software version it runs. The issuer identifies the software product line.",
|
|
225
|
+
"type": "object",
|
|
226
|
+
"properties": {
|
|
227
|
+
"credentialSubject": {
|
|
228
|
+
"type": "object",
|
|
229
|
+
"properties": {
|
|
230
|
+
"id": {
|
|
231
|
+
"type": "string",
|
|
232
|
+
"format": "uri",
|
|
233
|
+
"maxLength": 2048
|
|
234
|
+
},
|
|
235
|
+
"version": {
|
|
236
|
+
"type": "string",
|
|
237
|
+
"minLength": 1,
|
|
238
|
+
"maxLength": 64
|
|
239
|
+
},
|
|
240
|
+
"build": {
|
|
241
|
+
"type": "string",
|
|
242
|
+
"minLength": 1,
|
|
243
|
+
"maxLength": 128
|
|
244
|
+
}
|
|
245
|
+
},
|
|
246
|
+
"required": [
|
|
247
|
+
"id",
|
|
248
|
+
"version"
|
|
249
|
+
]
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
}`,
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
//# sourceMappingURL=data.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data.js","sourceRoot":"","sources":["../../src/utils/data.ts"],"names":[],"mappings":";;AAAA,sCA0PC;AA1PD,SAAgB,aAAa,CAAC,gBAAwB;IACpD,OAAO;QACL,SAAS,EAAE;YACH,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAwE1B;QACE,YAAY,EAAE;YACN,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0D1B;QACE,aAAa,EAAE;YACP,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8E1B;QACE,gBAAgB,EAAE;YACV,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA+B1B;KACC,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { DidCommMessageReceipt } from '@2060.io/credo-ts-didcomm-receipts';
|
|
2
|
+
import { PictureData } from '@2060.io/credo-ts-didcomm-user-profile';
|
|
3
|
+
import { VsAgentMessageReceipt } from '@verana-labs/vs-agent-model';
|
|
4
|
+
export declare const UriValidator: RegExp;
|
|
5
|
+
export declare function parseDataUrl(dataUrl: string): {
|
|
6
|
+
mimeType: string;
|
|
7
|
+
data: string;
|
|
8
|
+
} | null;
|
|
9
|
+
export declare function parsePictureData(pictureData: string): PictureData | undefined;
|
|
10
|
+
export declare function createDataUrl(pictureData: PictureData): string | undefined;
|
|
11
|
+
export declare const didcommReceiptFromVsAgentReceipt: (receipt: VsAgentMessageReceipt) => DidCommMessageReceipt;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.didcommReceiptFromVsAgentReceipt = exports.UriValidator = void 0;
|
|
4
|
+
exports.parseDataUrl = parseDataUrl;
|
|
5
|
+
exports.parsePictureData = parsePictureData;
|
|
6
|
+
exports.createDataUrl = createDataUrl;
|
|
7
|
+
const credo_ts_didcomm_receipts_1 = require("@2060.io/credo-ts-didcomm-receipts");
|
|
8
|
+
const vs_agent_model_1 = require("@verana-labs/vs-agent-model");
|
|
9
|
+
exports.UriValidator = /\w+:(\/?\/?)[^\s]+/;
|
|
10
|
+
function parseDataUrl(dataUrl) {
|
|
11
|
+
const regex = /^data:(.+);base64,(.*)$/;
|
|
12
|
+
const matches = dataUrl.match(regex);
|
|
13
|
+
if (!matches)
|
|
14
|
+
return null;
|
|
15
|
+
return { mimeType: matches[1], data: matches[2] };
|
|
16
|
+
}
|
|
17
|
+
function parsePictureData(pictureData) {
|
|
18
|
+
const parsedDataUrl = parseDataUrl(pictureData);
|
|
19
|
+
if (parsedDataUrl) {
|
|
20
|
+
return { base64: parsedDataUrl.data, mimeType: parsedDataUrl.mimeType };
|
|
21
|
+
}
|
|
22
|
+
else if (exports.UriValidator.test(pictureData)) {
|
|
23
|
+
return { links: [pictureData] };
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
function createDataUrl(pictureData) {
|
|
27
|
+
if (pictureData.base64 && pictureData.mimeType) {
|
|
28
|
+
return `data:${pictureData.mimeType};base64,${pictureData.base64}`;
|
|
29
|
+
}
|
|
30
|
+
else if (pictureData.links && pictureData.links.length > 0) {
|
|
31
|
+
return pictureData.links[0];
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
const didcommReceiptFromVsAgentReceipt = (receipt) => new credo_ts_didcomm_receipts_1.DidCommMessageReceipt(Object.assign(Object.assign({}, receipt), { state: vs_agent_model_1.didcommMessageState[receipt.state.toLowerCase()] }));
|
|
35
|
+
exports.didcommReceiptFromVsAgentReceipt = didcommReceiptFromVsAgentReceipt;
|
|
36
|
+
//# sourceMappingURL=parsers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parsers.js","sourceRoot":"","sources":["../../src/utils/parsers.ts"],"names":[],"mappings":";;;AAKA,oCAOC;AAED,4CAOC;AAED,sCAMC;AA7BD,kFAA0E;AAE1E,gEAAwF;AAE3E,QAAA,YAAY,GAAG,oBAAoB,CAAA;AAChD,SAAgB,YAAY,CAAC,OAAe;IAC1C,MAAM,KAAK,GAAG,yBAAyB,CAAA;IAEvC,MAAM,OAAO,GAAG,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;IACpC,IAAI,CAAC,OAAO;QAAE,OAAO,IAAI,CAAA;IAEzB,OAAO,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,CAAA;AACnD,CAAC;AAED,SAAgB,gBAAgB,CAAC,WAAmB;IAClD,MAAM,aAAa,GAAG,YAAY,CAAC,WAAW,CAAC,CAAA;IAC/C,IAAI,aAAa,EAAE,CAAC;QAClB,OAAO,EAAE,MAAM,EAAE,aAAa,CAAC,IAAI,EAAE,QAAQ,EAAE,aAAa,CAAC,QAAQ,EAAE,CAAA;IACzE,CAAC;SAAM,IAAI,oBAAY,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC;QAC1C,OAAO,EAAE,KAAK,EAAE,CAAC,WAAW,CAAC,EAAE,CAAA;IACjC,CAAC;AACH,CAAC;AAED,SAAgB,aAAa,CAAC,WAAwB;IACpD,IAAI,WAAW,CAAC,MAAM,IAAI,WAAW,CAAC,QAAQ,EAAE,CAAC;QAC/C,OAAO,QAAQ,WAAW,CAAC,QAAQ,WAAW,WAAW,CAAC,MAAM,EAAE,CAAA;IACpE,CAAC;SAAM,IAAI,WAAW,CAAC,KAAK,IAAI,WAAW,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC7D,OAAO,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;IAC7B,CAAC;AACH,CAAC;AAEM,MAAM,gCAAgC,GAAG,CAAC,OAA8B,EAAE,EAAE,CACjF,IAAI,iDAAqB,iCAAM,OAAO,KAAE,KAAK,EAAE,oCAAmB,CAAC,OAAO,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,IAAG,CAAA;AADvF,QAAA,gCAAgC,oCACuD"}
|