@verana-labs/vs-agent-sdk 1.13.0-dev.6 → 1.13.1-dev.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.
@@ -1,221 +1,207 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getEcsSchemas = getEcsSchemas;
4
- // Verbatim copies of the published v4 Essential Credential Schemas
5
- // https://verana-labs.github.io/verifiable-trust-spec/schemas/v4/
6
4
  function getEcsSchemas(publicApiBaseUrl) {
7
5
  return {
8
6
  'ecs-org': `{
9
7
  "$id": "${publicApiBaseUrl}/vt/cs/v1/js/ecs-org",
10
8
  "$schema": "https://json-schema.org/draft/2020-12/schema",
9
+ "title": "OrganizationCredential",
11
10
  "description": "Identifies a legal organization that operates one or more Verifiable Services.",
11
+ "type": "object",
12
12
  "properties": {
13
13
  "credentialSubject": {
14
+ "type": "object",
14
15
  "properties": {
15
- "address": {
16
- "maxLength": 1024,
17
- "minLength": 1,
18
- "type": "string"
19
- },
20
- "countryCode": {
21
- "maxLength": 2,
22
- "minLength": 2,
23
- "pattern": "^[A-Z]{2}$",
24
- "type": "string"
25
- },
26
16
  "id": {
17
+ "type": "string",
27
18
  "format": "uri",
28
- "maxLength": 2048,
29
- "type": "string"
19
+ "maxLength": 2048
30
20
  },
31
- "legalJurisdiction": {
32
- "maxLength": 64,
21
+ "name": {
22
+ "type": "string",
33
23
  "minLength": 1,
34
- "pattern": "^[A-Z]{2}(-[A-Z0-9]{1,3})?$",
35
- "type": "string"
24
+ "maxLength": 512
36
25
  },
37
- "lei": {
38
- "pattern": "^[A-Z0-9]{20}$",
39
- "type": "string"
26
+ "logo": {
27
+ "type": "string",
28
+ "format": "uri",
29
+ "maxLength": 1400000,
30
+ "pattern": "^data:image/(png|jpeg|svg\\\\+xml);base64,"
40
31
  },
41
- "logoDigestSri": {
42
- "maxLength": 256,
43
- "type": "string"
32
+ "registryId": {
33
+ "type": "string",
34
+ "minLength": 1,
35
+ "maxLength": 256
44
36
  },
45
- "logoUri": {
37
+ "registryUri": {
38
+ "type": "string",
46
39
  "format": "uri",
47
- "maxLength": 4096,
48
- "type": "string"
40
+ "maxLength": 4096
49
41
  },
50
- "name": {
51
- "maxLength": 512,
42
+ "address": {
43
+ "type": "string",
52
44
  "minLength": 1,
53
- "type": "string"
45
+ "maxLength": 1024
54
46
  },
55
- "organizationKind": {
56
- "maxLength": 64,
47
+ "countryCode": {
48
+ "type": "string",
49
+ "minLength": 2,
50
+ "maxLength": 2,
51
+ "pattern": "^[A-Z]{2}$"
52
+ },
53
+ "legalJurisdiction": {
54
+ "type": "string",
57
55
  "minLength": 1,
58
- "type": "string"
56
+ "maxLength": 64,
57
+ "pattern": "^[A-Z]{2}(-[A-Z0-9]{1,3})?$"
59
58
  },
60
- "registryId": {
61
- "maxLength": 256,
59
+ "organizationKind": {
60
+ "type": "string",
62
61
  "minLength": 1,
63
- "type": "string"
62
+ "maxLength": 64
64
63
  },
65
- "registryUri": {
66
- "format": "uri",
67
- "maxLength": 4096,
68
- "type": "string"
64
+ "lei": {
65
+ "type": "string",
66
+ "pattern": "^[A-Z0-9]{20}$"
69
67
  }
70
68
  },
71
69
  "required": [
72
70
  "id",
73
71
  "name",
74
- "logoUri",
75
- "logoDigestSri",
72
+ "logo",
76
73
  "registryId",
77
74
  "address",
78
75
  "countryCode"
79
- ],
80
- "type": "object"
76
+ ]
81
77
  }
82
- },
83
- "title": "OrganizationCredential",
84
- "type": "object"
78
+ }
85
79
  }`,
86
- 'ecs-persona': `{
87
- "$id": "${publicApiBaseUrl}/vt/cs/v1/js/ecs-persona",
80
+ 'ecs-person': `{
81
+ "$id": "${publicApiBaseUrl}/vt/cs/v1/js/ecs-person",
88
82
  "$schema": "https://json-schema.org/draft/2020-12/schema",
83
+ "title": "PersonaCredential",
89
84
  "description": "Identifies a Persona (human-controlled avatar) that operates one or more Verifiable Services.",
85
+ "type": "object",
90
86
  "properties": {
91
87
  "credentialSubject": {
92
- "dependentRequired": {
93
- "avatarUri": [
94
- "avatarDigestSri"
95
- ]
96
- },
88
+ "type": "object",
97
89
  "properties": {
98
- "avatarDigestSri": {
99
- "maxLength": 256,
100
- "type": "string"
101
- },
102
- "avatarUri": {
90
+ "id": {
91
+ "type": "string",
103
92
  "format": "uri",
104
- "maxLength": 4096,
105
- "type": "string"
93
+ "maxLength": 2048
106
94
  },
107
- "controllerCountryCode": {
108
- "maxLength": 2,
109
- "minLength": 2,
110
- "pattern": "^[A-Z]{2}$",
111
- "type": "string"
112
- },
113
- "controllerJurisdiction": {
114
- "maxLength": 64,
95
+ "name": {
96
+ "type": "string",
115
97
  "minLength": 1,
116
- "pattern": "^[A-Z]{2}(-[A-Z0-9]{1,3})?$",
117
- "type": "string"
98
+ "maxLength": 256
99
+ },
100
+ "avatar": {
101
+ "type": "string",
102
+ "format": "uri",
103
+ "maxLength": 1400000,
104
+ "pattern": "^data:image/(png|jpeg|svg\\\\+xml);base64,"
118
105
  },
119
106
  "description": {
120
- "maxLength": 16384,
107
+ "type": "string",
121
108
  "minLength": 0,
122
- "type": "string"
109
+ "maxLength": 16384
123
110
  },
124
111
  "descriptionFormat": {
125
- "default": "text/plain",
112
+ "type": "string",
126
113
  "enum": [
127
114
  "text/plain",
128
115
  "text/markdown"
129
116
  ],
130
- "type": "string"
117
+ "default": "text/plain"
131
118
  },
132
- "id": {
133
- "format": "uri",
134
- "maxLength": 2048,
135
- "type": "string"
119
+ "controllerCountryCode": {
120
+ "type": "string",
121
+ "minLength": 2,
122
+ "maxLength": 2,
123
+ "pattern": "^[A-Z]{2}$"
136
124
  },
137
- "name": {
138
- "maxLength": 256,
125
+ "controllerJurisdiction": {
126
+ "type": "string",
139
127
  "minLength": 1,
140
- "type": "string"
128
+ "maxLength": 64,
129
+ "pattern": "^[A-Z]{2}(-[A-Z0-9]{1,3})?$"
141
130
  }
142
131
  },
143
132
  "required": [
144
133
  "id",
145
134
  "name",
146
135
  "controllerCountryCode"
147
- ],
148
- "type": "object"
136
+ ]
149
137
  }
150
- },
151
- "title": "PersonaCredential",
152
- "type": "object"
138
+ }
153
139
  }`,
154
140
  'ecs-service': `{
155
141
  "$id": "${publicApiBaseUrl}/vt/cs/v1/js/ecs-service",
156
142
  "$schema": "https://json-schema.org/draft/2020-12/schema",
143
+ "title": "ServiceCredential",
157
144
  "description": "Identifies a Verifiable Service and defines the minimum trust and access requirements required to interact with it.",
145
+ "type": "object",
158
146
  "properties": {
159
147
  "credentialSubject": {
148
+ "type": "object",
160
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
+ },
161
165
  "description": {
162
- "maxLength": 4096,
163
- "type": "string"
166
+ "type": "string",
167
+ "maxLength": 4096
164
168
  },
165
169
  "descriptionFormat": {
166
- "default": "text/plain",
170
+ "type": "string",
167
171
  "enum": [
168
172
  "text/plain",
169
173
  "text/markdown"
170
174
  ],
171
- "type": "string"
175
+ "default": "text/plain"
172
176
  },
173
- "id": {
177
+ "logo": {
178
+ "type": "string",
174
179
  "format": "uri",
175
- "maxLength": 2048,
176
- "type": "string"
177
- },
178
- "logoDigestSri": {
179
- "maxLength": 256,
180
- "type": "string"
181
- },
182
- "logoUri": {
183
- "format": "uri",
184
- "maxLength": 4096,
185
- "type": "string"
180
+ "maxLength": 1400000,
181
+ "pattern": "^data:image/(png|jpeg|svg\\\\+xml);base64,"
186
182
  },
187
183
  "minimumAgeRequired": {
188
- "maximum": 255,
184
+ "type": "integer",
189
185
  "minimum": 0,
190
- "type": "integer"
191
- },
192
- "name": {
193
- "maxLength": 512,
194
- "minLength": 1,
195
- "type": "string"
196
- },
197
- "privacyPolicyDigestSri": {
198
- "maxLength": 256,
199
- "type": "string"
186
+ "maximum": 255
200
187
  },
201
- "privacyPolicyUri": {
188
+ "termsAndConditions": {
189
+ "type": "string",
202
190
  "format": "uri",
203
- "maxLength": 4096,
204
- "type": "string"
191
+ "maxLength": 4096
205
192
  },
206
193
  "termsAndConditionsDigestSri": {
207
- "maxLength": 256,
208
- "type": "string"
194
+ "type": "string",
195
+ "maxLength": 256
209
196
  },
210
- "termsAndConditionsUri": {
197
+ "privacyPolicy": {
198
+ "type": "string",
211
199
  "format": "uri",
212
- "maxLength": 4096,
213
- "type": "string"
200
+ "maxLength": 4096
214
201
  },
215
- "type": {
216
- "maxLength": 128,
217
- "minLength": 1,
218
- "type": "string"
202
+ "privacyPolicyDigestSri": {
203
+ "type": "string",
204
+ "maxLength": 256
219
205
  }
220
206
  },
221
207
  "required": [
@@ -223,110 +209,46 @@ function getEcsSchemas(publicApiBaseUrl) {
223
209
  "name",
224
210
  "type",
225
211
  "description",
226
- "logoUri",
227
- "logoDigestSri",
212
+ "logo",
228
213
  "minimumAgeRequired",
229
- "termsAndConditionsUri",
230
- "termsAndConditionsDigestSri",
231
- "privacyPolicyUri",
232
- "privacyPolicyDigestSri"
233
- ],
234
- "type": "object"
214
+ "termsAndConditions",
215
+ "privacyPolicy"
216
+ ]
235
217
  }
236
- },
237
- "title": "ServiceCredential",
238
- "type": "object"
218
+ }
239
219
  }`,
240
220
  'ecs-user-agent': `{
241
221
  "$id": "${publicApiBaseUrl}/vt/cs/v1/js/ecs-user-agent",
242
222
  "$schema": "https://json-schema.org/draft/2020-12/schema",
223
+ "title": "UserAgentCredential",
243
224
  "description": "Identifies a User Agent instance and the software version it runs. The issuer identifies the software product line.",
225
+ "type": "object",
244
226
  "properties": {
245
227
  "credentialSubject": {
228
+ "type": "object",
246
229
  "properties": {
247
- "build": {
248
- "maxLength": 128,
249
- "minLength": 1,
250
- "type": "string"
230
+ "id": {
231
+ "type": "string",
232
+ "format": "uri",
233
+ "maxLength": 2048
251
234
  },
252
235
  "version": {
253
- "maxLength": 64,
236
+ "type": "string",
254
237
  "minLength": 1,
255
- "type": "string"
256
- }
257
- },
258
- "required": [
259
- "version"
260
- ],
261
- "type": "object"
262
- }
263
- },
264
- "title": "UserAgentCredential",
265
- "type": "object"
266
- }`,
267
- 'ecs-badge': `{
268
- "$id": "${publicApiBaseUrl}/vt/cs/v1/js/ecs-badge",
269
- "$schema": "https://json-schema.org/draft/2020-12/schema",
270
- "description": "Identifies a human, such as an employee or member of the organization that operates a Verifiable Service. The issuer identifies the organization or persona the holder represents.",
271
- "properties": {
272
- "credentialSubject": {
273
- "dependentRequired": {
274
- "biometricPattern": [
275
- "biometricPatternScheme"
276
- ]
277
- },
278
- "properties": {
279
- "badgeNumber": {
280
- "maxLength": 256,
281
- "minLength": 1,
282
- "type": "string"
283
- },
284
- "biometricPattern": {
285
- "contentEncoding": "base64",
286
- "maxLength": 262144,
287
- "type": "string"
238
+ "maxLength": 64
288
239
  },
289
- "biometricPatternScheme": {
290
- "maxLength": 128,
291
- "minLength": 1,
292
- "type": "string"
293
- },
294
- "birthDate": {
295
- "maximum": 99991231,
296
- "minimum": 10000101,
297
- "type": "integer"
298
- },
299
- "department": {
300
- "maxLength": 128,
301
- "minLength": 1,
302
- "type": "string"
303
- },
304
- "name": {
305
- "maxLength": 256,
306
- "minLength": 1,
307
- "type": "string"
308
- },
309
- "photo": {
310
- "maxLength": 262144,
311
- "pattern": "^data:image/(png|jpeg);base64,[A-Za-z0-9+/]+={0,2}$",
312
- "type": "string"
313
- },
314
- "title": {
315
- "maxLength": 128,
240
+ "build": {
241
+ "type": "string",
316
242
  "minLength": 1,
317
- "type": "string"
243
+ "maxLength": 128
318
244
  }
319
245
  },
320
246
  "required": [
321
- "badgeNumber",
322
- "name",
323
- "photo"
324
- ],
325
- "type": "object"
247
+ "id",
248
+ "version"
249
+ ]
326
250
  }
327
- },
328
- "title": "BadgeCredential",
329
- "type": "object"
251
+ }
330
252
  }`,
331
253
  };
332
254
  }
@@ -1 +1 @@
1
- {"version":3,"file":"data.js","sourceRoot":"","sources":["../../src/utils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;;;;;;;;;;;;;;;;;;;;;;;;;EA+B1B;KACC,CAAA;AACH,CAAC"}
@@ -1,18 +1,19 @@
1
1
  import { W3cCredential, W3cPresentation, W3cCredentialSchema, W3cCredentialSubject, W3cJsonLdVerifiableCredential, W3cJsonLdVerifiablePresentation, W3cCredentialOptions, DidRecord, W3cPresentationOptions, Logger } from '@credo-ts/core';
2
2
  import { AnySchemaObject } from 'ajv/dist/2020';
3
3
  import { VsAgent } from '../agent/VsAgent';
4
- export interface SelfTrDefaults {
4
+ interface SelfTrDefaults {
5
5
  agentLabel: string;
6
- serviceLogoUri: string;
6
+ agentInvitationImageUrl?: string;
7
+ fallbackBase64?: string;
7
8
  serviceType: string;
8
9
  serviceDescription: string;
9
10
  serviceMinimumAgeRequired: number;
10
11
  serviceTermsAndConditions: string;
11
12
  servicePrivacyPolicy: string;
12
13
  orgRegistryId: string;
13
- orgRegistryUri: string;
14
+ orgRegistryUrl: string;
14
15
  orgAddress: string;
15
- orgOrganizationKind: string;
16
+ orgType: string;
16
17
  orgCountryCode: string;
17
18
  }
18
19
  export declare const presentations: {
@@ -26,7 +27,6 @@ export declare const credentials: {
26
27
  }[];
27
28
  export declare const createJsonSchema: W3cCredentialSchema;
28
29
  export declare const createJsonSubjectRef: (id: string) => W3cCredentialSubject;
29
- export declare const linkedVpFragment: (schemaKey: string) => string;
30
30
  export declare const mapToSelfTr: (url: string, publicApiBaseUrl: string) => string;
31
31
  export declare const setupSelfTr: ({ agent, publicApiBaseUrl, defaults, }: {
32
32
  agent: VsAgent;
@@ -105,8 +105,11 @@ export declare function addDigestSRI<T extends object>(id?: string, data?: T, ec
105
105
  */
106
106
  export declare function generateDigestSRI(content: string, algorithm?: string): string;
107
107
  /**
108
- * Digest of the resource a credential references. Throws rather than attest content it could
109
- * not read: a wrong digestSRI is a false integrity claim in a signed credential.
108
+ * Converts an image URL to a Base64-encoded data URI string.
109
+ *
110
+ * @param url - The image URL to convert.
111
+ * @returns A Base64 data URI string, or a fallback placeholder if the image cannot be fetched or is invalid.
110
112
  */
111
- export declare function urlDigestSri(url: string): Promise<string>;
113
+ export declare function urlToBase64(logger: Logger, url: string | undefined, fallback: string): Promise<string>;
112
114
  export declare function getVerificationMethodId(logger: Logger, didRecord: DidRecord): string;
115
+ export {};