@pdtf/schemas 0.7.2 → 0.7.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pdtf/schemas",
3
- "version": "0.7.2",
3
+ "version": "0.7.3",
4
4
  "description": "Property Data Trust Framework Schemas and Utilities",
5
5
  "main": "index.js",
6
6
  "directories": {
@@ -0,0 +1,32 @@
1
+ {
2
+ "verification": {
3
+ "trust_framework": "uk_pdtf",
4
+ "time": "2022-01-25T13:05:03.108Z",
5
+ "evidence": [
6
+ {
7
+ "type": "vouch",
8
+ "attestation": {
9
+ "type": "digital_attestation",
10
+ "voucher": {
11
+ "name": "Martin Abode"
12
+ }
13
+ },
14
+ "verification_method": {
15
+ "type": "auth"
16
+ }
17
+ }
18
+ ]
19
+ },
20
+ "claims": {
21
+ "/participants/-": {
22
+ "name": {
23
+ "firstName": "Martin",
24
+ "lastName": "Abode"
25
+ },
26
+ "email": "martin@abode.co.uk",
27
+ "organisation": "Abode and Floggit Estate Agents",
28
+ "organisationReference": "MAR/12243/22",
29
+ "role": "Estate Agent"
30
+ }
31
+ }
32
+ }
@@ -12,7 +12,8 @@
12
12
  "value": "randomHashValue"
13
13
  },
14
14
  "url": "https://fakeFileStore.com/some/kind/of/file",
15
- "desc": "proofOfAddress.pdf"
15
+ "desc": "proofOfAddress.pdf",
16
+ "pdtfSchemaPath": "/propertyPack/materialFacts/councilTax/councilTaxAffectingAlterations/details"
16
17
  }
17
18
  ],
18
19
  "verification_method": {
@@ -404,17 +404,10 @@
404
404
  "required": ["verified_claims"],
405
405
  "properties": {
406
406
  "verified_claims": {
407
- "anyOf": [
408
- {
409
- "$ref": "#/definitions/verified_claims_def"
410
- },
411
- {
412
- "type": "array",
413
- "items": {
414
- "$ref": "#/definitions/verified_claims_def"
415
- }
416
- }
417
- ]
407
+ "type": "array",
408
+ "items": {
409
+ "$ref": "#/definitions/verified_claims_def"
410
+ }
418
411
  }
419
412
  },
420
413
  "additionalProperties": false
@@ -15,38 +15,38 @@ addFormats(ajv);
15
15
  const validator = ajv.compile(verifiedClaimsSchema);
16
16
 
17
17
  test("valid vouch sample is valid", () => {
18
- const isValid = validator({ verified_claims: exampleVouch });
18
+ const isValid = validator({ verified_claims: [exampleVouch] });
19
19
  expect(isValid).toBe(true);
20
20
  });
21
21
 
22
22
  test("valid electronic record sample is valid", () => {
23
- const isValid = validator({ verified_claims: exampleElectronicRecord });
23
+ const isValid = validator({ verified_claims: [exampleElectronicRecord] });
24
24
  expect(isValid).toBe(true);
25
25
  });
26
26
 
27
27
  test("valid documented vouch sample is valid", () => {
28
- const isValid = validator({ verified_claims: exampleDocumentedVouch });
28
+ const isValid = validator({ verified_claims: [exampleDocumentedVouch] });
29
29
  expect(isValid).toBe(true);
30
30
  });
31
31
 
32
32
  test("sample with primitive claims value is valid", () => {
33
33
  const clonedVouch = JSON.parse(JSON.stringify(exampleVouch));
34
34
  clonedVouch.claims = { "/propertyPack/uprn": 123456 };
35
- const isValid = validator({ verified_claims: clonedVouch });
35
+ const isValid = validator({ verified_claims: [clonedVouch] });
36
36
  expect(isValid).toBe(true);
37
37
  });
38
38
 
39
39
  test("sample with undefined claims value is also valid, but this would fail when the payload is validated", () => {
40
40
  const clonedVouch = JSON.parse(JSON.stringify(exampleVouch));
41
41
  clonedVouch.claims = { "/propertyPack/uprn": undefined };
42
- const isValid = validator({ verified_claims: clonedVouch });
42
+ const isValid = validator({ verified_claims: [clonedVouch] });
43
43
  expect(isValid).toBe(true);
44
44
  });
45
45
 
46
46
  test("claim with missing claims is invalid", () => {
47
47
  const clonedVouch = JSON.parse(JSON.stringify(exampleVouch));
48
48
  delete clonedVouch.claims;
49
- const isValid = validator({ verified_claims: clonedVouch });
49
+ const isValid = validator({ verified_claims: [clonedVouch] });
50
50
  expect(isValid).toBe(false);
51
51
  });
52
52
 
@@ -55,20 +55,20 @@ test("claim with invalid claims path is invalid", () => {
55
55
  const originalPath = Object.keys(clonedVouch.claims)[0];
56
56
  const data = clonedVouch.claims[originalPath];
57
57
  clonedVouch.claims = { "invalidPath//of?someKind": data };
58
- const isValid = validator({ verified_claims: clonedVouch });
58
+ const isValid = validator({ verified_claims: [clonedVouch] });
59
59
  expect(isValid).toBe(false);
60
60
  });
61
61
 
62
62
  test("verification with invalid evidence type is invalid", () => {
63
63
  const clonedVouch = JSON.parse(JSON.stringify(exampleVouch));
64
64
  clonedVouch.verification.evidence[0].type = "something invalid";
65
- const isValid = validator({ verified_claims: clonedVouch });
65
+ const isValid = validator({ verified_claims: [clonedVouch] });
66
66
  expect(isValid).toBe(false);
67
67
  });
68
68
 
69
69
  test("verification with no framework type is invalid", () => {
70
70
  const clonedVouch = JSON.parse(JSON.stringify(exampleVouch));
71
71
  delete clonedVouch.verification.trust_framework;
72
- const isValid = validator({ verified_claims: clonedVouch });
72
+ const isValid = validator({ verified_claims: [clonedVouch] });
73
73
  expect(isValid).toBe(false);
74
74
  });
@@ -4,7 +4,7 @@ const exampleVouch = require("../examples/exampleVouch.json");
4
4
  const exampleDocumentedVouch = require("../examples/exampleDocumentedVouch.json");
5
5
 
6
6
  test("returns an empty array for a valid claim", () => {
7
- expect(validateVerifiedClaims(exampleVouch)).toEqual([]);
7
+ expect(validateVerifiedClaims([exampleVouch])).toEqual([]);
8
8
  });
9
9
 
10
10
  test("returns an empty array for a valid array of claims", () => {
@@ -19,7 +19,7 @@ test("returns an array with an error stating if path is incorrect", () => {
19
19
  clonedVouch.claims = {
20
20
  "/propertyPack/INVALID/materialFacts/councilTax": data,
21
21
  };
22
- expect(validateVerifiedClaims(clonedVouch)).toEqual([
22
+ expect(validateVerifiedClaims([clonedVouch])).toEqual([
23
23
  "Path /propertyPack/INVALID/materialFacts/councilTax is not a valid PDTF schema path",
24
24
  ]);
25
25
  });
@@ -36,7 +36,7 @@ test("returns an array of errors if data in the path is in invalid format", () =
36
36
  },
37
37
  },
38
38
  };
39
- expect(validateVerifiedClaims(clonedVouch)).toEqual([
39
+ expect(validateVerifiedClaims([clonedVouch])).toEqual([
40
40
  {
41
41
  instancePath: "",
42
42
  schemaPath: "#/required",
@@ -67,7 +67,7 @@ test("returns an array of errors for verified claim with multiple paths", () =>
67
67
  },
68
68
  },
69
69
  };
70
- expect(validateVerifiedClaims(clonedVouch)).toEqual([
70
+ expect(validateVerifiedClaims([clonedVouch])).toEqual([
71
71
  "Path /propertyPack/materialFacts/cousncilTaxBad is not a valid PDTF schema path",
72
72
  "Path /propertyPack/materialFacts/councilTaxBadTwo is not a valid PDTF schema path",
73
73
  ]);
@@ -92,5 +92,5 @@ test("returns an empty array of errors for verified claim with multiple valid pa
92
92
  postcode: "property.postcode",
93
93
  },
94
94
  };
95
- expect(validateVerifiedClaims(clonedVouch)).toEqual([]);
95
+ expect(validateVerifiedClaims([clonedVouch])).toEqual([]);
96
96
  });
@@ -1,621 +0,0 @@
1
- {
2
- "$schema": "http://json-schema.org/draft-07/schema#",
3
- "$id": "https://openid.net/schemas/verified_claims-12.json",
4
- "definitions": {
5
- "date_type": {
6
- "type": "string",
7
- "format": "date"
8
- },
9
- "time_type": {
10
- "type": "string",
11
- "format": "date-time"
12
- },
13
- "document_number": {
14
- "type": "string"
15
- },
16
- "document_details": {
17
- "type": "object",
18
- "properties": {
19
- "type": {
20
- "type": "string"
21
- },
22
- "document_number": {
23
- "$ref": "#/definitions/document_number"
24
- },
25
- "number": {
26
- "$ref": "#/definitions/document_number"
27
- },
28
- "personal_number": {
29
- "type": "string"
30
- },
31
- "serial_number": {
32
- "type": "string"
33
- },
34
- "date_of_issuance": {
35
- "$ref": "#/definitions/date_type"
36
- },
37
- "date_of_expiry": {
38
- "$ref": "#/definitions/date_type"
39
- },
40
- "issuer": {
41
- "type": "object",
42
- "properties": {
43
- "name": {
44
- "type": "string"
45
- },
46
- "formatted": {
47
- "type": "string"
48
- },
49
- "street_address": {
50
- "type": "string"
51
- },
52
- "locality": {
53
- "type": "string"
54
- },
55
- "region": {
56
- "type": "string"
57
- },
58
- "postal_code": {
59
- "type": "string"
60
- },
61
- "country": {
62
- "type": "string"
63
- },
64
- "country_code": {
65
- "type": "string"
66
- },
67
- "jurisdiction": {
68
- "type": "string"
69
- }
70
- }
71
- }
72
- }
73
- },
74
- "validation_method": {
75
- "type": "object",
76
- "properties": {
77
- "type": {
78
- "type": "string"
79
- },
80
- "policy": {
81
- "type": "string"
82
- },
83
- "procedure": {
84
- "type": "string"
85
- },
86
- "status": {
87
- "type": "string"
88
- }
89
- }
90
- },
91
- "verification_method": {
92
- "type": "object",
93
- "properties": {
94
- "type": {
95
- "type": "string"
96
- },
97
- "policy": {
98
- "type": "string"
99
- },
100
- "procedure": {
101
- "type": "string"
102
- },
103
- "status": {
104
- "type": "string"
105
- }
106
- }
107
- },
108
- "evidence": {
109
- "type": "object",
110
- "properties": {
111
- "type": {
112
- "type": "string",
113
- "enum": [
114
- "electronic_signature",
115
- "id_document",
116
- "document",
117
- "electronic_record",
118
- "vouch",
119
- "utility_bill"
120
- ]
121
- },
122
- "attachments": {
123
- "$ref": "#/definitions/attachments"
124
- }
125
- },
126
- "required": ["type"],
127
- "allOf": [
128
- {
129
- "if": {
130
- "properties": {
131
- "type": {
132
- "const": "electronic_signature"
133
- }
134
- }
135
- },
136
- "then": {
137
- "properties": {
138
- "signature_type": {
139
- "type": "string"
140
- },
141
- "issuer": {
142
- "type": "string"
143
- },
144
- "serial_number": {
145
- "type": "string"
146
- },
147
- "created_at": {
148
- "$ref": "#/definitions/time_type"
149
- }
150
- }
151
- },
152
- "else": {}
153
- },
154
- {
155
- "if": {
156
- "properties": {
157
- "type": {
158
- "type": "string",
159
- "pattern": "^(id_)*document$"
160
- }
161
- }
162
- },
163
- "then": {
164
- "properties": {
165
- "validation_method": {
166
- "$ref": "#/definitions/validation_method"
167
- },
168
- "verification_method": {
169
- "$ref": "#/definitions/verification_method"
170
- },
171
- "method": {
172
- "type": "string"
173
- },
174
- "verifier": {
175
- "type": "object",
176
- "properties": {
177
- "organization": {
178
- "type": "string"
179
- },
180
- "txn": {
181
- "type": "string"
182
- }
183
- }
184
- },
185
- "time": {
186
- "$ref": "#/definitions/time_type"
187
- },
188
- "document_details": {
189
- "$ref": "#/definitions/document_details"
190
- },
191
- "document": {
192
- "$ref": "#/definitions/document_details"
193
- }
194
- }
195
- },
196
- "else": {}
197
- },
198
- {
199
- "if": {
200
- "properties": {
201
- "type": {
202
- "const": "electronic_record"
203
- }
204
- }
205
- },
206
- "then": {
207
- "properties": {
208
- "validation_method": {
209
- "$ref": "#/definitions/validation_method"
210
- },
211
- "verification_method": {
212
- "$ref": "#/definitions/verification_method"
213
- },
214
- "verifier": {
215
- "type": "object",
216
- "properties": {
217
- "organization": {
218
- "type": "string"
219
- },
220
- "txn": {
221
- "type": "string"
222
- }
223
- }
224
- },
225
- "time": {
226
- "$ref": "#/definitions/time_type"
227
- },
228
- "record": {
229
- "type": "object",
230
- "properties": {
231
- "type": {
232
- "type": "string"
233
- },
234
- "personal_number": {
235
- "type": "string"
236
- },
237
- "created_at": {
238
- "$ref": "#/definitions/date_type"
239
- },
240
- "date_of_expiry": {
241
- "$ref": "#/definitions/date_type"
242
- },
243
- "source": {
244
- "type": "object",
245
- "properties": {
246
- "name": {
247
- "type": "string"
248
- },
249
- "formatted": {
250
- "type": "string"
251
- },
252
- "street_address": {
253
- "type": "string"
254
- },
255
- "locality": {
256
- "type": "string"
257
- },
258
- "region": {
259
- "type": "string"
260
- },
261
- "postal_code": {
262
- "type": "string"
263
- },
264
- "country": {
265
- "type": "string"
266
- },
267
- "country_code": {
268
- "type": "string"
269
- },
270
- "jurisdiction": {
271
- "type": "string"
272
- }
273
- }
274
- }
275
- }
276
- }
277
- }
278
- },
279
- "else": {}
280
- },
281
- {
282
- "if": {
283
- "properties": {
284
- "type": {
285
- "const": "vouch"
286
- }
287
- }
288
- },
289
- "then": {
290
- "properties": {
291
- "validation_method": {
292
- "$ref": "#/definitions/validation_method"
293
- },
294
- "verification_method": {
295
- "$ref": "#/definitions/verification_method"
296
- },
297
- "verifier": {
298
- "type": "object",
299
- "properties": {
300
- "organization": {
301
- "type": "string"
302
- },
303
- "txn": {
304
- "type": "string"
305
- }
306
- }
307
- },
308
- "time": {
309
- "$ref": "#/definitions/time_type"
310
- },
311
- "attestation": {
312
- "type": "object",
313
- "properties": {
314
- "type": {
315
- "type": "string"
316
- },
317
- "reference_number": {
318
- "type": "string"
319
- },
320
- "personal_number": {
321
- "type": "string"
322
- },
323
- "date_of_issuance": {
324
- "$ref": "#/definitions/date_type"
325
- },
326
- "date_of_expiry": {
327
- "$ref": "#/definitions/date_type"
328
- },
329
- "voucher": {
330
- "type": "object",
331
- "properties": {
332
- "name": {
333
- "type": "string"
334
- },
335
- "birthdate": {
336
- "$ref": "#/definitions/date_type"
337
- },
338
- "formatted": {
339
- "type": "string"
340
- },
341
- "street_address": {
342
- "type": "string"
343
- },
344
- "locality": {
345
- "type": "string"
346
- },
347
- "region": {
348
- "type": "string"
349
- },
350
- "postal_code": {
351
- "type": "string"
352
- },
353
- "country": {
354
- "type": "string"
355
- },
356
- "occupation": {
357
- "type": "string"
358
- },
359
- "organization": {
360
- "type": "string"
361
- }
362
- }
363
- }
364
- }
365
- }
366
- }
367
- },
368
- "else": {}
369
- },
370
- {
371
- "if": {
372
- "properties": {
373
- "type": {
374
- "const": "utility_bill"
375
- }
376
- }
377
- },
378
- "then": {
379
- "properties": {
380
- "provider": {
381
- "type": "object",
382
- "properties": {
383
- "name": {
384
- "type": "string"
385
- },
386
- "formatted": {
387
- "type": "string"
388
- },
389
- "street_address": {
390
- "type": "string"
391
- },
392
- "locality": {
393
- "type": "string"
394
- },
395
- "region": {
396
- "type": "string"
397
- },
398
- "postal_code": {
399
- "type": "string"
400
- },
401
- "country": {
402
- "type": "string"
403
- }
404
- }
405
- },
406
- "date": {
407
- "$ref": "#/definitions/date_type"
408
- }
409
- }
410
- },
411
- "else": {}
412
- }
413
- ]
414
- },
415
- "digest": {
416
- "type": "object",
417
- "properties": {
418
- "alg": {
419
- "type": "string"
420
- },
421
- "value": {
422
- "type": "string",
423
- "contentEncoding": "base64"
424
- }
425
- },
426
- "required": ["alg", "value"]
427
- },
428
- "external_attachment": {
429
- "type": "object",
430
- "properties": {
431
- "desc": {
432
- "type": "string"
433
- },
434
- "digest": {
435
- "$ref": "#/definitions/digest"
436
- },
437
- "url": {
438
- "type": "string",
439
- "format": "uri"
440
- },
441
- "access_token": {
442
- "type": ["string", "null"]
443
- },
444
- "expires_in": {
445
- "type": "integer",
446
- "minimum": 1
447
- }
448
- },
449
- "required": ["digest", "url"]
450
- },
451
- "embedded_attachment": {
452
- "type": "object",
453
- "properties": {
454
- "desc": {
455
- "type": "string"
456
- },
457
- "content_type": {
458
- "type": "string"
459
- },
460
- "content": {
461
- "type": "string",
462
- "contentEncoding": "base64"
463
- }
464
- },
465
- "required": ["content_type", "content"]
466
- },
467
- "attachments": {
468
- "type": "array",
469
- "minItems": 1,
470
- "items": {
471
- "oneOf": [
472
- {
473
- "$ref": "#/definitions/external_attachment"
474
- },
475
- {
476
- "$ref": "#/definitions/embedded_attachment"
477
- }
478
- ]
479
- }
480
- },
481
- "verified_claims_def": {
482
- "type": "object",
483
- "properties": {
484
- "verification": {
485
- "type": "object",
486
- "properties": {
487
- "trust_framework": {
488
- "type": "string"
489
- },
490
- "assurance_level": {
491
- "type": "string"
492
- },
493
- "assurance_process": {
494
- "type": "object",
495
- "properties": {
496
- "policy": {
497
- "type": "string"
498
- },
499
- "procedure": {
500
- "type": "string"
501
- },
502
- "status": {
503
- "type": "string"
504
- }
505
- }
506
- },
507
- "time": {
508
- "$ref": "#/definitions/time_type"
509
- },
510
- "verification_process": {
511
- "type": "string"
512
- },
513
- "evidence": {
514
- "type": "array",
515
- "minItems": 1,
516
- "items": {
517
- "oneOf": [
518
- {
519
- "$ref": "#/definitions/evidence"
520
- }
521
- ]
522
- }
523
- }
524
- },
525
- "required": ["trust_framework"],
526
- "additionalProperties": true
527
- },
528
- "claims": {
529
- "type": "object",
530
- "minProperties": 1
531
- }
532
- },
533
- "required": ["verification", "claims"],
534
- "additionalProperties": false
535
- },
536
- "distributed_claims_available_def": {
537
- "type": "object",
538
- "properties": {},
539
- "additionalProperties": {
540
- "$ref": "#/definitions/verified_claims_def"
541
- }
542
- },
543
- "aggregated_claims": {
544
- "type": "object",
545
- "properties": {
546
- "JWT": {
547
- "type": "string"
548
- }
549
- },
550
- "required": ["JWT"]
551
- },
552
- "distributed_claims": {
553
- "type": "object",
554
- "properties": {
555
- "endpoint": {
556
- "type": "string"
557
- },
558
- "access_token": {
559
- "type": "string"
560
- }
561
- },
562
- "required": ["endpoint", "access_token"]
563
- },
564
- "_claim_sources": {
565
- "anyOf": [
566
- {
567
- "$ref": "#/definitions/aggregated_claims"
568
- },
569
- {
570
- "$ref": "#/definitions/distributed_claims"
571
- }
572
- ]
573
- }
574
- },
575
- "type": "object",
576
- "required": ["verified_claims"],
577
- "properties": {
578
- "verified_claims": {
579
- "anyOf": [
580
- {
581
- "$ref": "#/definitions/verified_claims_def"
582
- },
583
- {
584
- "type": "array",
585
- "items": {
586
- "$ref": "#/definitions/verified_claims_def"
587
- }
588
- }
589
- ]
590
- },
591
- "_claim_names": {
592
- "type": "object",
593
- "properties": {
594
- "verified_claims": {
595
- "anyOf": [
596
- {
597
- "type": "string"
598
- },
599
- {
600
- "type": "array",
601
- "items": {
602
- "type": "string"
603
- }
604
- },
605
- {
606
- "$ref": "#/definitions/distributed_claims_available_def"
607
- }
608
- ]
609
- }
610
- },
611
- "additionalProperties": false
612
- },
613
- "_claim_sources": {
614
- "type": "object",
615
- "properties": {},
616
- "additionalProperties": {
617
- "$ref": "#/definitions/_claim_sources"
618
- }
619
- }
620
- }
621
- }