@waku/core 0.0.34-c41b319.0 → 0.0.34-c43cec2.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/bundle/{base_protocol-CCK9RCtH.js → base_protocol-DxFKDXX2.js} +20 -19
- package/bundle/{index-Db7LxDrL.js → index-yLOEQnIE.js} +39 -75
- package/bundle/index.js +133 -1815
- package/bundle/lib/base_protocol.js +2 -2
- package/bundle/lib/message/version_0.js +2 -2
- package/bundle/{version_0-ANFNAdFD.js → version_0-Che4t3mN.js} +42 -163
- package/dist/.tsbuildinfo +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/lib/base_protocol.d.ts +2 -2
- package/dist/lib/base_protocol.js +2 -2
- package/dist/lib/base_protocol.js.map +1 -1
- package/dist/lib/connection_manager/connection_manager.d.ts +3 -56
- package/dist/lib/connection_manager/connection_manager.js +13 -96
- package/dist/lib/connection_manager/connection_manager.js.map +1 -1
- package/dist/lib/filter/index.d.ts +18 -1
- package/dist/lib/filter/index.js +208 -1
- package/dist/lib/filter/index.js.map +1 -1
- package/dist/lib/health_manager.d.ts +14 -0
- package/dist/lib/health_manager.js +70 -0
- package/dist/lib/health_manager.js.map +1 -0
- package/dist/lib/light_push/index.d.ts +15 -1
- package/dist/lib/light_push/index.js +144 -1
- package/dist/lib/light_push/index.js.map +1 -1
- package/dist/lib/metadata/index.d.ts +3 -1
- package/dist/lib/metadata/index.js +118 -1
- package/dist/lib/metadata/index.js.map +1 -1
- package/dist/lib/store/index.d.ts +9 -1
- package/dist/lib/store/index.js +82 -1
- package/dist/lib/store/index.js.map +1 -1
- package/dist/lib/stream_manager/stream_manager.d.ts +2 -2
- package/dist/lib/stream_manager/stream_manager.js +17 -16
- package/dist/lib/stream_manager/stream_manager.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +2 -0
- package/src/lib/base_protocol.ts +3 -3
- package/src/lib/connection_manager/connection_manager.ts +20 -114
- package/src/lib/filter/index.ts +315 -1
- package/src/lib/health_manager.ts +90 -0
- package/src/lib/light_push/index.ts +189 -1
- package/src/lib/metadata/index.ts +182 -1
- package/src/lib/store/index.ts +136 -1
- package/src/lib/stream_manager/stream_manager.ts +18 -16
- package/dist/lib/filter/filter.d.ts +0 -18
- package/dist/lib/filter/filter.js +0 -209
- package/dist/lib/filter/filter.js.map +0 -1
- package/dist/lib/light_push/light_push.d.ts +0 -15
- package/dist/lib/light_push/light_push.js +0 -144
- package/dist/lib/light_push/light_push.js.map +0 -1
- package/dist/lib/metadata/metadata.d.ts +0 -3
- package/dist/lib/metadata/metadata.js +0 -119
- package/dist/lib/metadata/metadata.js.map +0 -1
- package/dist/lib/store/store.d.ts +0 -9
- package/dist/lib/store/store.js +0 -83
- package/dist/lib/store/store.js.map +0 -1
- package/src/lib/filter/filter.ts +0 -315
- package/src/lib/light_push/light_push.ts +0 -188
- package/src/lib/metadata/metadata.ts +0 -182
- package/src/lib/store/store.ts +0 -136
@@ -1,2 +1,2 @@
|
|
1
|
-
export { B as BaseProtocol } from '../base_protocol-
|
2
|
-
import '../index-
|
1
|
+
export { B as BaseProtocol } from '../base_protocol-DxFKDXX2.js';
|
2
|
+
import '../index-yLOEQnIE.js';
|
@@ -1,2 +1,2 @@
|
|
1
|
-
export { D as DecodedMessage,
|
2
|
-
import '../../index-
|
1
|
+
export { D as DecodedMessage, o as Decoder, E as Encoder, V as Version, m as createDecoder, i as createEncoder, n as proto } from '../../version_0-Che4t3mN.js';
|
2
|
+
import '../../index-yLOEQnIE.js';
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { i as identityBase,
|
1
|
+
import { i as identityBase, c as base2, d as base8, e as base10, f as base16, g as base32, h as base36, j as base58, k as base64, l as base256emoji, L as Logger } from './index-yLOEQnIE.js';
|
2
2
|
|
3
3
|
/**
|
4
4
|
* Returns a `Uint8Array` of the requested size. Referenced memory will
|
@@ -3829,141 +3829,31 @@ var WakuMetadataResponse;
|
|
3829
3829
|
};
|
3830
3830
|
})(WakuMetadataResponse || (WakuMetadataResponse = {}));
|
3831
3831
|
|
3832
|
-
|
3833
|
-
/* eslint-disable complexity */
|
3834
|
-
/* eslint-disable @typescript-eslint/no-namespace */
|
3835
|
-
/* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */
|
3836
|
-
/* eslint-disable @typescript-eslint/no-empty-interface */
|
3837
|
-
var SdsMessage;
|
3838
|
-
(function (SdsMessage) {
|
3839
|
-
let _codec;
|
3840
|
-
SdsMessage.codec = () => {
|
3841
|
-
if (_codec == null) {
|
3842
|
-
_codec = message$1((obj, w, opts = {}) => {
|
3843
|
-
if (opts.lengthDelimited !== false) {
|
3844
|
-
w.fork();
|
3845
|
-
}
|
3846
|
-
if ((obj.messageId != null && obj.messageId !== '')) {
|
3847
|
-
w.uint32(18);
|
3848
|
-
w.string(obj.messageId);
|
3849
|
-
}
|
3850
|
-
if ((obj.channelId != null && obj.channelId !== '')) {
|
3851
|
-
w.uint32(26);
|
3852
|
-
w.string(obj.channelId);
|
3853
|
-
}
|
3854
|
-
if (obj.lamportTimestamp != null) {
|
3855
|
-
w.uint32(80);
|
3856
|
-
w.int32(obj.lamportTimestamp);
|
3857
|
-
}
|
3858
|
-
if (obj.causalHistory != null) {
|
3859
|
-
for (const value of obj.causalHistory) {
|
3860
|
-
w.uint32(90);
|
3861
|
-
w.string(value);
|
3862
|
-
}
|
3863
|
-
}
|
3864
|
-
if (obj.bloomFilter != null) {
|
3865
|
-
w.uint32(98);
|
3866
|
-
w.bytes(obj.bloomFilter);
|
3867
|
-
}
|
3868
|
-
if (obj.content != null) {
|
3869
|
-
w.uint32(162);
|
3870
|
-
w.bytes(obj.content);
|
3871
|
-
}
|
3872
|
-
if (opts.lengthDelimited !== false) {
|
3873
|
-
w.ldelim();
|
3874
|
-
}
|
3875
|
-
}, (reader, length, opts = {}) => {
|
3876
|
-
const obj = {
|
3877
|
-
messageId: '',
|
3878
|
-
channelId: '',
|
3879
|
-
causalHistory: []
|
3880
|
-
};
|
3881
|
-
const end = length == null ? reader.len : reader.pos + length;
|
3882
|
-
while (reader.pos < end) {
|
3883
|
-
const tag = reader.uint32();
|
3884
|
-
switch (tag >>> 3) {
|
3885
|
-
case 2: {
|
3886
|
-
obj.messageId = reader.string();
|
3887
|
-
break;
|
3888
|
-
}
|
3889
|
-
case 3: {
|
3890
|
-
obj.channelId = reader.string();
|
3891
|
-
break;
|
3892
|
-
}
|
3893
|
-
case 10: {
|
3894
|
-
obj.lamportTimestamp = reader.int32();
|
3895
|
-
break;
|
3896
|
-
}
|
3897
|
-
case 11: {
|
3898
|
-
if (opts.limits?.causalHistory != null && obj.causalHistory.length === opts.limits.causalHistory) {
|
3899
|
-
throw new MaxLengthError('Decode error - map field "causalHistory" had too many elements');
|
3900
|
-
}
|
3901
|
-
obj.causalHistory.push(reader.string());
|
3902
|
-
break;
|
3903
|
-
}
|
3904
|
-
case 12: {
|
3905
|
-
obj.bloomFilter = reader.bytes();
|
3906
|
-
break;
|
3907
|
-
}
|
3908
|
-
case 20: {
|
3909
|
-
obj.content = reader.bytes();
|
3910
|
-
break;
|
3911
|
-
}
|
3912
|
-
default: {
|
3913
|
-
reader.skipType(tag & 7);
|
3914
|
-
break;
|
3915
|
-
}
|
3916
|
-
}
|
3917
|
-
}
|
3918
|
-
return obj;
|
3919
|
-
});
|
3920
|
-
}
|
3921
|
-
return _codec;
|
3922
|
-
};
|
3923
|
-
SdsMessage.encode = (obj) => {
|
3924
|
-
return encodeMessage(obj, SdsMessage.codec());
|
3925
|
-
};
|
3926
|
-
SdsMessage.decode = (buf, opts) => {
|
3927
|
-
return decodeMessage(buf, SdsMessage.codec(), opts);
|
3928
|
-
};
|
3929
|
-
})(SdsMessage || (SdsMessage = {}));
|
3930
|
-
|
3931
|
-
/**
|
3932
|
-
* Internal assertion helpers.
|
3933
|
-
* @module
|
3934
|
-
*/
|
3935
|
-
/** Asserts something is positive integer. */
|
3936
|
-
/** Is number an Uint8Array? Copied from utils for perf. */
|
3832
|
+
// copied from utils
|
3937
3833
|
function isBytes(a) {
|
3938
|
-
return a instanceof Uint8Array ||
|
3834
|
+
return (a instanceof Uint8Array ||
|
3835
|
+
(a != null && typeof a === 'object' && a.constructor.name === 'Uint8Array'));
|
3939
3836
|
}
|
3940
|
-
|
3941
|
-
function abytes(b, ...lengths) {
|
3837
|
+
function bytes(b, ...lengths) {
|
3942
3838
|
if (!isBytes(b))
|
3943
3839
|
throw new Error('Uint8Array expected');
|
3944
3840
|
if (lengths.length > 0 && !lengths.includes(b.length))
|
3945
|
-
throw new Error(
|
3841
|
+
throw new Error(`Uint8Array expected of length ${lengths}, not of length=${b.length}`);
|
3946
3842
|
}
|
3947
|
-
|
3948
|
-
function aexists(instance, checkFinished = true) {
|
3843
|
+
function exists(instance, checkFinished = true) {
|
3949
3844
|
if (instance.destroyed)
|
3950
3845
|
throw new Error('Hash instance has been destroyed');
|
3951
3846
|
if (checkFinished && instance.finished)
|
3952
3847
|
throw new Error('Hash#digest() has already been called');
|
3953
3848
|
}
|
3954
|
-
|
3955
|
-
|
3956
|
-
abytes(out);
|
3849
|
+
function output(out, instance) {
|
3850
|
+
bytes(out);
|
3957
3851
|
const min = instance.outputLen;
|
3958
3852
|
if (out.length < min) {
|
3959
|
-
throw new Error(
|
3853
|
+
throw new Error(`digestInto() expects output buffer of length at least ${min}`);
|
3960
3854
|
}
|
3961
3855
|
}
|
3962
3856
|
|
3963
|
-
/**
|
3964
|
-
* Utilities for hex, bytes, CSPRNG.
|
3965
|
-
* @module
|
3966
|
-
*/
|
3967
3857
|
/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
3968
3858
|
// We use WebCrypto aka globalThis.crypto, which exists in browsers and node.js 16+.
|
3969
3859
|
// node.js versions earlier than v19 don't declare it in global scope.
|
@@ -3972,20 +3862,16 @@ function aoutput(out, instance) {
|
|
3972
3862
|
// Makes the utils un-importable in browsers without a bundler.
|
3973
3863
|
// Once node.js 18 is deprecated (2025-04-30), we can just drop the import.
|
3974
3864
|
// Cast array to view
|
3975
|
-
|
3976
|
-
|
3977
|
-
|
3978
|
-
|
3979
|
-
function rotr(word, shift) {
|
3980
|
-
return (word << (32 - shift)) | (word >>> shift);
|
3981
|
-
}
|
3865
|
+
const createView = (arr) => new DataView(arr.buffer, arr.byteOffset, arr.byteLength);
|
3866
|
+
// The rotate right (circular right shift) operation for uint32
|
3867
|
+
const rotr = (word, shift) => (word << (32 - shift)) | (word >>> shift);
|
3868
|
+
new Uint8Array(new Uint32Array([0x11223344]).buffer)[0] === 0x44;
|
3982
3869
|
/**
|
3983
|
-
* Convert JS string to byte array.
|
3984
3870
|
* @example utf8ToBytes('abc') // new Uint8Array([97, 98, 99])
|
3985
3871
|
*/
|
3986
3872
|
function utf8ToBytes$1(str) {
|
3987
3873
|
if (typeof str !== 'string')
|
3988
|
-
throw new Error(
|
3874
|
+
throw new Error(`utf8ToBytes expected string, got ${typeof str}`);
|
3989
3875
|
return new Uint8Array(new TextEncoder().encode(str)); // https://bugzil.la/1681809
|
3990
3876
|
}
|
3991
3877
|
/**
|
@@ -3996,17 +3882,16 @@ function utf8ToBytes$1(str) {
|
|
3996
3882
|
function toBytes(data) {
|
3997
3883
|
if (typeof data === 'string')
|
3998
3884
|
data = utf8ToBytes$1(data);
|
3999
|
-
|
3885
|
+
bytes(data);
|
4000
3886
|
return data;
|
4001
3887
|
}
|
4002
|
-
|
3888
|
+
// For runtime check if class implements interface
|
4003
3889
|
class Hash {
|
4004
3890
|
// Safe version that clones internal state
|
4005
3891
|
clone() {
|
4006
3892
|
return this._cloneInto();
|
4007
3893
|
}
|
4008
3894
|
}
|
4009
|
-
/** Wraps hash function, creating an interface on top of it */
|
4010
3895
|
function wrapConstructor(hashCons) {
|
4011
3896
|
const hashC = (msg) => hashCons().update(toBytes(msg)).digest();
|
4012
3897
|
const tmp = hashCons();
|
@@ -4017,10 +3902,8 @@ function wrapConstructor(hashCons) {
|
|
4017
3902
|
}
|
4018
3903
|
|
4019
3904
|
/**
|
4020
|
-
*
|
4021
|
-
* @module
|
3905
|
+
* Polyfill for Safari 14
|
4022
3906
|
*/
|
4023
|
-
/** Polyfill for Safari 14. https://caniuse.com/mdn-javascript_builtins_dataview_setbiguint64 */
|
4024
3907
|
function setBigUint64(view, byteOffset, value, isLE) {
|
4025
3908
|
if (typeof view.setBigUint64 === 'function')
|
4026
3909
|
return view.setBigUint64(byteOffset, value, isLE);
|
@@ -4033,14 +3916,14 @@ function setBigUint64(view, byteOffset, value, isLE) {
|
|
4033
3916
|
view.setUint32(byteOffset + h, wh, isLE);
|
4034
3917
|
view.setUint32(byteOffset + l, wl, isLE);
|
4035
3918
|
}
|
4036
|
-
/**
|
4037
|
-
|
4038
|
-
|
4039
|
-
|
4040
|
-
/**
|
4041
|
-
|
4042
|
-
|
4043
|
-
|
3919
|
+
/**
|
3920
|
+
* Choice: a ? b : c
|
3921
|
+
*/
|
3922
|
+
const Chi = (a, b, c) => (a & b) ^ (~a & c);
|
3923
|
+
/**
|
3924
|
+
* Majority function, true if any two inputs is true
|
3925
|
+
*/
|
3926
|
+
const Maj = (a, b, c) => (a & b) ^ (a & c) ^ (b & c);
|
4044
3927
|
/**
|
4045
3928
|
* Merkle-Damgard hash construction base class.
|
4046
3929
|
* Could be used to create MD5, RIPEMD, SHA1, SHA2.
|
@@ -4060,7 +3943,7 @@ class HashMD extends Hash {
|
|
4060
3943
|
this.view = createView(this.buffer);
|
4061
3944
|
}
|
4062
3945
|
update(data) {
|
4063
|
-
|
3946
|
+
exists(this);
|
4064
3947
|
const { view, buffer, blockLen } = this;
|
4065
3948
|
data = toBytes(data);
|
4066
3949
|
const len = data.length;
|
@@ -4086,8 +3969,8 @@ class HashMD extends Hash {
|
|
4086
3969
|
return this;
|
4087
3970
|
}
|
4088
3971
|
digestInto(out) {
|
4089
|
-
|
4090
|
-
|
3972
|
+
exists(this);
|
3973
|
+
output(out, this);
|
4091
3974
|
this.finished = true;
|
4092
3975
|
// Padding
|
4093
3976
|
// We can avoid allocation of buffer for padding completely if it
|
@@ -4144,16 +4027,10 @@ class HashMD extends Hash {
|
|
4144
4027
|
}
|
4145
4028
|
}
|
4146
4029
|
|
4147
|
-
|
4148
|
-
|
4149
|
-
|
4150
|
-
|
4151
|
-
* BTC network is doing 2^70 hashes/sec (2^95 hashes/year) as per 2025.
|
4152
|
-
*
|
4153
|
-
* Check out [FIPS 180-4](https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.180-4.pdf).
|
4154
|
-
* @module
|
4155
|
-
*/
|
4156
|
-
/** Round constants: first 32 bits of fractional parts of the cube roots of the first 64 primes 2..311). */
|
4030
|
+
// SHA2-256 need to try 2^128 hashes to execute birthday attack.
|
4031
|
+
// BTC network is doing 2^67 hashes/sec as per early 2023.
|
4032
|
+
// Round constants:
|
4033
|
+
// first 32 bits of the fractional parts of the cube roots of the first 64 primes 2..311)
|
4157
4034
|
// prettier-ignore
|
4158
4035
|
const SHA256_K = /* @__PURE__ */ new Uint32Array([
|
4159
4036
|
0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
|
@@ -4165,15 +4042,14 @@ const SHA256_K = /* @__PURE__ */ new Uint32Array([
|
|
4165
4042
|
0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,
|
4166
4043
|
0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2
|
4167
4044
|
]);
|
4168
|
-
|
4045
|
+
// Initial state:
|
4046
|
+
// first 32 bits of the fractional parts of the square roots of the first 8 primes 2..19
|
4169
4047
|
// prettier-ignore
|
4170
4048
|
const SHA256_IV = /* @__PURE__ */ new Uint32Array([
|
4171
4049
|
0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19
|
4172
4050
|
]);
|
4173
|
-
|
4174
|
-
|
4175
|
-
* Named this way because it matches specification.
|
4176
|
-
*/
|
4051
|
+
// Temporary buffer, not used to store anything between runs
|
4052
|
+
// Named this way because it matches specification.
|
4177
4053
|
const SHA256_W = /* @__PURE__ */ new Uint32Array(64);
|
4178
4054
|
class SHA256 extends HashMD {
|
4179
4055
|
constructor() {
|
@@ -4250,7 +4126,10 @@ class SHA256 extends HashMD {
|
|
4250
4126
|
this.buffer.fill(0);
|
4251
4127
|
}
|
4252
4128
|
}
|
4253
|
-
/**
|
4129
|
+
/**
|
4130
|
+
* SHA2-256 hash function
|
4131
|
+
* @param message - data that would be hashed
|
4132
|
+
*/
|
4254
4133
|
const sha256 = /* @__PURE__ */ wrapConstructor(() => new SHA256());
|
4255
4134
|
|
4256
4135
|
/**
|
@@ -4589,4 +4468,4 @@ var version_0 = /*#__PURE__*/Object.freeze({
|
|
4589
4468
|
proto: message
|
4590
4469
|
});
|
4591
4470
|
|
4592
|
-
export { DecodedMessage as D, Encoder as E, FilterSubscribeRequest as F, MessagePush as M, PushRpc$1 as P, StoreQueryRequest$1 as S, Version as V, WakuMetadataRequest as W, allocUnsafe as a, alloc$1 as b, encode as c, decode as d, encodingLength as e, FilterSubscribeResponse$1 as f, PushResponse as g, StoreQueryResponse$1 as h,
|
4471
|
+
export { DecodedMessage as D, Encoder as E, FilterSubscribeRequest as F, MessagePush as M, PushRpc$1 as P, StoreQueryRequest$1 as S, Version as V, WakuMetadataRequest as W, allocUnsafe as a, alloc$1 as b, encode as c, decode as d, encodingLength as e, FilterSubscribeResponse$1 as f, PushResponse as g, StoreQueryResponse$1 as h, createEncoder as i, bytesToUtf8 as j, pubsubTopicsToShardInfo as k, WakuMetadataResponse as l, createDecoder as m, message as n, Decoder as o, pubsubTopicToSingleShardInfo as p, shardInfoToPubsubTopics as s, utf8ToBytes as u, version_0 as v };
|