@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.
- package/dist/browser.mjs +7 -16
- package/dist/browser.mjs.map +4 -4
- package/dist/esm/src/utils/hd-key.js +1 -1
- package/dist/esm/src/utils/hd-key.js.map +1 -1
- package/dist/esm/src/utils/protocols.js +2 -2
- package/dist/esm/src/utils/protocols.js.map +1 -1
- package/dist/esm/tests/fuzz/arbitraries/dwn-message.arbitrary.js +72 -0
- package/dist/esm/tests/fuzz/arbitraries/dwn-message.arbitrary.js.map +1 -0
- package/dist/esm/tests/fuzz/arbitraries/filter.arbitrary.js +53 -0
- package/dist/esm/tests/fuzz/arbitraries/filter.arbitrary.js.map +1 -0
- package/dist/esm/tests/fuzz/arbitraries/jws.arbitrary.js +55 -0
- package/dist/esm/tests/fuzz/arbitraries/jws.arbitrary.js.map +1 -0
- package/dist/esm/tests/fuzz/arbitraries/protocol-definition.arbitrary.js +106 -0
- package/dist/esm/tests/fuzz/arbitraries/protocol-definition.arbitrary.js.map +1 -0
- package/dist/esm/tests/fuzz/arbitraries/store.arbitrary.js +139 -0
- package/dist/esm/tests/fuzz/arbitraries/store.arbitrary.js.map +1 -0
- package/dist/esm/tests/fuzz/cid.fuzz.spec.js +74 -0
- package/dist/esm/tests/fuzz/cid.fuzz.spec.js.map +1 -0
- package/dist/esm/tests/fuzz/compound-index.fuzz.spec.js +203 -0
- package/dist/esm/tests/fuzz/compound-index.fuzz.spec.js.map +1 -0
- package/dist/esm/tests/fuzz/data-store.fuzz.spec.js +146 -0
- package/dist/esm/tests/fuzz/data-store.fuzz.spec.js.map +1 -0
- package/dist/esm/tests/fuzz/data-stream.fuzz.spec.js +44 -0
- package/dist/esm/tests/fuzz/data-stream.fuzz.spec.js.map +1 -0
- package/dist/esm/tests/fuzz/encoder.fuzz.spec.js +76 -0
- package/dist/esm/tests/fuzz/encoder.fuzz.spec.js.map +1 -0
- package/dist/esm/tests/fuzz/encryption.fuzz.spec.js +132 -0
- package/dist/esm/tests/fuzz/encryption.fuzz.spec.js.map +1 -0
- package/dist/esm/tests/fuzz/filter.fuzz.spec.js +149 -0
- package/dist/esm/tests/fuzz/filter.fuzz.spec.js.map +1 -0
- package/dist/esm/tests/fuzz/get-rule-set-at-path.fuzz.spec.js +82 -0
- package/dist/esm/tests/fuzz/get-rule-set-at-path.fuzz.spec.js.map +1 -0
- package/dist/esm/tests/fuzz/hd-key.fuzz.spec.js +77 -0
- package/dist/esm/tests/fuzz/hd-key.fuzz.spec.js.map +1 -0
- package/dist/esm/tests/fuzz/immutable-properties.fuzz.spec.js +86 -0
- package/dist/esm/tests/fuzz/immutable-properties.fuzz.spec.js.map +1 -0
- package/dist/esm/tests/fuzz/index-level.fuzz.spec.js +195 -0
- package/dist/esm/tests/fuzz/index-level.fuzz.spec.js.map +1 -0
- package/dist/esm/tests/fuzz/jws.fuzz.spec.js +100 -0
- package/dist/esm/tests/fuzz/jws.fuzz.spec.js.map +1 -0
- package/dist/esm/tests/fuzz/message-store.fuzz.spec.js +154 -0
- package/dist/esm/tests/fuzz/message-store.fuzz.spec.js.map +1 -0
- package/dist/esm/tests/fuzz/object.fuzz.spec.js +82 -0
- package/dist/esm/tests/fuzz/object.fuzz.spec.js.map +1 -0
- package/dist/esm/tests/fuzz/process-message.fuzz.spec.js +85 -0
- package/dist/esm/tests/fuzz/process-message.fuzz.spec.js.map +1 -0
- package/dist/esm/tests/fuzz/protocol-definition.fuzz.spec.js +145 -0
- package/dist/esm/tests/fuzz/protocol-definition.fuzz.spec.js.map +1 -0
- package/dist/esm/tests/fuzz/protocol-validation.fuzz.spec.js +160 -0
- package/dist/esm/tests/fuzz/protocol-validation.fuzz.spec.js.map +1 -0
- package/dist/esm/tests/fuzz/protocols-utils.fuzz.spec.js +41 -0
- package/dist/esm/tests/fuzz/protocols-utils.fuzz.spec.js.map +1 -0
- package/dist/esm/tests/fuzz/records-utils.fuzz.spec.js +81 -0
- package/dist/esm/tests/fuzz/records-utils.fuzz.spec.js.map +1 -0
- package/dist/esm/tests/fuzz/resumable-task-store.fuzz.spec.js +106 -0
- package/dist/esm/tests/fuzz/resumable-task-store.fuzz.spec.js.map +1 -0
- package/dist/esm/tests/fuzz/schema-validation.fuzz.spec.js +126 -0
- package/dist/esm/tests/fuzz/schema-validation.fuzz.spec.js.map +1 -0
- package/dist/esm/tests/fuzz/secp256k1.fuzz.spec.js +74 -0
- package/dist/esm/tests/fuzz/secp256k1.fuzz.spec.js.map +1 -0
- package/dist/esm/tests/fuzz/secp256r1.fuzz.spec.js +60 -0
- package/dist/esm/tests/fuzz/secp256r1.fuzz.spec.js.map +1 -0
- package/dist/esm/tests/fuzz/time.fuzz.spec.js +82 -0
- package/dist/esm/tests/fuzz/time.fuzz.spec.js.map +1 -0
- package/dist/esm/tests/fuzz/url.fuzz.spec.js +118 -0
- package/dist/esm/tests/fuzz/url.fuzz.spec.js.map +1 -0
- package/dist/esm/tests/handlers/records-subscribe.spec.js +1 -1
- package/dist/esm/tests/handlers/records-subscribe.spec.js.map +1 -1
- package/dist/esm/tests/utils/secp256k1.spec.js.map +1 -1
- package/dist/esm/tests/utils/secp256r1.spec.js.map +1 -1
- package/dist/types/generated/precompiled-validators.d.ts +0 -70
- package/dist/types/generated/precompiled-validators.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +2 -2
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/types/messages-types.d.ts +0 -4
- package/dist/types/src/types/messages-types.d.ts.map +1 -1
- package/dist/types/src/types/records-types.d.ts +0 -4
- package/dist/types/src/types/records-types.d.ts.map +1 -1
- package/dist/types/tests/fuzz/arbitraries/dwn-message.arbitrary.d.ts +31 -0
- package/dist/types/tests/fuzz/arbitraries/dwn-message.arbitrary.d.ts.map +1 -0
- package/dist/types/tests/fuzz/arbitraries/filter.arbitrary.d.ts +27 -0
- package/dist/types/tests/fuzz/arbitraries/filter.arbitrary.d.ts.map +1 -0
- package/dist/types/tests/fuzz/arbitraries/jws.arbitrary.d.ts +26 -0
- package/dist/types/tests/fuzz/arbitraries/jws.arbitrary.d.ts.map +1 -0
- package/dist/types/tests/fuzz/arbitraries/protocol-definition.arbitrary.d.ts +31 -0
- package/dist/types/tests/fuzz/arbitraries/protocol-definition.arbitrary.d.ts.map +1 -0
- package/dist/types/tests/fuzz/arbitraries/store.arbitrary.d.ts +71 -0
- package/dist/types/tests/fuzz/arbitraries/store.arbitrary.d.ts.map +1 -0
- package/dist/types/tests/fuzz/cid.fuzz.spec.d.ts +2 -0
- package/dist/types/tests/fuzz/cid.fuzz.spec.d.ts.map +1 -0
- package/dist/types/tests/fuzz/compound-index.fuzz.spec.d.ts +2 -0
- package/dist/types/tests/fuzz/compound-index.fuzz.spec.d.ts.map +1 -0
- package/dist/types/tests/fuzz/data-store.fuzz.spec.d.ts +2 -0
- package/dist/types/tests/fuzz/data-store.fuzz.spec.d.ts.map +1 -0
- package/dist/types/tests/fuzz/data-stream.fuzz.spec.d.ts +2 -0
- package/dist/types/tests/fuzz/data-stream.fuzz.spec.d.ts.map +1 -0
- package/dist/types/tests/fuzz/encoder.fuzz.spec.d.ts +2 -0
- package/dist/types/tests/fuzz/encoder.fuzz.spec.d.ts.map +1 -0
- package/dist/types/tests/fuzz/encryption.fuzz.spec.d.ts +2 -0
- package/dist/types/tests/fuzz/encryption.fuzz.spec.d.ts.map +1 -0
- package/dist/types/tests/fuzz/filter.fuzz.spec.d.ts +2 -0
- package/dist/types/tests/fuzz/filter.fuzz.spec.d.ts.map +1 -0
- package/dist/types/tests/fuzz/get-rule-set-at-path.fuzz.spec.d.ts +2 -0
- package/dist/types/tests/fuzz/get-rule-set-at-path.fuzz.spec.d.ts.map +1 -0
- package/dist/types/tests/fuzz/hd-key.fuzz.spec.d.ts +2 -0
- package/dist/types/tests/fuzz/hd-key.fuzz.spec.d.ts.map +1 -0
- package/dist/types/tests/fuzz/immutable-properties.fuzz.spec.d.ts +2 -0
- package/dist/types/tests/fuzz/immutable-properties.fuzz.spec.d.ts.map +1 -0
- package/dist/types/tests/fuzz/index-level.fuzz.spec.d.ts +2 -0
- package/dist/types/tests/fuzz/index-level.fuzz.spec.d.ts.map +1 -0
- package/dist/types/tests/fuzz/jws.fuzz.spec.d.ts +2 -0
- package/dist/types/tests/fuzz/jws.fuzz.spec.d.ts.map +1 -0
- package/dist/types/tests/fuzz/message-store.fuzz.spec.d.ts +2 -0
- package/dist/types/tests/fuzz/message-store.fuzz.spec.d.ts.map +1 -0
- package/dist/types/tests/fuzz/object.fuzz.spec.d.ts +2 -0
- package/dist/types/tests/fuzz/object.fuzz.spec.d.ts.map +1 -0
- package/dist/types/tests/fuzz/process-message.fuzz.spec.d.ts +2 -0
- package/dist/types/tests/fuzz/process-message.fuzz.spec.d.ts.map +1 -0
- package/dist/types/tests/fuzz/protocol-definition.fuzz.spec.d.ts +2 -0
- package/dist/types/tests/fuzz/protocol-definition.fuzz.spec.d.ts.map +1 -0
- package/dist/types/tests/fuzz/protocol-validation.fuzz.spec.d.ts +2 -0
- package/dist/types/tests/fuzz/protocol-validation.fuzz.spec.d.ts.map +1 -0
- package/dist/types/tests/fuzz/protocols-utils.fuzz.spec.d.ts +2 -0
- package/dist/types/tests/fuzz/protocols-utils.fuzz.spec.d.ts.map +1 -0
- package/dist/types/tests/fuzz/records-utils.fuzz.spec.d.ts +2 -0
- package/dist/types/tests/fuzz/records-utils.fuzz.spec.d.ts.map +1 -0
- package/dist/types/tests/fuzz/resumable-task-store.fuzz.spec.d.ts +2 -0
- package/dist/types/tests/fuzz/resumable-task-store.fuzz.spec.d.ts.map +1 -0
- package/dist/types/tests/fuzz/schema-validation.fuzz.spec.d.ts +2 -0
- package/dist/types/tests/fuzz/schema-validation.fuzz.spec.d.ts.map +1 -0
- package/dist/types/tests/fuzz/secp256k1.fuzz.spec.d.ts +2 -0
- package/dist/types/tests/fuzz/secp256k1.fuzz.spec.d.ts.map +1 -0
- package/dist/types/tests/fuzz/secp256r1.fuzz.spec.d.ts +2 -0
- package/dist/types/tests/fuzz/secp256r1.fuzz.spec.d.ts.map +1 -0
- package/dist/types/tests/fuzz/time.fuzz.spec.d.ts +2 -0
- package/dist/types/tests/fuzz/time.fuzz.spec.d.ts.map +1 -0
- package/dist/types/tests/fuzz/url.fuzz.spec.d.ts +2 -0
- package/dist/types/tests/fuzz/url.fuzz.spec.d.ts.map +1 -0
- package/package.json +24 -25
- package/src/index.ts +2 -2
- package/src/types/messages-types.ts +0 -5
- package/src/types/records-types.ts +0 -5
- package/src/utils/hd-key.ts +2 -2
- 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
|
};
|
package/src/utils/hd-key.ts
CHANGED
|
@@ -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
|
package/src/utils/protocols.ts
CHANGED
|
@@ -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
|
-
|
|
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
|
|