@verana-labs/vs-agent-sdk 1.13.0-dev.1 → 1.13.0-dev.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.
- package/build/agent/VsAgent.js +5 -5
- package/build/agent/VsAgent.js.map +1 -1
- package/build/blockchain/handlers/stateMutations.d.ts +2 -1
- package/build/blockchain/handlers/stateMutations.js +29 -28
- package/build/blockchain/handlers/stateMutations.js.map +1 -1
- package/build/utils/data.js +149 -135
- package/build/utils/data.js.map +1 -1
- package/build/utils/setupSelfTr.d.ts +6 -9
- package/build/utils/setupSelfTr.js +53 -90
- package/build/utils/setupSelfTr.js.map +1 -1
- package/build/utils/trustCredentialStore.d.ts +2 -0
- package/build/utils/trustCredentialStore.js +45 -2
- package/build/utils/trustCredentialStore.js.map +1 -1
- package/build/vtFlow/VtFlowOrchestrator.js +4 -5
- package/build/vtFlow/VtFlowOrchestrator.js.map +1 -1
- package/package.json +4 -4
package/build/utils/data.js
CHANGED
|
@@ -1,207 +1,221 @@
|
|
|
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/
|
|
4
6
|
function getEcsSchemas(publicApiBaseUrl) {
|
|
5
7
|
return {
|
|
6
8
|
'ecs-org': `{
|
|
7
9
|
"$id": "${publicApiBaseUrl}/vt/cs/v1/js/ecs-org",
|
|
8
10
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
9
|
-
"title": "OrganizationCredential",
|
|
10
11
|
"description": "Identifies a legal organization that operates one or more Verifiable Services.",
|
|
11
|
-
"type": "object",
|
|
12
12
|
"properties": {
|
|
13
13
|
"credentialSubject": {
|
|
14
|
-
"type": "object",
|
|
15
14
|
"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
|
+
},
|
|
16
26
|
"id": {
|
|
17
|
-
"type": "string",
|
|
18
27
|
"format": "uri",
|
|
19
|
-
"maxLength": 2048
|
|
28
|
+
"maxLength": 2048,
|
|
29
|
+
"type": "string"
|
|
20
30
|
},
|
|
21
|
-
"
|
|
22
|
-
"
|
|
31
|
+
"legalJurisdiction": {
|
|
32
|
+
"maxLength": 64,
|
|
23
33
|
"minLength": 1,
|
|
24
|
-
"
|
|
34
|
+
"pattern": "^[A-Z]{2}(-[A-Z0-9]{1,3})?$",
|
|
35
|
+
"type": "string"
|
|
25
36
|
},
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"maxLength": 1400000,
|
|
30
|
-
"pattern": "^data:image/(png|jpeg|svg\\\\+xml);base64,"
|
|
37
|
+
"lei": {
|
|
38
|
+
"pattern": "^[A-Z0-9]{20}$",
|
|
39
|
+
"type": "string"
|
|
31
40
|
},
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"maxLength": 256
|
|
41
|
+
"logoDigestSri": {
|
|
42
|
+
"maxLength": 256,
|
|
43
|
+
"type": "string"
|
|
36
44
|
},
|
|
37
|
-
"
|
|
38
|
-
"type": "string",
|
|
45
|
+
"logoUri": {
|
|
39
46
|
"format": "uri",
|
|
40
|
-
"maxLength": 4096
|
|
47
|
+
"maxLength": 4096,
|
|
48
|
+
"type": "string"
|
|
41
49
|
},
|
|
42
|
-
"
|
|
43
|
-
"
|
|
50
|
+
"name": {
|
|
51
|
+
"maxLength": 512,
|
|
44
52
|
"minLength": 1,
|
|
45
|
-
"
|
|
46
|
-
},
|
|
47
|
-
"countryCode": {
|
|
48
|
-
"type": "string",
|
|
49
|
-
"minLength": 2,
|
|
50
|
-
"maxLength": 2,
|
|
51
|
-
"pattern": "^[A-Z]{2}$"
|
|
53
|
+
"type": "string"
|
|
52
54
|
},
|
|
53
|
-
"
|
|
54
|
-
"type": "string",
|
|
55
|
-
"minLength": 1,
|
|
55
|
+
"organizationKind": {
|
|
56
56
|
"maxLength": 64,
|
|
57
|
-
"
|
|
57
|
+
"minLength": 1,
|
|
58
|
+
"type": "string"
|
|
58
59
|
},
|
|
59
|
-
"
|
|
60
|
-
"
|
|
60
|
+
"registryId": {
|
|
61
|
+
"maxLength": 256,
|
|
61
62
|
"minLength": 1,
|
|
62
|
-
"
|
|
63
|
+
"type": "string"
|
|
63
64
|
},
|
|
64
|
-
"
|
|
65
|
-
"
|
|
66
|
-
"
|
|
65
|
+
"registryUri": {
|
|
66
|
+
"format": "uri",
|
|
67
|
+
"maxLength": 4096,
|
|
68
|
+
"type": "string"
|
|
67
69
|
}
|
|
68
70
|
},
|
|
69
71
|
"required": [
|
|
70
72
|
"id",
|
|
71
73
|
"name",
|
|
72
|
-
"
|
|
74
|
+
"logoUri",
|
|
75
|
+
"logoDigestSri",
|
|
73
76
|
"registryId",
|
|
74
77
|
"address",
|
|
75
78
|
"countryCode"
|
|
76
|
-
]
|
|
79
|
+
],
|
|
80
|
+
"type": "object"
|
|
77
81
|
}
|
|
78
|
-
}
|
|
82
|
+
},
|
|
83
|
+
"title": "OrganizationCredential",
|
|
84
|
+
"type": "object"
|
|
79
85
|
}`,
|
|
80
|
-
'ecs-
|
|
81
|
-
"$id": "${publicApiBaseUrl}/vt/cs/v1/js/ecs-
|
|
86
|
+
'ecs-persona': `{
|
|
87
|
+
"$id": "${publicApiBaseUrl}/vt/cs/v1/js/ecs-persona",
|
|
82
88
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
83
|
-
"title": "PersonaCredential",
|
|
84
89
|
"description": "Identifies a Persona (human-controlled avatar) that operates one or more Verifiable Services.",
|
|
85
|
-
"type": "object",
|
|
86
90
|
"properties": {
|
|
87
91
|
"credentialSubject": {
|
|
88
|
-
"
|
|
92
|
+
"dependentRequired": {
|
|
93
|
+
"avatarUri": [
|
|
94
|
+
"avatarDigestSri"
|
|
95
|
+
]
|
|
96
|
+
},
|
|
89
97
|
"properties": {
|
|
90
|
-
"
|
|
91
|
-
"
|
|
98
|
+
"avatarDigestSri": {
|
|
99
|
+
"maxLength": 256,
|
|
100
|
+
"type": "string"
|
|
101
|
+
},
|
|
102
|
+
"avatarUri": {
|
|
92
103
|
"format": "uri",
|
|
93
|
-
"maxLength":
|
|
104
|
+
"maxLength": 4096,
|
|
105
|
+
"type": "string"
|
|
94
106
|
},
|
|
95
|
-
"
|
|
96
|
-
"
|
|
97
|
-
"minLength":
|
|
98
|
-
"
|
|
107
|
+
"controllerCountryCode": {
|
|
108
|
+
"maxLength": 2,
|
|
109
|
+
"minLength": 2,
|
|
110
|
+
"pattern": "^[A-Z]{2}$",
|
|
111
|
+
"type": "string"
|
|
99
112
|
},
|
|
100
|
-
"
|
|
101
|
-
"
|
|
102
|
-
"
|
|
103
|
-
"
|
|
104
|
-
"
|
|
113
|
+
"controllerJurisdiction": {
|
|
114
|
+
"maxLength": 64,
|
|
115
|
+
"minLength": 1,
|
|
116
|
+
"pattern": "^[A-Z]{2}(-[A-Z0-9]{1,3})?$",
|
|
117
|
+
"type": "string"
|
|
105
118
|
},
|
|
106
119
|
"description": {
|
|
107
|
-
"
|
|
120
|
+
"maxLength": 16384,
|
|
108
121
|
"minLength": 0,
|
|
109
|
-
"
|
|
122
|
+
"type": "string"
|
|
110
123
|
},
|
|
111
124
|
"descriptionFormat": {
|
|
112
|
-
"
|
|
125
|
+
"default": "text/plain",
|
|
113
126
|
"enum": [
|
|
114
127
|
"text/plain",
|
|
115
128
|
"text/markdown"
|
|
116
129
|
],
|
|
117
|
-
"
|
|
130
|
+
"type": "string"
|
|
118
131
|
},
|
|
119
|
-
"
|
|
120
|
-
"
|
|
121
|
-
"
|
|
122
|
-
"
|
|
123
|
-
"pattern": "^[A-Z]{2}$"
|
|
132
|
+
"id": {
|
|
133
|
+
"format": "uri",
|
|
134
|
+
"maxLength": 2048,
|
|
135
|
+
"type": "string"
|
|
124
136
|
},
|
|
125
|
-
"
|
|
126
|
-
"
|
|
137
|
+
"name": {
|
|
138
|
+
"maxLength": 256,
|
|
127
139
|
"minLength": 1,
|
|
128
|
-
"
|
|
129
|
-
"pattern": "^[A-Z]{2}(-[A-Z0-9]{1,3})?$"
|
|
140
|
+
"type": "string"
|
|
130
141
|
}
|
|
131
142
|
},
|
|
132
143
|
"required": [
|
|
133
144
|
"id",
|
|
134
145
|
"name",
|
|
135
146
|
"controllerCountryCode"
|
|
136
|
-
]
|
|
147
|
+
],
|
|
148
|
+
"type": "object"
|
|
137
149
|
}
|
|
138
|
-
}
|
|
150
|
+
},
|
|
151
|
+
"title": "PersonaCredential",
|
|
152
|
+
"type": "object"
|
|
139
153
|
}`,
|
|
140
154
|
'ecs-service': `{
|
|
141
155
|
"$id": "${publicApiBaseUrl}/vt/cs/v1/js/ecs-service",
|
|
142
156
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
143
|
-
"title": "ServiceCredential",
|
|
144
157
|
"description": "Identifies a Verifiable Service and defines the minimum trust and access requirements required to interact with it.",
|
|
145
|
-
"type": "object",
|
|
146
158
|
"properties": {
|
|
147
159
|
"credentialSubject": {
|
|
148
|
-
"type": "object",
|
|
149
160
|
"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
161
|
"description": {
|
|
166
|
-
"
|
|
167
|
-
"
|
|
162
|
+
"maxLength": 4096,
|
|
163
|
+
"type": "string"
|
|
168
164
|
},
|
|
169
165
|
"descriptionFormat": {
|
|
170
|
-
"
|
|
166
|
+
"default": "text/plain",
|
|
171
167
|
"enum": [
|
|
172
168
|
"text/plain",
|
|
173
169
|
"text/markdown"
|
|
174
170
|
],
|
|
175
|
-
"
|
|
171
|
+
"type": "string"
|
|
172
|
+
},
|
|
173
|
+
"id": {
|
|
174
|
+
"format": "uri",
|
|
175
|
+
"maxLength": 2048,
|
|
176
|
+
"type": "string"
|
|
177
|
+
},
|
|
178
|
+
"logoDigestSri": {
|
|
179
|
+
"maxLength": 256,
|
|
180
|
+
"type": "string"
|
|
176
181
|
},
|
|
177
|
-
"
|
|
178
|
-
"type": "string",
|
|
182
|
+
"logoUri": {
|
|
179
183
|
"format": "uri",
|
|
180
|
-
"maxLength":
|
|
181
|
-
"
|
|
184
|
+
"maxLength": 4096,
|
|
185
|
+
"type": "string"
|
|
182
186
|
},
|
|
183
187
|
"minimumAgeRequired": {
|
|
184
|
-
"
|
|
188
|
+
"maximum": 255,
|
|
185
189
|
"minimum": 0,
|
|
186
|
-
"
|
|
190
|
+
"type": "integer"
|
|
191
|
+
},
|
|
192
|
+
"name": {
|
|
193
|
+
"maxLength": 512,
|
|
194
|
+
"minLength": 1,
|
|
195
|
+
"type": "string"
|
|
187
196
|
},
|
|
188
|
-
"
|
|
189
|
-
"
|
|
197
|
+
"privacyPolicyDigestSri": {
|
|
198
|
+
"maxLength": 256,
|
|
199
|
+
"type": "string"
|
|
200
|
+
},
|
|
201
|
+
"privacyPolicyUri": {
|
|
190
202
|
"format": "uri",
|
|
191
|
-
"maxLength": 4096
|
|
203
|
+
"maxLength": 4096,
|
|
204
|
+
"type": "string"
|
|
192
205
|
},
|
|
193
206
|
"termsAndConditionsDigestSri": {
|
|
194
|
-
"
|
|
195
|
-
"
|
|
207
|
+
"maxLength": 256,
|
|
208
|
+
"type": "string"
|
|
196
209
|
},
|
|
197
|
-
"
|
|
198
|
-
"type": "string",
|
|
210
|
+
"termsAndConditionsUri": {
|
|
199
211
|
"format": "uri",
|
|
200
|
-
"maxLength": 4096
|
|
212
|
+
"maxLength": 4096,
|
|
213
|
+
"type": "string"
|
|
201
214
|
},
|
|
202
|
-
"
|
|
203
|
-
"
|
|
204
|
-
"
|
|
215
|
+
"type": {
|
|
216
|
+
"maxLength": 128,
|
|
217
|
+
"minLength": 1,
|
|
218
|
+
"type": "string"
|
|
205
219
|
}
|
|
206
220
|
},
|
|
207
221
|
"required": [
|
|
@@ -209,46 +223,46 @@ function getEcsSchemas(publicApiBaseUrl) {
|
|
|
209
223
|
"name",
|
|
210
224
|
"type",
|
|
211
225
|
"description",
|
|
212
|
-
"
|
|
226
|
+
"logoUri",
|
|
227
|
+
"logoDigestSri",
|
|
213
228
|
"minimumAgeRequired",
|
|
214
|
-
"
|
|
215
|
-
"
|
|
216
|
-
|
|
229
|
+
"termsAndConditionsUri",
|
|
230
|
+
"termsAndConditionsDigestSri",
|
|
231
|
+
"privacyPolicyUri",
|
|
232
|
+
"privacyPolicyDigestSri"
|
|
233
|
+
],
|
|
234
|
+
"type": "object"
|
|
217
235
|
}
|
|
218
|
-
}
|
|
236
|
+
},
|
|
237
|
+
"title": "ServiceCredential",
|
|
238
|
+
"type": "object"
|
|
219
239
|
}`,
|
|
220
240
|
'ecs-user-agent': `{
|
|
221
241
|
"$id": "${publicApiBaseUrl}/vt/cs/v1/js/ecs-user-agent",
|
|
222
242
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
223
|
-
"title": "UserAgentCredential",
|
|
224
243
|
"description": "Identifies a User Agent instance and the software version it runs. The issuer identifies the software product line.",
|
|
225
|
-
"type": "object",
|
|
226
244
|
"properties": {
|
|
227
245
|
"credentialSubject": {
|
|
228
|
-
"type": "object",
|
|
229
246
|
"properties": {
|
|
230
|
-
"
|
|
231
|
-
"
|
|
232
|
-
"format": "uri",
|
|
233
|
-
"maxLength": 2048
|
|
234
|
-
},
|
|
235
|
-
"version": {
|
|
236
|
-
"type": "string",
|
|
247
|
+
"build": {
|
|
248
|
+
"maxLength": 128,
|
|
237
249
|
"minLength": 1,
|
|
238
|
-
"
|
|
250
|
+
"type": "string"
|
|
239
251
|
},
|
|
240
|
-
"
|
|
241
|
-
"
|
|
252
|
+
"version": {
|
|
253
|
+
"maxLength": 64,
|
|
242
254
|
"minLength": 1,
|
|
243
|
-
"
|
|
255
|
+
"type": "string"
|
|
244
256
|
}
|
|
245
257
|
},
|
|
246
258
|
"required": [
|
|
247
|
-
"id",
|
|
248
259
|
"version"
|
|
249
|
-
]
|
|
260
|
+
],
|
|
261
|
+
"type": "object"
|
|
250
262
|
}
|
|
251
|
-
}
|
|
263
|
+
},
|
|
264
|
+
"title": "UserAgentCredential",
|
|
265
|
+
"type": "object"
|
|
252
266
|
}`,
|
|
253
267
|
};
|
|
254
268
|
}
|
package/build/utils/data.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data.js","sourceRoot":"","sources":["../../src/utils/data.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"data.js","sourceRoot":"","sources":["../../src/utils/data.ts"],"names":[],"mappings":";;AAEA,sCAsQC;AAxQD,mEAAmE;AACnE,kEAAkE;AAClE,SAAgB,aAAa,CAAC,gBAAwB;IACpD,OAAO;QACL,SAAS,EAAE;YACH,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4E1B;QACE,aAAa,EAAE;YACP,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkE1B;QACE,aAAa,EAAE;YACP,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoF1B;QACE,gBAAgB,EAAE;YACV,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;EAyB1B;KACC,CAAA;AACH,CAAC"}
|
|
@@ -1,10 +1,9 @@
|
|
|
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
|
-
interface SelfTrDefaults {
|
|
4
|
+
export interface SelfTrDefaults {
|
|
5
5
|
agentLabel: string;
|
|
6
|
-
|
|
7
|
-
fallbackBase64?: string;
|
|
6
|
+
serviceLogoUri: string;
|
|
8
7
|
serviceType: string;
|
|
9
8
|
serviceDescription: string;
|
|
10
9
|
serviceMinimumAgeRequired: number;
|
|
@@ -27,6 +26,7 @@ export declare const credentials: {
|
|
|
27
26
|
}[];
|
|
28
27
|
export declare const createJsonSchema: W3cCredentialSchema;
|
|
29
28
|
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,11 +105,8 @@ 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
|
-
*
|
|
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.
|
|
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.
|
|
112
110
|
*/
|
|
113
|
-
export declare function
|
|
111
|
+
export declare function urlDigestSri(url: string): Promise<string>;
|
|
114
112
|
export declare function getVerificationMethodId(logger: Logger, didRecord: DidRecord): string;
|
|
115
|
-
export {};
|