@enbox/dwn-sdk-js 0.1.1 → 0.2.0

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 (144) hide show
  1. package/dist/browser.mjs +7 -16
  2. package/dist/browser.mjs.map +4 -4
  3. package/dist/esm/src/utils/hd-key.js +1 -1
  4. package/dist/esm/src/utils/hd-key.js.map +1 -1
  5. package/dist/esm/src/utils/protocols.js +2 -2
  6. package/dist/esm/src/utils/protocols.js.map +1 -1
  7. package/dist/esm/tests/fuzz/arbitraries/dwn-message.arbitrary.js +72 -0
  8. package/dist/esm/tests/fuzz/arbitraries/dwn-message.arbitrary.js.map +1 -0
  9. package/dist/esm/tests/fuzz/arbitraries/filter.arbitrary.js +53 -0
  10. package/dist/esm/tests/fuzz/arbitraries/filter.arbitrary.js.map +1 -0
  11. package/dist/esm/tests/fuzz/arbitraries/jws.arbitrary.js +55 -0
  12. package/dist/esm/tests/fuzz/arbitraries/jws.arbitrary.js.map +1 -0
  13. package/dist/esm/tests/fuzz/arbitraries/protocol-definition.arbitrary.js +106 -0
  14. package/dist/esm/tests/fuzz/arbitraries/protocol-definition.arbitrary.js.map +1 -0
  15. package/dist/esm/tests/fuzz/arbitraries/store.arbitrary.js +139 -0
  16. package/dist/esm/tests/fuzz/arbitraries/store.arbitrary.js.map +1 -0
  17. package/dist/esm/tests/fuzz/cid.fuzz.spec.js +74 -0
  18. package/dist/esm/tests/fuzz/cid.fuzz.spec.js.map +1 -0
  19. package/dist/esm/tests/fuzz/compound-index.fuzz.spec.js +203 -0
  20. package/dist/esm/tests/fuzz/compound-index.fuzz.spec.js.map +1 -0
  21. package/dist/esm/tests/fuzz/data-store.fuzz.spec.js +146 -0
  22. package/dist/esm/tests/fuzz/data-store.fuzz.spec.js.map +1 -0
  23. package/dist/esm/tests/fuzz/data-stream.fuzz.spec.js +44 -0
  24. package/dist/esm/tests/fuzz/data-stream.fuzz.spec.js.map +1 -0
  25. package/dist/esm/tests/fuzz/encoder.fuzz.spec.js +76 -0
  26. package/dist/esm/tests/fuzz/encoder.fuzz.spec.js.map +1 -0
  27. package/dist/esm/tests/fuzz/encryption.fuzz.spec.js +132 -0
  28. package/dist/esm/tests/fuzz/encryption.fuzz.spec.js.map +1 -0
  29. package/dist/esm/tests/fuzz/filter.fuzz.spec.js +149 -0
  30. package/dist/esm/tests/fuzz/filter.fuzz.spec.js.map +1 -0
  31. package/dist/esm/tests/fuzz/get-rule-set-at-path.fuzz.spec.js +82 -0
  32. package/dist/esm/tests/fuzz/get-rule-set-at-path.fuzz.spec.js.map +1 -0
  33. package/dist/esm/tests/fuzz/hd-key.fuzz.spec.js +77 -0
  34. package/dist/esm/tests/fuzz/hd-key.fuzz.spec.js.map +1 -0
  35. package/dist/esm/tests/fuzz/immutable-properties.fuzz.spec.js +86 -0
  36. package/dist/esm/tests/fuzz/immutable-properties.fuzz.spec.js.map +1 -0
  37. package/dist/esm/tests/fuzz/index-level.fuzz.spec.js +195 -0
  38. package/dist/esm/tests/fuzz/index-level.fuzz.spec.js.map +1 -0
  39. package/dist/esm/tests/fuzz/jws.fuzz.spec.js +100 -0
  40. package/dist/esm/tests/fuzz/jws.fuzz.spec.js.map +1 -0
  41. package/dist/esm/tests/fuzz/message-store.fuzz.spec.js +154 -0
  42. package/dist/esm/tests/fuzz/message-store.fuzz.spec.js.map +1 -0
  43. package/dist/esm/tests/fuzz/object.fuzz.spec.js +82 -0
  44. package/dist/esm/tests/fuzz/object.fuzz.spec.js.map +1 -0
  45. package/dist/esm/tests/fuzz/process-message.fuzz.spec.js +85 -0
  46. package/dist/esm/tests/fuzz/process-message.fuzz.spec.js.map +1 -0
  47. package/dist/esm/tests/fuzz/protocol-definition.fuzz.spec.js +145 -0
  48. package/dist/esm/tests/fuzz/protocol-definition.fuzz.spec.js.map +1 -0
  49. package/dist/esm/tests/fuzz/protocol-validation.fuzz.spec.js +160 -0
  50. package/dist/esm/tests/fuzz/protocol-validation.fuzz.spec.js.map +1 -0
  51. package/dist/esm/tests/fuzz/protocols-utils.fuzz.spec.js +41 -0
  52. package/dist/esm/tests/fuzz/protocols-utils.fuzz.spec.js.map +1 -0
  53. package/dist/esm/tests/fuzz/records-utils.fuzz.spec.js +81 -0
  54. package/dist/esm/tests/fuzz/records-utils.fuzz.spec.js.map +1 -0
  55. package/dist/esm/tests/fuzz/resumable-task-store.fuzz.spec.js +106 -0
  56. package/dist/esm/tests/fuzz/resumable-task-store.fuzz.spec.js.map +1 -0
  57. package/dist/esm/tests/fuzz/schema-validation.fuzz.spec.js +126 -0
  58. package/dist/esm/tests/fuzz/schema-validation.fuzz.spec.js.map +1 -0
  59. package/dist/esm/tests/fuzz/secp256k1.fuzz.spec.js +74 -0
  60. package/dist/esm/tests/fuzz/secp256k1.fuzz.spec.js.map +1 -0
  61. package/dist/esm/tests/fuzz/secp256r1.fuzz.spec.js +60 -0
  62. package/dist/esm/tests/fuzz/secp256r1.fuzz.spec.js.map +1 -0
  63. package/dist/esm/tests/fuzz/time.fuzz.spec.js +82 -0
  64. package/dist/esm/tests/fuzz/time.fuzz.spec.js.map +1 -0
  65. package/dist/esm/tests/fuzz/url.fuzz.spec.js +118 -0
  66. package/dist/esm/tests/fuzz/url.fuzz.spec.js.map +1 -0
  67. package/dist/esm/tests/handlers/records-subscribe.spec.js +1 -1
  68. package/dist/esm/tests/handlers/records-subscribe.spec.js.map +1 -1
  69. package/dist/esm/tests/utils/secp256k1.spec.js.map +1 -1
  70. package/dist/esm/tests/utils/secp256r1.spec.js.map +1 -1
  71. package/dist/types/generated/precompiled-validators.d.ts +0 -70
  72. package/dist/types/generated/precompiled-validators.d.ts.map +1 -1
  73. package/dist/types/src/index.d.ts +2 -2
  74. package/dist/types/src/index.d.ts.map +1 -1
  75. package/dist/types/src/types/messages-types.d.ts +0 -4
  76. package/dist/types/src/types/messages-types.d.ts.map +1 -1
  77. package/dist/types/src/types/records-types.d.ts +0 -4
  78. package/dist/types/src/types/records-types.d.ts.map +1 -1
  79. package/dist/types/tests/fuzz/arbitraries/dwn-message.arbitrary.d.ts +31 -0
  80. package/dist/types/tests/fuzz/arbitraries/dwn-message.arbitrary.d.ts.map +1 -0
  81. package/dist/types/tests/fuzz/arbitraries/filter.arbitrary.d.ts +27 -0
  82. package/dist/types/tests/fuzz/arbitraries/filter.arbitrary.d.ts.map +1 -0
  83. package/dist/types/tests/fuzz/arbitraries/jws.arbitrary.d.ts +26 -0
  84. package/dist/types/tests/fuzz/arbitraries/jws.arbitrary.d.ts.map +1 -0
  85. package/dist/types/tests/fuzz/arbitraries/protocol-definition.arbitrary.d.ts +31 -0
  86. package/dist/types/tests/fuzz/arbitraries/protocol-definition.arbitrary.d.ts.map +1 -0
  87. package/dist/types/tests/fuzz/arbitraries/store.arbitrary.d.ts +71 -0
  88. package/dist/types/tests/fuzz/arbitraries/store.arbitrary.d.ts.map +1 -0
  89. package/dist/types/tests/fuzz/cid.fuzz.spec.d.ts +2 -0
  90. package/dist/types/tests/fuzz/cid.fuzz.spec.d.ts.map +1 -0
  91. package/dist/types/tests/fuzz/compound-index.fuzz.spec.d.ts +2 -0
  92. package/dist/types/tests/fuzz/compound-index.fuzz.spec.d.ts.map +1 -0
  93. package/dist/types/tests/fuzz/data-store.fuzz.spec.d.ts +2 -0
  94. package/dist/types/tests/fuzz/data-store.fuzz.spec.d.ts.map +1 -0
  95. package/dist/types/tests/fuzz/data-stream.fuzz.spec.d.ts +2 -0
  96. package/dist/types/tests/fuzz/data-stream.fuzz.spec.d.ts.map +1 -0
  97. package/dist/types/tests/fuzz/encoder.fuzz.spec.d.ts +2 -0
  98. package/dist/types/tests/fuzz/encoder.fuzz.spec.d.ts.map +1 -0
  99. package/dist/types/tests/fuzz/encryption.fuzz.spec.d.ts +2 -0
  100. package/dist/types/tests/fuzz/encryption.fuzz.spec.d.ts.map +1 -0
  101. package/dist/types/tests/fuzz/filter.fuzz.spec.d.ts +2 -0
  102. package/dist/types/tests/fuzz/filter.fuzz.spec.d.ts.map +1 -0
  103. package/dist/types/tests/fuzz/get-rule-set-at-path.fuzz.spec.d.ts +2 -0
  104. package/dist/types/tests/fuzz/get-rule-set-at-path.fuzz.spec.d.ts.map +1 -0
  105. package/dist/types/tests/fuzz/hd-key.fuzz.spec.d.ts +2 -0
  106. package/dist/types/tests/fuzz/hd-key.fuzz.spec.d.ts.map +1 -0
  107. package/dist/types/tests/fuzz/immutable-properties.fuzz.spec.d.ts +2 -0
  108. package/dist/types/tests/fuzz/immutable-properties.fuzz.spec.d.ts.map +1 -0
  109. package/dist/types/tests/fuzz/index-level.fuzz.spec.d.ts +2 -0
  110. package/dist/types/tests/fuzz/index-level.fuzz.spec.d.ts.map +1 -0
  111. package/dist/types/tests/fuzz/jws.fuzz.spec.d.ts +2 -0
  112. package/dist/types/tests/fuzz/jws.fuzz.spec.d.ts.map +1 -0
  113. package/dist/types/tests/fuzz/message-store.fuzz.spec.d.ts +2 -0
  114. package/dist/types/tests/fuzz/message-store.fuzz.spec.d.ts.map +1 -0
  115. package/dist/types/tests/fuzz/object.fuzz.spec.d.ts +2 -0
  116. package/dist/types/tests/fuzz/object.fuzz.spec.d.ts.map +1 -0
  117. package/dist/types/tests/fuzz/process-message.fuzz.spec.d.ts +2 -0
  118. package/dist/types/tests/fuzz/process-message.fuzz.spec.d.ts.map +1 -0
  119. package/dist/types/tests/fuzz/protocol-definition.fuzz.spec.d.ts +2 -0
  120. package/dist/types/tests/fuzz/protocol-definition.fuzz.spec.d.ts.map +1 -0
  121. package/dist/types/tests/fuzz/protocol-validation.fuzz.spec.d.ts +2 -0
  122. package/dist/types/tests/fuzz/protocol-validation.fuzz.spec.d.ts.map +1 -0
  123. package/dist/types/tests/fuzz/protocols-utils.fuzz.spec.d.ts +2 -0
  124. package/dist/types/tests/fuzz/protocols-utils.fuzz.spec.d.ts.map +1 -0
  125. package/dist/types/tests/fuzz/records-utils.fuzz.spec.d.ts +2 -0
  126. package/dist/types/tests/fuzz/records-utils.fuzz.spec.d.ts.map +1 -0
  127. package/dist/types/tests/fuzz/resumable-task-store.fuzz.spec.d.ts +2 -0
  128. package/dist/types/tests/fuzz/resumable-task-store.fuzz.spec.d.ts.map +1 -0
  129. package/dist/types/tests/fuzz/schema-validation.fuzz.spec.d.ts +2 -0
  130. package/dist/types/tests/fuzz/schema-validation.fuzz.spec.d.ts.map +1 -0
  131. package/dist/types/tests/fuzz/secp256k1.fuzz.spec.d.ts +2 -0
  132. package/dist/types/tests/fuzz/secp256k1.fuzz.spec.d.ts.map +1 -0
  133. package/dist/types/tests/fuzz/secp256r1.fuzz.spec.d.ts +2 -0
  134. package/dist/types/tests/fuzz/secp256r1.fuzz.spec.d.ts.map +1 -0
  135. package/dist/types/tests/fuzz/time.fuzz.spec.d.ts +2 -0
  136. package/dist/types/tests/fuzz/time.fuzz.spec.d.ts.map +1 -0
  137. package/dist/types/tests/fuzz/url.fuzz.spec.d.ts +2 -0
  138. package/dist/types/tests/fuzz/url.fuzz.spec.d.ts.map +1 -0
  139. package/package.json +24 -25
  140. package/src/index.ts +2 -2
  141. package/src/types/messages-types.ts +0 -5
  142. package/src/types/records-types.ts +0 -5
  143. package/src/utils/hd-key.ts +2 -2
  144. package/src/utils/protocols.ts +2 -2
@@ -59,11 +59,6 @@ export type MessagesSyncReply = GenericMessageReply & {
59
59
  entries? : string[]; // messageCid[] (for 'leaves' action)
60
60
  };
61
61
 
62
- /**
63
- * @deprecated Use {@link SubscriptionListener} directly. Retained as an alias for migration.
64
- */
65
- export type MessageSubscriptionHandler = SubscriptionListener;
66
-
67
62
  export type MessagesSubscribeMessageOptions = {
68
63
  subscriptionHandler: SubscriptionListener;
69
64
  };
@@ -191,11 +191,6 @@ export type RecordEvent = {
191
191
  initialWrite?: RecordsWriteMessage;
192
192
  };
193
193
 
194
- /**
195
- * @deprecated Use {@link SubscriptionListener} directly. Retained as an alias for migration.
196
- */
197
- export type RecordSubscriptionHandler = SubscriptionListener;
198
-
199
194
  export type RecordsSubscribeMessageOptions = {
200
195
  subscriptionHandler: SubscriptionListener;
201
196
  };
@@ -85,7 +85,7 @@ export class HdKey {
85
85
  const webCrypto = getWebcryptoSubtle() as SubtleCrypto;
86
86
 
87
87
  // Import the `initialKeyMaterial` into the Web Crypto API to use for the key derivation operation.
88
- const webCryptoKey = await webCrypto.importKey('raw', initialKeyMaterial, { name: 'HKDF' }, false, ['deriveBits']);
88
+ const webCryptoKey = await webCrypto.importKey('raw', initialKeyMaterial as BufferSource, { name: 'HKDF' }, false, ['deriveBits']);
89
89
 
90
90
  // Derive the bytes using the Web Crypto API.
91
91
  const derivedKeyBuffer = await crypto.subtle.deriveBits(
@@ -93,7 +93,7 @@ export class HdKey {
93
93
  name : 'HKDF',
94
94
  hash : hashAlgorithm,
95
95
  salt : new Uint8Array(0), // `info` should be sufficient in our use case
96
- info
96
+ info : info as BufferSource
97
97
  },
98
98
  webCryptoKey,
99
99
  keyLengthInBytes * 8 // convert from bytes to bits
@@ -62,10 +62,10 @@ export function getRuleSetAtPath(protocolPath: string, structure: { [key: string
62
62
  let currentLevel: { [key: string]: ProtocolRuleSet } = structure;
63
63
 
64
64
  for (const segment of segments) {
65
- current = currentLevel[segment];
66
- if (current === undefined) {
65
+ if (!Object.hasOwn(currentLevel, segment)) {
67
66
  return undefined;
68
67
  }
68
+ current = currentLevel[segment];
69
69
  currentLevel = current as { [key: string]: ProtocolRuleSet };
70
70
  }
71
71