@enbox/dwn-sdk-js 0.4.7 → 0.4.9

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 (121) hide show
  1. package/dist/browser.mjs +1 -1
  2. package/dist/browser.mjs.map +4 -4
  3. package/dist/esm/generated/precompiled-validators.js +319 -0
  4. package/dist/esm/generated/precompiled-validators.js.map +1 -1
  5. package/dist/esm/src/core/dwn-error.js +1 -0
  6. package/dist/esm/src/core/dwn-error.js.map +1 -1
  7. package/dist/esm/src/index.js +1 -1
  8. package/dist/esm/src/index.js.map +1 -1
  9. package/dist/esm/src/interfaces/messages-subscribe.js.map +1 -1
  10. package/dist/esm/src/protocols/encryption.js +38 -6
  11. package/dist/esm/src/protocols/encryption.js.map +1 -1
  12. package/dist/esm/src/store/index-level-compound.js.map +1 -1
  13. package/dist/esm/src/store/level-wrapper.js +6 -2
  14. package/dist/esm/src/store/level-wrapper.js.map +1 -1
  15. package/dist/esm/src/utils/jws.js.map +1 -1
  16. package/dist/esm/tests/dwn.spec.js +5 -5
  17. package/dist/esm/tests/dwn.spec.js.map +1 -1
  18. package/dist/esm/tests/features/author-delegated-grant.spec.js +16 -16
  19. package/dist/esm/tests/features/author-delegated-grant.spec.js.map +1 -1
  20. package/dist/esm/tests/features/owner-delegated-grant.spec.js +7 -7
  21. package/dist/esm/tests/features/owner-delegated-grant.spec.js.map +1 -1
  22. package/dist/esm/tests/features/permissions.spec.js +8 -8
  23. package/dist/esm/tests/features/permissions.spec.js.map +1 -1
  24. package/dist/esm/tests/features/protocol-composition.spec.js +3 -3
  25. package/dist/esm/tests/features/protocol-composition.spec.js.map +1 -1
  26. package/dist/esm/tests/features/records-prune-cross-protocol.spec.js +5 -5
  27. package/dist/esm/tests/features/records-prune-cross-protocol.spec.js.map +1 -1
  28. package/dist/esm/tests/features/records-prune.spec.js +15 -15
  29. package/dist/esm/tests/features/records-prune.spec.js.map +1 -1
  30. package/dist/esm/tests/features/records-squash.spec.js +9 -9
  31. package/dist/esm/tests/features/records-squash.spec.js.map +1 -1
  32. package/dist/esm/tests/features/records-tags.spec.js +28 -28
  33. package/dist/esm/tests/features/records-tags.spec.js.map +1 -1
  34. package/dist/esm/tests/features/resumable-tasks.spec.js +3 -3
  35. package/dist/esm/tests/features/resumable-tasks.spec.js.map +1 -1
  36. package/dist/esm/tests/fuzz/data-stream.fuzz.spec.js +2 -2
  37. package/dist/esm/tests/fuzz/data-stream.fuzz.spec.js.map +1 -1
  38. package/dist/esm/tests/fuzz/filter.fuzz.spec.js +1 -1
  39. package/dist/esm/tests/fuzz/filter.fuzz.spec.js.map +1 -1
  40. package/dist/esm/tests/fuzz/records-utils.fuzz.spec.js +2 -2
  41. package/dist/esm/tests/fuzz/records-utils.fuzz.spec.js.map +1 -1
  42. package/dist/esm/tests/fuzz/resumable-task-store.fuzz.spec.js +4 -4
  43. package/dist/esm/tests/fuzz/resumable-task-store.fuzz.spec.js.map +1 -1
  44. package/dist/esm/tests/handlers/messages-subscribe.spec.js +16 -16
  45. package/dist/esm/tests/handlers/messages-subscribe.spec.js.map +1 -1
  46. package/dist/esm/tests/handlers/protocols-configure.spec.js +5 -5
  47. package/dist/esm/tests/handlers/protocols-configure.spec.js.map +1 -1
  48. package/dist/esm/tests/handlers/protocols-query.spec.js +11 -11
  49. package/dist/esm/tests/handlers/protocols-query.spec.js.map +1 -1
  50. package/dist/esm/tests/handlers/records-delete.spec.js +22 -22
  51. package/dist/esm/tests/handlers/records-delete.spec.js.map +1 -1
  52. package/dist/esm/tests/handlers/records-query.spec.js +120 -120
  53. package/dist/esm/tests/handlers/records-query.spec.js.map +1 -1
  54. package/dist/esm/tests/handlers/records-read.spec.js +1 -1
  55. package/dist/esm/tests/handlers/records-read.spec.js.map +1 -1
  56. package/dist/esm/tests/handlers/records-subscribe.spec.js +10 -10
  57. package/dist/esm/tests/handlers/records-subscribe.spec.js.map +1 -1
  58. package/dist/esm/tests/handlers/records-write.spec.js +31 -31
  59. package/dist/esm/tests/handlers/records-write.spec.js.map +1 -1
  60. package/dist/esm/tests/interfaces/protocols-configure.spec.js +4 -4
  61. package/dist/esm/tests/interfaces/protocols-configure.spec.js.map +1 -1
  62. package/dist/esm/tests/jose/jws/general.spec.js +4 -4
  63. package/dist/esm/tests/jose/jws/general.spec.js.map +1 -1
  64. package/dist/esm/tests/protocols/encryption.spec.js +94 -3
  65. package/dist/esm/tests/protocols/encryption.spec.js.map +1 -1
  66. package/dist/esm/tests/scenarios/nested-roles.spec.js +1 -1
  67. package/dist/esm/tests/scenarios/nested-roles.spec.js.map +1 -1
  68. package/dist/esm/tests/scenarios/subscriptions.spec.js +28 -28
  69. package/dist/esm/tests/scenarios/subscriptions.spec.js.map +1 -1
  70. package/dist/esm/tests/store/blockstore-mock.spec.js +1 -1
  71. package/dist/esm/tests/store/blockstore-mock.spec.js.map +1 -1
  72. package/dist/esm/tests/store/data-store-level.spec.js +3 -3
  73. package/dist/esm/tests/store/data-store-level.spec.js.map +1 -1
  74. package/dist/esm/tests/store/index-level.spec.js +83 -83
  75. package/dist/esm/tests/store/index-level.spec.js.map +1 -1
  76. package/dist/esm/tests/store/message-store-level.spec.js +2 -2
  77. package/dist/esm/tests/store/message-store-level.spec.js.map +1 -1
  78. package/dist/esm/tests/store/message-store.spec.js +30 -30
  79. package/dist/esm/tests/store/message-store.spec.js.map +1 -1
  80. package/dist/esm/tests/store-dependent-tests.spec.js +5 -0
  81. package/dist/esm/tests/store-dependent-tests.spec.js.map +1 -1
  82. package/dist/esm/tests/utils/data-stream.spec.js +15 -15
  83. package/dist/esm/tests/utils/data-stream.spec.js.map +1 -1
  84. package/dist/esm/tests/utils/encryption.spec.js +1 -1
  85. package/dist/esm/tests/utils/encryption.spec.js.map +1 -1
  86. package/dist/esm/tests/utils/messages.spec.js +8 -8
  87. package/dist/esm/tests/utils/messages.spec.js.map +1 -1
  88. package/dist/esm/tests/utils/secp256k1.spec.js +2 -2
  89. package/dist/esm/tests/utils/secp256k1.spec.js.map +1 -1
  90. package/dist/esm/tests/utils/secp256r1.spec.js +1 -1
  91. package/dist/esm/tests/utils/secp256r1.spec.js.map +1 -1
  92. package/dist/esm/tests/validation/json-schemas/encryption/wrapped-grant-key-envelope.spec.js +43 -0
  93. package/dist/esm/tests/validation/json-schemas/encryption/wrapped-grant-key-envelope.spec.js.map +1 -0
  94. package/dist/types/generated/precompiled-validators.d.ts +16 -0
  95. package/dist/types/generated/precompiled-validators.d.ts.map +1 -1
  96. package/dist/types/src/core/dwn-error.d.ts +1 -0
  97. package/dist/types/src/core/dwn-error.d.ts.map +1 -1
  98. package/dist/types/src/index.d.ts +2 -1
  99. package/dist/types/src/index.d.ts.map +1 -1
  100. package/dist/types/src/interfaces/messages-subscribe.d.ts +1 -2
  101. package/dist/types/src/interfaces/messages-subscribe.d.ts.map +1 -1
  102. package/dist/types/src/protocols/encryption.d.ts +15 -2
  103. package/dist/types/src/protocols/encryption.d.ts.map +1 -1
  104. package/dist/types/src/store/index-level-compound.d.ts +2 -4
  105. package/dist/types/src/store/index-level-compound.d.ts.map +1 -1
  106. package/dist/types/src/store/level-wrapper.d.ts.map +1 -1
  107. package/dist/types/src/types/protocols-types.d.ts +1 -1
  108. package/dist/types/src/types/protocols-types.d.ts.map +1 -1
  109. package/dist/types/src/utils/jws.d.ts +1 -2
  110. package/dist/types/src/utils/jws.d.ts.map +1 -1
  111. package/dist/types/tests/validation/json-schemas/encryption/wrapped-grant-key-envelope.spec.d.ts +2 -0
  112. package/dist/types/tests/validation/json-schemas/encryption/wrapped-grant-key-envelope.spec.d.ts.map +1 -0
  113. package/package.json +4 -4
  114. package/src/core/dwn-error.ts +1 -0
  115. package/src/index.ts +2 -1
  116. package/src/interfaces/messages-subscribe.ts +1 -2
  117. package/src/protocols/encryption.ts +59 -6
  118. package/src/store/index-level-compound.ts +2 -5
  119. package/src/store/level-wrapper.ts +6 -2
  120. package/src/types/protocols-types.ts +2 -1
  121. package/src/utils/jws.ts +1 -2
@@ -16520,4 +16520,323 @@ function validate109(data, { instancePath = "", parentData, parentDataProperty,
16520
16520
  }
16521
16521
  } validate109.errors = vErrors; return errors === 0; }
16522
16522
  validate109.evaluated = { "props": true, "dynamicProps": false, "dynamicItems": false };
16523
+ export const WrappedGrantKeyEnvelope = validate110;
16524
+ const schema153 = { "$id": "https://identity.foundation/dwn/json-schemas/encryption/wrapped-grant-key-envelope.json", "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "additionalProperties": false, "required": ["format", "keyEncryption", "contentEncryption", "ciphertext"], "properties": { "format": { "const": "enbox/wrapped-grant-key@1" }, "keyEncryption": { "type": "object", "additionalProperties": false, "required": ["algorithm", "keyId", "ephemeralPublicKey", "encryptedKey"], "properties": { "algorithm": { "const": "X25519-HKDF-SHA256+A256KW" }, "keyId": { "type": "string", "pattern": "^[A-Za-z0-9_-]{43}$" }, "ephemeralPublicKey": { "$ref": "#/$defs/x25519PublicKey" }, "encryptedKey": { "$ref": "https://identity.foundation/dwn/json-schemas/defs.json#/$defs/base64url" } } }, "contentEncryption": { "type": "object", "additionalProperties": false, "required": ["algorithm", "initializationVector"], "properties": { "algorithm": { "const": "A256CTR" }, "initializationVector": { "$ref": "https://identity.foundation/dwn/json-schemas/defs.json#/$defs/base64url" } } }, "ciphertext": { "$ref": "https://identity.foundation/dwn/json-schemas/defs.json#/$defs/base64url" } }, "$defs": { "x25519PublicKey": { "allOf": [{ "$ref": "https://identity.foundation/dwn/json-schemas/public-jwk.json" }], "type": "object", "required": ["kty", "crv", "x"], "properties": { "kty": { "const": "OKP" }, "crv": { "const": "X25519" }, "x": { "$ref": "https://identity.foundation/dwn/json-schemas/defs.json#/$defs/base64url" } } } } };
16525
+ const schema154 = { "allOf": [{ "$ref": "https://identity.foundation/dwn/json-schemas/public-jwk.json" }], "type": "object", "required": ["kty", "crv", "x"], "properties": { "kty": { "const": "OKP" }, "crv": { "const": "X25519" }, "x": { "$ref": "https://identity.foundation/dwn/json-schemas/defs.json#/$defs/base64url" } } };
16526
+ function validate111(data, { instancePath = "", parentData, parentDataProperty, rootData = data, dynamicAnchors = {} } = {}) { let vErrors = null; let errors = 0; const evaluated0 = validate111.evaluated; if (evaluated0.dynamicProps) {
16527
+ evaluated0.props = undefined;
16528
+ } if (evaluated0.dynamicItems) {
16529
+ evaluated0.items = undefined;
16530
+ } if (!(validate33(data, { instancePath, parentData, parentDataProperty, rootData, dynamicAnchors }))) {
16531
+ vErrors = vErrors === null ? validate33.errors : vErrors.concat(validate33.errors);
16532
+ errors = vErrors.length;
16533
+ }
16534
+ else {
16535
+ var props0 = validate33.evaluated.props;
16536
+ } if (errors === 0) {
16537
+ if (data && typeof data == "object" && !Array.isArray(data)) {
16538
+ let missing0;
16539
+ if ((((data.kty === undefined) && (missing0 = "kty")) || ((data.crv === undefined) && (missing0 = "crv"))) || ((data.x === undefined) && (missing0 = "x"))) {
16540
+ validate111.errors = [{ instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: missing0 }, message: "must have required property '" + missing0 + "'" }];
16541
+ return false;
16542
+ }
16543
+ else {
16544
+ if (props0 !== true) {
16545
+ props0 = props0 || {};
16546
+ props0.kty = true;
16547
+ props0.crv = true;
16548
+ props0.x = true;
16549
+ }
16550
+ if (data.kty !== undefined) {
16551
+ const _errs2 = errors;
16552
+ if ("OKP" !== data.kty) {
16553
+ validate111.errors = [{ instancePath: instancePath + "/kty", schemaPath: "#/properties/kty/const", keyword: "const", params: { allowedValue: "OKP" }, message: "must be equal to constant" }];
16554
+ return false;
16555
+ }
16556
+ var valid1 = _errs2 === errors;
16557
+ }
16558
+ else {
16559
+ var valid1 = true;
16560
+ }
16561
+ if (valid1) {
16562
+ if (data.crv !== undefined) {
16563
+ const _errs3 = errors;
16564
+ if ("X25519" !== data.crv) {
16565
+ validate111.errors = [{ instancePath: instancePath + "/crv", schemaPath: "#/properties/crv/const", keyword: "const", params: { allowedValue: "X25519" }, message: "must be equal to constant" }];
16566
+ return false;
16567
+ }
16568
+ var valid1 = _errs3 === errors;
16569
+ }
16570
+ else {
16571
+ var valid1 = true;
16572
+ }
16573
+ if (valid1) {
16574
+ if (data.x !== undefined) {
16575
+ let data2 = data.x;
16576
+ const _errs4 = errors;
16577
+ const _errs5 = errors;
16578
+ if (errors === _errs5) {
16579
+ if (typeof data2 === "string") {
16580
+ if (!pattern4.test(data2)) {
16581
+ validate111.errors = [{ instancePath: instancePath + "/x", schemaPath: "https://identity.foundation/dwn/json-schemas/defs.json#/$defs/base64url/pattern", keyword: "pattern", params: { pattern: "^[A-Za-z0-9_-]+$" }, message: "must match pattern \"" + "^[A-Za-z0-9_-]+$" + "\"" }];
16582
+ return false;
16583
+ }
16584
+ }
16585
+ else {
16586
+ validate111.errors = [{ instancePath: instancePath + "/x", schemaPath: "https://identity.foundation/dwn/json-schemas/defs.json#/$defs/base64url/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
16587
+ return false;
16588
+ }
16589
+ }
16590
+ var valid1 = _errs4 === errors;
16591
+ }
16592
+ else {
16593
+ var valid1 = true;
16594
+ }
16595
+ }
16596
+ }
16597
+ }
16598
+ }
16599
+ else {
16600
+ validate111.errors = [{ instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
16601
+ return false;
16602
+ }
16603
+ } validate111.errors = vErrors; evaluated0.props = props0; return errors === 0; }
16604
+ validate111.evaluated = { "dynamicProps": true, "dynamicItems": false };
16605
+ function validate110(data, { instancePath = "", parentData, parentDataProperty, rootData = data, dynamicAnchors = {} } = {}) { /*# sourceURL="https://identity.foundation/dwn/json-schemas/encryption/wrapped-grant-key-envelope.json" */ ; let vErrors = null; let errors = 0; const evaluated0 = validate110.evaluated; if (evaluated0.dynamicProps) {
16606
+ evaluated0.props = undefined;
16607
+ } if (evaluated0.dynamicItems) {
16608
+ evaluated0.items = undefined;
16609
+ } if (errors === 0) {
16610
+ if (data && typeof data == "object" && !Array.isArray(data)) {
16611
+ let missing0;
16612
+ if (((((data.format === undefined) && (missing0 = "format")) || ((data.keyEncryption === undefined) && (missing0 = "keyEncryption"))) || ((data.contentEncryption === undefined) && (missing0 = "contentEncryption"))) || ((data.ciphertext === undefined) && (missing0 = "ciphertext"))) {
16613
+ validate110.errors = [{ instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: missing0 }, message: "must have required property '" + missing0 + "'" }];
16614
+ return false;
16615
+ }
16616
+ else {
16617
+ const _errs1 = errors;
16618
+ for (const key0 in data) {
16619
+ if (!((((key0 === "format") || (key0 === "keyEncryption")) || (key0 === "contentEncryption")) || (key0 === "ciphertext"))) {
16620
+ validate110.errors = [{ instancePath, schemaPath: "#/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key0 }, message: "must NOT have additional properties" }];
16621
+ return false;
16622
+ break;
16623
+ }
16624
+ }
16625
+ if (_errs1 === errors) {
16626
+ if (data.format !== undefined) {
16627
+ const _errs2 = errors;
16628
+ if ("enbox/wrapped-grant-key@1" !== data.format) {
16629
+ validate110.errors = [{ instancePath: instancePath + "/format", schemaPath: "#/properties/format/const", keyword: "const", params: { allowedValue: "enbox/wrapped-grant-key@1" }, message: "must be equal to constant" }];
16630
+ return false;
16631
+ }
16632
+ var valid0 = _errs2 === errors;
16633
+ }
16634
+ else {
16635
+ var valid0 = true;
16636
+ }
16637
+ if (valid0) {
16638
+ if (data.keyEncryption !== undefined) {
16639
+ let data1 = data.keyEncryption;
16640
+ const _errs3 = errors;
16641
+ if (errors === _errs3) {
16642
+ if (data1 && typeof data1 == "object" && !Array.isArray(data1)) {
16643
+ let missing1;
16644
+ if (((((data1.algorithm === undefined) && (missing1 = "algorithm")) || ((data1.keyId === undefined) && (missing1 = "keyId"))) || ((data1.ephemeralPublicKey === undefined) && (missing1 = "ephemeralPublicKey"))) || ((data1.encryptedKey === undefined) && (missing1 = "encryptedKey"))) {
16645
+ validate110.errors = [{ instancePath: instancePath + "/keyEncryption", schemaPath: "#/properties/keyEncryption/required", keyword: "required", params: { missingProperty: missing1 }, message: "must have required property '" + missing1 + "'" }];
16646
+ return false;
16647
+ }
16648
+ else {
16649
+ const _errs5 = errors;
16650
+ for (const key1 in data1) {
16651
+ if (!((((key1 === "algorithm") || (key1 === "keyId")) || (key1 === "ephemeralPublicKey")) || (key1 === "encryptedKey"))) {
16652
+ validate110.errors = [{ instancePath: instancePath + "/keyEncryption", schemaPath: "#/properties/keyEncryption/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key1 }, message: "must NOT have additional properties" }];
16653
+ return false;
16654
+ break;
16655
+ }
16656
+ }
16657
+ if (_errs5 === errors) {
16658
+ if (data1.algorithm !== undefined) {
16659
+ const _errs6 = errors;
16660
+ if ("X25519-HKDF-SHA256+A256KW" !== data1.algorithm) {
16661
+ validate110.errors = [{ instancePath: instancePath + "/keyEncryption/algorithm", schemaPath: "#/properties/keyEncryption/properties/algorithm/const", keyword: "const", params: { allowedValue: "X25519-HKDF-SHA256+A256KW" }, message: "must be equal to constant" }];
16662
+ return false;
16663
+ }
16664
+ var valid1 = _errs6 === errors;
16665
+ }
16666
+ else {
16667
+ var valid1 = true;
16668
+ }
16669
+ if (valid1) {
16670
+ if (data1.keyId !== undefined) {
16671
+ let data3 = data1.keyId;
16672
+ const _errs7 = errors;
16673
+ if (errors === _errs7) {
16674
+ if (typeof data3 === "string") {
16675
+ if (!pattern9.test(data3)) {
16676
+ validate110.errors = [{ instancePath: instancePath + "/keyEncryption/keyId", schemaPath: "#/properties/keyEncryption/properties/keyId/pattern", keyword: "pattern", params: { pattern: "^[A-Za-z0-9_-]{43}$" }, message: "must match pattern \"" + "^[A-Za-z0-9_-]{43}$" + "\"" }];
16677
+ return false;
16678
+ }
16679
+ }
16680
+ else {
16681
+ validate110.errors = [{ instancePath: instancePath + "/keyEncryption/keyId", schemaPath: "#/properties/keyEncryption/properties/keyId/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
16682
+ return false;
16683
+ }
16684
+ }
16685
+ var valid1 = _errs7 === errors;
16686
+ }
16687
+ else {
16688
+ var valid1 = true;
16689
+ }
16690
+ if (valid1) {
16691
+ if (data1.ephemeralPublicKey !== undefined) {
16692
+ const _errs9 = errors;
16693
+ if (!(validate111(data1.ephemeralPublicKey, { instancePath: instancePath + "/keyEncryption/ephemeralPublicKey", parentData: data1, parentDataProperty: "ephemeralPublicKey", rootData, dynamicAnchors }))) {
16694
+ vErrors = vErrors === null ? validate111.errors : vErrors.concat(validate111.errors);
16695
+ errors = vErrors.length;
16696
+ }
16697
+ var valid1 = _errs9 === errors;
16698
+ }
16699
+ else {
16700
+ var valid1 = true;
16701
+ }
16702
+ if (valid1) {
16703
+ if (data1.encryptedKey !== undefined) {
16704
+ let data5 = data1.encryptedKey;
16705
+ const _errs10 = errors;
16706
+ const _errs11 = errors;
16707
+ if (errors === _errs11) {
16708
+ if (typeof data5 === "string") {
16709
+ if (!pattern4.test(data5)) {
16710
+ validate110.errors = [{ instancePath: instancePath + "/keyEncryption/encryptedKey", schemaPath: "https://identity.foundation/dwn/json-schemas/defs.json#/$defs/base64url/pattern", keyword: "pattern", params: { pattern: "^[A-Za-z0-9_-]+$" }, message: "must match pattern \"" + "^[A-Za-z0-9_-]+$" + "\"" }];
16711
+ return false;
16712
+ }
16713
+ }
16714
+ else {
16715
+ validate110.errors = [{ instancePath: instancePath + "/keyEncryption/encryptedKey", schemaPath: "https://identity.foundation/dwn/json-schemas/defs.json#/$defs/base64url/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
16716
+ return false;
16717
+ }
16718
+ }
16719
+ var valid1 = _errs10 === errors;
16720
+ }
16721
+ else {
16722
+ var valid1 = true;
16723
+ }
16724
+ }
16725
+ }
16726
+ }
16727
+ }
16728
+ }
16729
+ }
16730
+ else {
16731
+ validate110.errors = [{ instancePath: instancePath + "/keyEncryption", schemaPath: "#/properties/keyEncryption/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
16732
+ return false;
16733
+ }
16734
+ }
16735
+ var valid0 = _errs3 === errors;
16736
+ }
16737
+ else {
16738
+ var valid0 = true;
16739
+ }
16740
+ if (valid0) {
16741
+ if (data.contentEncryption !== undefined) {
16742
+ let data6 = data.contentEncryption;
16743
+ const _errs13 = errors;
16744
+ if (errors === _errs13) {
16745
+ if (data6 && typeof data6 == "object" && !Array.isArray(data6)) {
16746
+ let missing2;
16747
+ if (((data6.algorithm === undefined) && (missing2 = "algorithm")) || ((data6.initializationVector === undefined) && (missing2 = "initializationVector"))) {
16748
+ validate110.errors = [{ instancePath: instancePath + "/contentEncryption", schemaPath: "#/properties/contentEncryption/required", keyword: "required", params: { missingProperty: missing2 }, message: "must have required property '" + missing2 + "'" }];
16749
+ return false;
16750
+ }
16751
+ else {
16752
+ const _errs15 = errors;
16753
+ for (const key2 in data6) {
16754
+ if (!((key2 === "algorithm") || (key2 === "initializationVector"))) {
16755
+ validate110.errors = [{ instancePath: instancePath + "/contentEncryption", schemaPath: "#/properties/contentEncryption/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key2 }, message: "must NOT have additional properties" }];
16756
+ return false;
16757
+ break;
16758
+ }
16759
+ }
16760
+ if (_errs15 === errors) {
16761
+ if (data6.algorithm !== undefined) {
16762
+ const _errs16 = errors;
16763
+ if ("A256CTR" !== data6.algorithm) {
16764
+ validate110.errors = [{ instancePath: instancePath + "/contentEncryption/algorithm", schemaPath: "#/properties/contentEncryption/properties/algorithm/const", keyword: "const", params: { allowedValue: "A256CTR" }, message: "must be equal to constant" }];
16765
+ return false;
16766
+ }
16767
+ var valid3 = _errs16 === errors;
16768
+ }
16769
+ else {
16770
+ var valid3 = true;
16771
+ }
16772
+ if (valid3) {
16773
+ if (data6.initializationVector !== undefined) {
16774
+ let data8 = data6.initializationVector;
16775
+ const _errs17 = errors;
16776
+ const _errs18 = errors;
16777
+ if (errors === _errs18) {
16778
+ if (typeof data8 === "string") {
16779
+ if (!pattern4.test(data8)) {
16780
+ validate110.errors = [{ instancePath: instancePath + "/contentEncryption/initializationVector", schemaPath: "https://identity.foundation/dwn/json-schemas/defs.json#/$defs/base64url/pattern", keyword: "pattern", params: { pattern: "^[A-Za-z0-9_-]+$" }, message: "must match pattern \"" + "^[A-Za-z0-9_-]+$" + "\"" }];
16781
+ return false;
16782
+ }
16783
+ }
16784
+ else {
16785
+ validate110.errors = [{ instancePath: instancePath + "/contentEncryption/initializationVector", schemaPath: "https://identity.foundation/dwn/json-schemas/defs.json#/$defs/base64url/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
16786
+ return false;
16787
+ }
16788
+ }
16789
+ var valid3 = _errs17 === errors;
16790
+ }
16791
+ else {
16792
+ var valid3 = true;
16793
+ }
16794
+ }
16795
+ }
16796
+ }
16797
+ }
16798
+ else {
16799
+ validate110.errors = [{ instancePath: instancePath + "/contentEncryption", schemaPath: "#/properties/contentEncryption/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
16800
+ return false;
16801
+ }
16802
+ }
16803
+ var valid0 = _errs13 === errors;
16804
+ }
16805
+ else {
16806
+ var valid0 = true;
16807
+ }
16808
+ if (valid0) {
16809
+ if (data.ciphertext !== undefined) {
16810
+ let data9 = data.ciphertext;
16811
+ const _errs20 = errors;
16812
+ const _errs21 = errors;
16813
+ if (errors === _errs21) {
16814
+ if (typeof data9 === "string") {
16815
+ if (!pattern4.test(data9)) {
16816
+ validate110.errors = [{ instancePath: instancePath + "/ciphertext", schemaPath: "https://identity.foundation/dwn/json-schemas/defs.json#/$defs/base64url/pattern", keyword: "pattern", params: { pattern: "^[A-Za-z0-9_-]+$" }, message: "must match pattern \"" + "^[A-Za-z0-9_-]+$" + "\"" }];
16817
+ return false;
16818
+ }
16819
+ }
16820
+ else {
16821
+ validate110.errors = [{ instancePath: instancePath + "/ciphertext", schemaPath: "https://identity.foundation/dwn/json-schemas/defs.json#/$defs/base64url/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
16822
+ return false;
16823
+ }
16824
+ }
16825
+ var valid0 = _errs20 === errors;
16826
+ }
16827
+ else {
16828
+ var valid0 = true;
16829
+ }
16830
+ }
16831
+ }
16832
+ }
16833
+ }
16834
+ }
16835
+ }
16836
+ else {
16837
+ validate110.errors = [{ instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
16838
+ return false;
16839
+ }
16840
+ } validate110.errors = vErrors; return errors === 0; }
16841
+ validate110.evaluated = { "props": true, "dynamicProps": false, "dynamicItems": false };
16523
16842
  //# sourceMappingURL=precompiled-validators.js.map