@waku/core 0.0.36-383e0b2.0 → 0.0.36-4997440.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/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { v as version_0, a as allocUnsafe, b as alloc, e as encodingLength$1, c as encode$2, d as decode$4, F as FilterSubscribeRequest, f as FilterSubscribeResponse$1, M as MessagePush, P as PushRpc$1, g as PushResponse, S as StoreQueryRequest$1, h as StoreQueryResponse$1, t as toString$1, i as bases, j as fromString, u as utf8ToBytes, k as createEncoder, p as pubsubTopicToSingleShardInfo, l as bytesToUtf8, s as shardInfoToPubsubTopics, W as WakuMetadataRequest, m as pubsubTopicsToShardInfo, n as WakuMetadataResponse } from './version_0-4TwtF5aQ.js';
2
- export { o as createDecoder } from './version_0-4TwtF5aQ.js';
1
+ import { v as version_0, a as allocUnsafe, b as alloc, e as encodingLength$1, c as encode$2, d as decode$4, F as FilterSubscribeRequest, f as FilterSubscribeResponse$1, M as MessagePush, P as PushRpc$1, g as PushResponse, S as StoreQueryRequest$1, h as StoreQueryResponse$1, t as toString$1, i as bases, j as fromString, u as utf8ToBytes, k as createEncoder, p as pubsubTopicToSingleShardInfo, l as bytesToUtf8, s as shardInfoToPubsubTopics, W as WakuMetadataRequest, m as pubsubTopicsToShardInfo, n as WakuMetadataResponse, o as concat$1, q as sha256, r as bytesToHex, w as numberToBytes } from './version_0-CyeTW0Vr.js';
2
+ export { x as createDecoder } from './version_0-CyeTW0Vr.js';
3
3
  import { e as equals$2, c as coerce, b as base32, a as base58btc, d as base36, L as Logger, P as ProtocolError, T as Tags, E as EPeersByDiscoveryEvents, f as EConnectionStateEvents } from './index-CTo1my9M.js';
4
4
  import { B as BaseProtocol } from './base_protocol-DvQrudwy.js';
5
5
  export { S as StreamManager } from './base_protocol-DvQrudwy.js';
@@ -514,6 +514,10 @@ function encodeCID(version, code, multihash) {
514
514
  }
515
515
  const cidSymbol = Symbol.for('@ipld/js-cid/CID');
516
516
 
517
+ function isDefined(value) {
518
+ return Boolean(value);
519
+ }
520
+
517
521
  const MB = 1024 ** 2;
518
522
  const SIZE_CAP_IN_MB = 1;
519
523
  /**
@@ -2300,12 +2304,30 @@ const FilterCodecs = {
2300
2304
  PUSH: "/vac/waku/filter-push/2.0.0-beta1"
2301
2305
  };
2302
2306
  class FilterCore extends BaseProtocol {
2303
- handleIncomingMessage;
2304
2307
  pubsubTopics;
2308
+ static handleIncomingMessage;
2305
2309
  constructor(handleIncomingMessage, pubsubTopics, libp2p) {
2306
2310
  super(FilterCodecs.SUBSCRIBE, libp2p.components, pubsubTopics);
2307
- this.handleIncomingMessage = handleIncomingMessage;
2308
2311
  this.pubsubTopics = pubsubTopics;
2312
+ // TODO(weboko): remove when @waku/sdk 0.0.33 is released
2313
+ const prevHandler = FilterCore.handleIncomingMessage;
2314
+ FilterCore.handleIncomingMessage = !prevHandler
2315
+ ? handleIncomingMessage
2316
+ : async (pubsubTopic, message, peerIdStr) => {
2317
+ try {
2318
+ await prevHandler(pubsubTopic, message, peerIdStr);
2319
+ }
2320
+ catch (e) {
2321
+ log$5.error("Previous FilterCore incoming message handler failed ", e);
2322
+ }
2323
+ try {
2324
+ await handleIncomingMessage(pubsubTopic, message, peerIdStr);
2325
+ }
2326
+ catch (e) {
2327
+ log$5.error("Present FilterCore incoming message handler failed ", e);
2328
+ }
2329
+ return;
2330
+ };
2309
2331
  libp2p
2310
2332
  .handle(FilterCodecs.PUSH, this.onRequest.bind(this), {
2311
2333
  maxInboundStreams: 100
@@ -2482,7 +2504,7 @@ class FilterCore extends BaseProtocol {
2482
2504
  log$5.error("Pubsub topic missing from push message");
2483
2505
  return;
2484
2506
  }
2485
- await this.handleIncomingMessage(pubsubTopic, wakuMessage, connection.remotePeer.toString());
2507
+ await FilterCore.handleIncomingMessage?.(pubsubTopic, wakuMessage, connection.remotePeer.toString());
2486
2508
  }
2487
2509
  }).then(() => {
2488
2510
  log$5.info("Receiving pipe closed.");
@@ -2727,19 +2749,15 @@ class StoreQueryRequest {
2727
2749
  ? BigInt(params.paginationLimit)
2728
2750
  : undefined
2729
2751
  });
2730
- // Validate request parameters based on RFC
2731
2752
  const isHashQuery = params.messageHashes && params.messageHashes.length > 0;
2732
2753
  const hasContentTopics = params.contentTopics && params.contentTopics.length > 0;
2733
2754
  const hasTimeFilter = params.timeStart || params.timeEnd;
2734
2755
  if (isHashQuery) {
2735
- // Message hash lookup queries cannot include content topics or time filters
2736
- // but pubsubTopic is allowed/required
2737
2756
  if (hasContentTopics || hasTimeFilter) {
2738
2757
  throw new Error("Message hash lookup queries cannot include content filter criteria (contentTopics, timeStart, or timeEnd)");
2739
2758
  }
2740
2759
  }
2741
2760
  else {
2742
- // Content-filtered queries require both pubsubTopic and contentTopics to be set together
2743
2761
  if ((params.pubsubTopic &&
2744
2762
  (!params.contentTopics || params.contentTopics.length === 0)) ||
2745
2763
  (!params.pubsubTopic &&
@@ -4874,4 +4892,85 @@ function wakuMetadata(pubsubTopics) {
4874
4892
  return (components) => new Metadata(pubsubTopics, components);
4875
4893
  }
4876
4894
 
4877
- export { ConnectionManager, FilterCodecs, FilterCore, LightPushCodec, LightPushCore, MetadataCodec, StoreCodec, StoreCore, createEncoder, index$3 as message, wakuMetadata, index$2 as waku_filter, index$1 as waku_light_push, index as waku_store };
4895
+ /**
4896
+ * Deterministic Message Hashing as defined in
4897
+ * [14/WAKU2-MESSAGE](https://rfc.vac.dev/spec/14/#deterministic-message-hashing)
4898
+ *
4899
+ * Computes a SHA-256 hash of the concatenation of pubsub topic, payload, content topic, meta, and timestamp.
4900
+ *
4901
+ * @param pubsubTopic - The pubsub topic string
4902
+ * @param message - The message to be hashed
4903
+ * @returns A Uint8Array containing the SHA-256 hash
4904
+ *
4905
+ * @example
4906
+ * ```typescript
4907
+ * import { messageHash } from "@waku/core";
4908
+ *
4909
+ * const pubsubTopic = "/waku/2/default-waku/proto";
4910
+ * const message = {
4911
+ * payload: new Uint8Array([1, 2, 3, 4]),
4912
+ * contentTopic: "/waku/2/default-content/proto",
4913
+ * meta: new Uint8Array([5, 6, 7, 8]),
4914
+ * timestamp: new Date()
4915
+ * };
4916
+ *
4917
+ * const hash = messageHash(pubsubTopic, message);
4918
+ * ```
4919
+ */
4920
+ function messageHash(pubsubTopic, message) {
4921
+ const pubsubTopicBytes = utf8ToBytes(pubsubTopic);
4922
+ const contentTopicBytes = utf8ToBytes(message.contentTopic);
4923
+ const timestampBytes = tryConvertTimestampToBytes(message.timestamp);
4924
+ const bytes = concat$1([
4925
+ pubsubTopicBytes,
4926
+ message.payload,
4927
+ contentTopicBytes,
4928
+ message.meta,
4929
+ timestampBytes
4930
+ ].filter(isDefined));
4931
+ return sha256(bytes);
4932
+ }
4933
+ function tryConvertTimestampToBytes(timestamp) {
4934
+ if (!timestamp) {
4935
+ return;
4936
+ }
4937
+ let bigIntTimestamp;
4938
+ if (typeof timestamp === "bigint") {
4939
+ bigIntTimestamp = timestamp;
4940
+ }
4941
+ else {
4942
+ bigIntTimestamp = BigInt(timestamp.valueOf()) * 1000000n;
4943
+ }
4944
+ return numberToBytes(bigIntTimestamp);
4945
+ }
4946
+ /**
4947
+ * Computes a deterministic message hash and returns it as a hexadecimal string.
4948
+ * This is a convenience wrapper around messageHash that converts the result to a hex string.
4949
+ *
4950
+ * @param pubsubTopic - The pubsub topic string
4951
+ * @param message - The message to be hashed
4952
+ * @returns A string containing the hex representation of the SHA-256 hash
4953
+ *
4954
+ * @example
4955
+ * ```typescript
4956
+ * import { messageHashStr } from "@waku/core";
4957
+ *
4958
+ * const pubsubTopic = "/waku/2/default-waku/proto";
4959
+ * const message = {
4960
+ * payload: new Uint8Array([1, 2, 3, 4]),
4961
+ * contentTopic: "/waku/2/default-content/proto",
4962
+ * meta: new Uint8Array([5, 6, 7, 8]),
4963
+ * timestamp: new Date()
4964
+ * };
4965
+ *
4966
+ * const hashString = messageHashStr(pubsubTopic, message);
4967
+ * console.log(hashString); // e.g. "a1b2c3d4..."
4968
+ * ```
4969
+ */
4970
+ function messageHashStr(pubsubTopic, message) {
4971
+ const hash = messageHash(pubsubTopic, message);
4972
+ const hashStr = bytesToHex(hash);
4973
+ return hashStr;
4974
+ }
4975
+
4976
+ export { ConnectionManager, FilterCodecs, FilterCore, LightPushCodec, LightPushCore, MetadataCodec, StoreCodec, StoreCore, createEncoder, index$3 as message, messageHash, messageHashStr, wakuMetadata, index$2 as waku_filter, index$1 as waku_light_push, index as waku_store };
@@ -1,2 +1,2 @@
1
- export { D as DecodedMessage, r as Decoder, E as Encoder, V as Version, o as createDecoder, k as createEncoder, q as proto } from '../../version_0-4TwtF5aQ.js';
1
+ export { D as DecodedMessage, z as Decoder, E as Encoder, V as Version, x as createDecoder, k as createEncoder, y as proto } from '../../version_0-CyeTW0Vr.js';
2
2
  import '../../index-CTo1my9M.js';
@@ -3985,11 +3985,17 @@ var SdsMessage;
3985
3985
  })(SdsMessage || (SdsMessage = {}));
3986
3986
 
3987
3987
  /**
3988
- * Internal assertion helpers.
3988
+ * Utilities for hex, bytes, CSPRNG.
3989
3989
  * @module
3990
3990
  */
3991
- /** Asserts something is positive integer. */
3992
- /** Is number an Uint8Array? Copied from utils for perf. */
3991
+ /*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
3992
+ // We use WebCrypto aka globalThis.crypto, which exists in browsers and node.js 16+.
3993
+ // node.js versions earlier than v19 don't declare it in global scope.
3994
+ // For node.js, package.json#exports field mapping rewrites import
3995
+ // from `crypto` to `cryptoNode`, which imports native module.
3996
+ // Makes the utils un-importable in browsers without a bundler.
3997
+ // Once node.js 18 is deprecated (2025-04-30), we can just drop the import.
3998
+ /** Checks if something is Uint8Array. Be careful: nodejs Buffer will return true. */
3993
3999
  function isBytes(a) {
3994
4000
  return a instanceof Uint8Array || (ArrayBuffer.isView(a) && a.constructor.name === 'Uint8Array');
3995
4001
  }
@@ -4015,19 +4021,13 @@ function aoutput(out, instance) {
4015
4021
  throw new Error('digestInto() expects output buffer of length at least ' + min);
4016
4022
  }
4017
4023
  }
4018
-
4019
- /**
4020
- * Utilities for hex, bytes, CSPRNG.
4021
- * @module
4022
- */
4023
- /*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
4024
- // We use WebCrypto aka globalThis.crypto, which exists in browsers and node.js 16+.
4025
- // node.js versions earlier than v19 don't declare it in global scope.
4026
- // For node.js, package.json#exports field mapping rewrites import
4027
- // from `crypto` to `cryptoNode`, which imports native module.
4028
- // Makes the utils un-importable in browsers without a bundler.
4029
- // Once node.js 18 is deprecated (2025-04-30), we can just drop the import.
4030
- // Cast array to view
4024
+ /** Zeroize a byte array. Warning: JS provides no guarantees. */
4025
+ function clean(...arrays) {
4026
+ for (let i = 0; i < arrays.length; i++) {
4027
+ arrays[i].fill(0);
4028
+ }
4029
+ }
4030
+ /** Create DataView of an array for easy byte-level manipulation. */
4031
4031
  function createView(arr) {
4032
4032
  return new DataView(arr.buffer, arr.byteOffset, arr.byteLength);
4033
4033
  }
@@ -4036,12 +4036,12 @@ function rotr(word, shift) {
4036
4036
  return (word << (32 - shift)) | (word >>> shift);
4037
4037
  }
4038
4038
  /**
4039
- * Convert JS string to byte array.
4040
- * @example utf8ToBytes('abc') // new Uint8Array([97, 98, 99])
4039
+ * Converts string to bytes using UTF8 encoding.
4040
+ * @example utf8ToBytes('abc') // Uint8Array.from([97, 98, 99])
4041
4041
  */
4042
4042
  function utf8ToBytes$1(str) {
4043
4043
  if (typeof str !== 'string')
4044
- throw new Error('utf8ToBytes expected string, got ' + typeof str);
4044
+ throw new Error('string expected');
4045
4045
  return new Uint8Array(new TextEncoder().encode(str)); // https://bugzil.la/1681809
4046
4046
  }
4047
4047
  /**
@@ -4057,13 +4057,9 @@ function toBytes(data) {
4057
4057
  }
4058
4058
  /** For runtime check if class implements interface */
4059
4059
  class Hash {
4060
- // Safe version that clones internal state
4061
- clone() {
4062
- return this._cloneInto();
4063
- }
4064
4060
  }
4065
4061
  /** Wraps hash function, creating an interface on top of it */
4066
- function wrapConstructor(hashCons) {
4062
+ function createHasher(hashCons) {
4067
4063
  const hashC = (msg) => hashCons().update(toBytes(msg)).digest();
4068
4064
  const tmp = hashCons();
4069
4065
  hashC.outputLen = tmp.outputLen;
@@ -4104,21 +4100,22 @@ function Maj(a, b, c) {
4104
4100
  class HashMD extends Hash {
4105
4101
  constructor(blockLen, outputLen, padOffset, isLE) {
4106
4102
  super();
4107
- this.blockLen = blockLen;
4108
- this.outputLen = outputLen;
4109
- this.padOffset = padOffset;
4110
- this.isLE = isLE;
4111
4103
  this.finished = false;
4112
4104
  this.length = 0;
4113
4105
  this.pos = 0;
4114
4106
  this.destroyed = false;
4107
+ this.blockLen = blockLen;
4108
+ this.outputLen = outputLen;
4109
+ this.padOffset = padOffset;
4110
+ this.isLE = isLE;
4115
4111
  this.buffer = new Uint8Array(blockLen);
4116
4112
  this.view = createView(this.buffer);
4117
4113
  }
4118
4114
  update(data) {
4119
4115
  aexists(this);
4120
- const { view, buffer, blockLen } = this;
4121
4116
  data = toBytes(data);
4117
+ abytes(data);
4118
+ const { view, buffer, blockLen } = this;
4122
4119
  const len = data.length;
4123
4120
  for (let pos = 0; pos < len;) {
4124
4121
  const take = Math.min(blockLen - this.pos, len - pos);
@@ -4152,7 +4149,7 @@ class HashMD extends Hash {
4152
4149
  let { pos } = this;
4153
4150
  // append the bit '1' to the message
4154
4151
  buffer[pos++] = 0b10000000;
4155
- this.buffer.subarray(pos).fill(0);
4152
+ clean(this.buffer.subarray(pos));
4156
4153
  // we have less than padOffset left in buffer, so we cannot put length in
4157
4154
  // current block, need process it and pad again
4158
4155
  if (this.padOffset > blockLen - pos) {
@@ -4190,28 +4187,40 @@ class HashMD extends Hash {
4190
4187
  to || (to = new this.constructor());
4191
4188
  to.set(...this.get());
4192
4189
  const { blockLen, buffer, length, finished, destroyed, pos } = this;
4190
+ to.destroyed = destroyed;
4191
+ to.finished = finished;
4193
4192
  to.length = length;
4194
4193
  to.pos = pos;
4195
- to.finished = finished;
4196
- to.destroyed = destroyed;
4197
4194
  if (length % blockLen)
4198
4195
  to.buffer.set(buffer);
4199
4196
  return to;
4200
4197
  }
4198
+ clone() {
4199
+ return this._cloneInto();
4200
+ }
4201
4201
  }
4202
+ /**
4203
+ * Initial SHA-2 state: fractional parts of square roots of first 16 primes 2..53.
4204
+ * Check out `test/misc/sha2-gen-iv.js` for recomputation guide.
4205
+ */
4206
+ /** Initial SHA256 state. Bits 0..32 of frac part of sqrt of primes 2..19 */
4207
+ const SHA256_IV = /* @__PURE__ */ Uint32Array.from([
4208
+ 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19,
4209
+ ]);
4202
4210
 
4203
4211
  /**
4204
- * SHA2-256 a.k.a. sha256. In JS, it is the fastest hash, even faster than Blake3.
4205
- *
4206
- * To break sha256 using birthday attack, attackers need to try 2^128 hashes.
4207
- * BTC network is doing 2^70 hashes/sec (2^95 hashes/year) as per 2025.
4208
- *
4209
- * Check out [FIPS 180-4](https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.180-4.pdf).
4212
+ * SHA2 hash function. A.k.a. sha256, sha384, sha512, sha512_224, sha512_256.
4213
+ * SHA256 is the fastest hash implementable in JS, even faster than Blake3.
4214
+ * Check out [RFC 4634](https://datatracker.ietf.org/doc/html/rfc4634) and
4215
+ * [FIPS 180-4](https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.180-4.pdf).
4210
4216
  * @module
4211
4217
  */
4212
- /** Round constants: first 32 bits of fractional parts of the cube roots of the first 64 primes 2..311). */
4218
+ /**
4219
+ * Round constants:
4220
+ * First 32 bits of fractional parts of the cube roots of the first 64 primes 2..311)
4221
+ */
4213
4222
  // prettier-ignore
4214
- const SHA256_K = /* @__PURE__ */ new Uint32Array([
4223
+ const SHA256_K = /* @__PURE__ */ Uint32Array.from([
4215
4224
  0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
4216
4225
  0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
4217
4226
  0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
@@ -4221,19 +4230,11 @@ const SHA256_K = /* @__PURE__ */ new Uint32Array([
4221
4230
  0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,
4222
4231
  0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2
4223
4232
  ]);
4224
- /** Initial state: first 32 bits of fractional parts of the square roots of the first 8 primes 2..19. */
4225
- // prettier-ignore
4226
- const SHA256_IV = /* @__PURE__ */ new Uint32Array([
4227
- 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19
4228
- ]);
4229
- /**
4230
- * Temporary buffer, not used to store anything between runs.
4231
- * Named this way because it matches specification.
4232
- */
4233
+ /** Reusable temporary buffer. "W" comes straight from spec. */
4233
4234
  const SHA256_W = /* @__PURE__ */ new Uint32Array(64);
4234
4235
  class SHA256 extends HashMD {
4235
- constructor() {
4236
- super(64, 32, 8, false);
4236
+ constructor(outputLen = 32) {
4237
+ super(64, outputLen, 8, false);
4237
4238
  // We cannot use array here since array allows indexing by variable
4238
4239
  // which means optimizer/compiler cannot use registers.
4239
4240
  this.A = SHA256_IV[0] | 0;
@@ -4299,15 +4300,34 @@ class SHA256 extends HashMD {
4299
4300
  this.set(A, B, C, D, E, F, G, H);
4300
4301
  }
4301
4302
  roundClean() {
4302
- SHA256_W.fill(0);
4303
+ clean(SHA256_W);
4303
4304
  }
4304
4305
  destroy() {
4305
4306
  this.set(0, 0, 0, 0, 0, 0, 0, 0);
4306
- this.buffer.fill(0);
4307
+ clean(this.buffer);
4307
4308
  }
4308
4309
  }
4309
- /** SHA2-256 hash function */
4310
- const sha256 = /* @__PURE__ */ wrapConstructor(() => new SHA256());
4310
+ /**
4311
+ * SHA2-256 hash function from RFC 4634.
4312
+ *
4313
+ * It is the fastest JS hash, even faster than Blake3.
4314
+ * To break sha256 using birthday attack, attackers need to try 2^128 hashes.
4315
+ * BTC network is doing 2^70 hashes/sec (2^95 hashes/year) as per 2025.
4316
+ */
4317
+ const sha256$1 = /* @__PURE__ */ createHasher(() => new SHA256());
4318
+
4319
+ /**
4320
+ * SHA2-256 a.k.a. sha256. In JS, it is the fastest hash, even faster than Blake3.
4321
+ *
4322
+ * To break sha256 using birthday attack, attackers need to try 2^128 hashes.
4323
+ * BTC network is doing 2^70 hashes/sec (2^95 hashes/year) as per 2025.
4324
+ *
4325
+ * Check out [FIPS 180-4](https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.180-4.pdf).
4326
+ * @module
4327
+ * @deprecated
4328
+ */
4329
+ /** @deprecated Use import from `noble/hashes/sha2` module */
4330
+ const sha256 = sha256$1;
4311
4331
 
4312
4332
  /**
4313
4333
  * The default cluster ID for The Waku Network
@@ -4330,6 +4350,21 @@ function toString(array, encoding = 'utf8') {
4330
4350
  return base.encoder.encode(array).substring(1);
4331
4351
  }
4332
4352
 
4353
+ function numberToBytes(value) {
4354
+ const buffer = new ArrayBuffer(8);
4355
+ const view = new DataView(buffer);
4356
+ if (typeof value === "number") {
4357
+ view.setFloat64(0, value, false);
4358
+ }
4359
+ else {
4360
+ view.setBigInt64(0, value, false);
4361
+ }
4362
+ return new Uint8Array(buffer);
4363
+ }
4364
+ /**
4365
+ * Convert byte array to hex string (no `0x` prefix).
4366
+ */
4367
+ const bytesToHex = (bytes) => toString(bytes, "base16");
4333
4368
  /**
4334
4369
  * Decode byte array to utf-8 string.
4335
4370
  */
@@ -4512,9 +4547,6 @@ class DecodedMessage {
4512
4547
  get contentTopic() {
4513
4548
  return this.proto.contentTopic;
4514
4549
  }
4515
- get _rawTimestamp() {
4516
- return this.proto.timestamp;
4517
- }
4518
4550
  get timestamp() {
4519
4551
  // In the case we receive a value that is bigger than JS's max number,
4520
4552
  // we catch the error and return undefined.
@@ -4536,7 +4568,7 @@ class DecodedMessage {
4536
4568
  get version() {
4537
4569
  // https://rfc.vac.dev/spec/14/
4538
4570
  // > If omitted, the value SHOULD be interpreted as version 0.
4539
- return this.proto.version ?? 0;
4571
+ return this.proto.version ?? Version;
4540
4572
  }
4541
4573
  get rateLimitProof() {
4542
4574
  return this.proto.rateLimitProof;
@@ -4645,4 +4677,4 @@ var version_0 = /*#__PURE__*/Object.freeze({
4645
4677
  proto: message
4646
4678
  });
4647
4679
 
4648
- 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, bases as i, fromString as j, createEncoder as k, bytesToUtf8 as l, pubsubTopicsToShardInfo as m, WakuMetadataResponse as n, createDecoder as o, pubsubTopicToSingleShardInfo as p, message as q, Decoder as r, shardInfoToPubsubTopics as s, toString as t, utf8ToBytes as u, version_0 as v };
4680
+ 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, bases as i, fromString as j, createEncoder as k, bytesToUtf8 as l, pubsubTopicsToShardInfo as m, WakuMetadataResponse as n, concat as o, pubsubTopicToSingleShardInfo as p, sha256 as q, bytesToHex as r, shardInfoToPubsubTopics as s, toString as t, utf8ToBytes as u, version_0 as v, numberToBytes as w, createDecoder as x, message as y, Decoder as z };