@dxos/keys 0.8.4-main.e098934 → 0.8.4-main.e8ec1fe

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.
@@ -100,19 +100,21 @@ init_inject_globals();
100
100
 
101
101
  // src/dxn.ts
102
102
  init_inject_globals();
103
- import { Schema as Schema3 } from "effect";
103
+ import * as Schema3 from "effect/Schema";
104
104
  import { devtoolsFormatter, inspectCustom } from "@dxos/debug";
105
105
  import { assertArgument, invariant as invariant2 } from "@dxos/invariant";
106
106
 
107
107
  // src/object-id.ts
108
108
  init_inject_globals();
109
- import { Schema } from "effect";
110
- import { ulid } from "ulidx";
109
+ import * as Schema from "effect/Schema";
110
+ import { monotonicFactory } from "ulidx";
111
111
  var ObjectIdSchema = Schema.String.pipe(Schema.pattern(/^[0-7][0-9A-HJKMNP-TV-Z]{25}$/i)).annotations({
112
112
  description: "A Universally Unique Lexicographically Sortable Identifier",
113
113
  pattern: "^[0-7][0-9A-HJKMNP-TV-Z]{25}$"
114
114
  });
115
115
  var ObjectId = class extends ObjectIdSchema {
116
+ static #factory = monotonicFactory();
117
+ static #seedTime = void 0;
116
118
  static isValid(id) {
117
119
  try {
118
120
  Schema.decodeSync(ObjectId)(id);
@@ -122,7 +124,46 @@ var ObjectId = class extends ObjectIdSchema {
122
124
  }
123
125
  }
124
126
  static random() {
125
- return ulid();
127
+ return this.#factory(this.#seedTime);
128
+ }
129
+ static dangerouslyDisableRandomness() {
130
+ this.#factory = monotonicFactory(makeTestPRNG());
131
+ this.#seedTime = (/* @__PURE__ */ new Date("2025-01-01")).getTime();
132
+ }
133
+ };
134
+ var makeTestPRNG = () => {
135
+ const rng = new SimplePRNG();
136
+ return () => {
137
+ return rng.next();
138
+ };
139
+ };
140
+ var SimplePRNG = class _SimplePRNG {
141
+ #seed;
142
+ // LCG parameters (from Numerical Recipes)
143
+ static #a = 1664525;
144
+ static #c = 1013904223;
145
+ static #m = Math.pow(2, 32);
146
+ /**
147
+ * Creates a new PRNG instance.
148
+ * @param seed - Initial seed value. If not provided, uses 0.
149
+ */
150
+ constructor(seed = 0) {
151
+ this.#seed = seed;
152
+ }
153
+ /**
154
+ * Generates the next pseudo-random number in the range [0, 1).
155
+ * @returns A pseudo-random number between 0 (inclusive) and 1 (exclusive).
156
+ */
157
+ next() {
158
+ this.#seed = (_SimplePRNG.#a * this.#seed + _SimplePRNG.#c) % _SimplePRNG.#m;
159
+ return this.#seed / _SimplePRNG.#m;
160
+ }
161
+ /**
162
+ * Resets the generator with a new seed.
163
+ * @param seed - New seed value.
164
+ */
165
+ reset(seed) {
166
+ this.#seed = seed;
126
167
  }
127
168
  };
128
169
 
@@ -194,7 +235,7 @@ function base32Encode(data, variant, options) {
194
235
  }
195
236
 
196
237
  // src/space-id.ts
197
- import { Schema as Schema2 } from "effect";
238
+ import * as Schema2 from "effect/Schema";
198
239
  import { invariant } from "@dxos/invariant";
199
240
 
200
241
  // src/random-bytes.ts
@@ -207,117 +248,54 @@ var randomBytes = (length) => {
207
248
  };
208
249
 
209
250
  // src/space-id.ts
210
- function _define_property(obj, key, value) {
211
- if (key in obj) {
212
- Object.defineProperty(obj, key, {
213
- value,
214
- enumerable: true,
215
- configurable: true,
216
- writable: true
217
- });
218
- } else {
219
- obj[key] = value;
220
- }
221
- return obj;
222
- }
223
- var _Schema_String_pipe;
224
- var _class;
225
251
  var __dxlog_file = "/__w/dxos/dxos/packages/common/keys/src/space-id.ts";
226
252
  var MULTIBASE_PREFIX = "B";
227
253
  var ENCODED_LENGTH = 33;
228
254
  var isValid = (value) => {
229
255
  return typeof value === "string" && value.startsWith(MULTIBASE_PREFIX) && value.length === ENCODED_LENGTH;
230
256
  };
231
- var SpaceId = (_class = class extends (_Schema_String_pipe = Schema2.String.pipe(Schema2.filter(isValid))) {
232
- }, _define_property(_class, "byteLength", 20), _define_property(_class, "encode", (value) => {
233
- invariant(value instanceof Uint8Array, "Invalid type", {
234
- F: __dxlog_file,
235
- L: 43,
236
- S: _class,
237
- A: [
238
- "value instanceof Uint8Array",
239
- "'Invalid type'"
240
- ]
241
- });
242
- invariant(value.length === SpaceId.byteLength, "Invalid length", {
243
- F: __dxlog_file,
244
- L: 44,
245
- S: _class,
246
- A: [
247
- "value.length === SpaceId.byteLength",
248
- "'Invalid length'"
249
- ]
250
- });
251
- return MULTIBASE_PREFIX + base32Encode(value, "RFC4648");
252
- }), _define_property(_class, "decode", (value) => {
253
- invariant(value.startsWith(MULTIBASE_PREFIX), "Invalid multibase32 encoding", {
254
- F: __dxlog_file,
255
- L: 49,
256
- S: _class,
257
- A: [
258
- "value.startsWith(MULTIBASE_PREFIX)",
259
- "'Invalid multibase32 encoding'"
260
- ]
261
- });
262
- return new Uint8Array((0, import_base32_decode.default)(value.slice(1), "RFC4648"));
263
- }), _define_property(_class, "isValid", isValid), _define_property(_class, "random", () => {
264
- return SpaceId.encode(randomBytes(SpaceId.byteLength));
265
- }), _class);
257
+ var SpaceId = class extends Schema2.String.pipe(Schema2.filter(isValid)) {
258
+ static byteLength = 20;
259
+ static encode = (value) => {
260
+ invariant(value instanceof Uint8Array, "Invalid type", {
261
+ F: __dxlog_file,
262
+ L: 43,
263
+ S: this,
264
+ A: [
265
+ "value instanceof Uint8Array",
266
+ "'Invalid type'"
267
+ ]
268
+ });
269
+ invariant(value.length === SpaceId.byteLength, "Invalid length", {
270
+ F: __dxlog_file,
271
+ L: 44,
272
+ S: this,
273
+ A: [
274
+ "value.length === SpaceId.byteLength",
275
+ "'Invalid length'"
276
+ ]
277
+ });
278
+ return MULTIBASE_PREFIX + base32Encode(value, "RFC4648");
279
+ };
280
+ static decode = (value) => {
281
+ invariant(value.startsWith(MULTIBASE_PREFIX), "Invalid multibase32 encoding", {
282
+ F: __dxlog_file,
283
+ L: 49,
284
+ S: this,
285
+ A: [
286
+ "value.startsWith(MULTIBASE_PREFIX)",
287
+ "'Invalid multibase32 encoding'"
288
+ ]
289
+ });
290
+ return new Uint8Array((0, import_base32_decode.default)(value.slice(1), "RFC4648"));
291
+ };
292
+ static isValid = isValid;
293
+ static random = () => {
294
+ return SpaceId.encode(randomBytes(SpaceId.byteLength));
295
+ };
296
+ };
266
297
 
267
298
  // src/dxn.ts
268
- function _check_private_redeclaration(obj, privateCollection) {
269
- if (privateCollection.has(obj)) {
270
- throw new TypeError("Cannot initialize the same private elements twice on an object");
271
- }
272
- }
273
- function _class_apply_descriptor_get(receiver, descriptor) {
274
- if (descriptor.get) {
275
- return descriptor.get.call(receiver);
276
- }
277
- return descriptor.value;
278
- }
279
- function _class_apply_descriptor_set(receiver, descriptor, value) {
280
- if (descriptor.set) {
281
- descriptor.set.call(receiver, value);
282
- } else {
283
- if (!descriptor.writable) {
284
- throw new TypeError("attempted to set read only private field");
285
- }
286
- descriptor.value = value;
287
- }
288
- }
289
- function _class_extract_field_descriptor(receiver, privateMap, action) {
290
- if (!privateMap.has(receiver)) {
291
- throw new TypeError("attempted to " + action + " private field on non-instance");
292
- }
293
- return privateMap.get(receiver);
294
- }
295
- function _class_private_field_get(receiver, privateMap) {
296
- var descriptor = _class_extract_field_descriptor(receiver, privateMap, "get");
297
- return _class_apply_descriptor_get(receiver, descriptor);
298
- }
299
- function _class_private_field_init(obj, privateMap, value) {
300
- _check_private_redeclaration(obj, privateMap);
301
- privateMap.set(obj, value);
302
- }
303
- function _class_private_field_set(receiver, privateMap, value) {
304
- var descriptor = _class_extract_field_descriptor(receiver, privateMap, "set");
305
- _class_apply_descriptor_set(receiver, descriptor, value);
306
- return value;
307
- }
308
- function _define_property2(obj, key, value) {
309
- if (key in obj) {
310
- Object.defineProperty(obj, key, {
311
- value,
312
- enumerable: true,
313
- configurable: true,
314
- writable: true
315
- });
316
- } else {
317
- obj[key] = value;
318
- }
319
- return obj;
320
- }
321
299
  var __dxlog_file2 = "/__w/dxos/dxos/packages/common/keys/src/dxn.ts";
322
300
  var LOCAL_SPACE_TAG = "@";
323
301
  var DXN_ECHO_REGEXP = /@(dxn:[a-zA-Z0-p:@]+)/;
@@ -325,15 +303,49 @@ var QueueSubspaceTags = Object.freeze({
325
303
  DATA: "data",
326
304
  TRACE: "trace"
327
305
  });
328
- var _kind = /* @__PURE__ */ new WeakMap();
329
- var _parts = /* @__PURE__ */ new WeakMap();
330
- var _inspectCustom = inspectCustom;
331
- var _devtoolsFormatter = devtoolsFormatter;
332
306
  var DXN = class _DXN {
307
+ // TODO(burdon): Rename to DXN (i.e., DXN.DXN).
308
+ // TODO(dmaretskyi): Should this be a transformation into the DXN type?
309
+ static Schema = Schema3.NonEmptyString.pipe(
310
+ Schema3.pattern(/^dxn:([^:]+):(?:[^:]+:?)+[^:]$/),
311
+ // TODO(dmaretskyi): To set the format we need to move the annotation IDs out of the echo-schema package.
312
+ // FormatAnnotation.set(FormatEnum.DXN),
313
+ Schema3.annotations({
314
+ title: "DXN",
315
+ description: "DXN URI",
316
+ examples: [
317
+ "dxn:type:example.com/type/MyType",
318
+ "dxn:echo:@:01J00J9B45YHYSGZQTQMSKMGJ6"
319
+ ]
320
+ })
321
+ );
333
322
  static hash(dxn) {
334
323
  return dxn.toString();
335
324
  }
336
325
  /**
326
+ * Kind constants.
327
+ */
328
+ static kind = Object.freeze({
329
+ /**
330
+ * dxn:type:<type_name>[:<version>]
331
+ */
332
+ TYPE: "type",
333
+ /**
334
+ * dxn:echo:<space_id>:<echo_id>
335
+ * dxn:echo:@:<echo_id>
336
+ */
337
+ // TODO(burdon): Rename to OBJECT? (BREAKING CHANGE to update "echo").
338
+ // TODO(burdon): Add separate Kind for space?
339
+ ECHO: "echo",
340
+ /**
341
+ * The subspace tag enables us to partition queues by usage within the context of a space.
342
+ * dxn:queue:<subspace_tag>:<space_id>:<queue_id>[:object_id]
343
+ * dxn:queue:data:BA25QRC2FEWCSAMRP4RZL65LWJ7352CKE:01J00J9B45YHYSGZQTQMSKMGJ6
344
+ * dxn:queue:trace:BA25QRC2FEWCSAMRP4RZL65LWJ7352CKE:01J00J9B45YHYSGZQTQMSKMGJ6
345
+ */
346
+ QUEUE: "queue"
347
+ });
348
+ /**
337
349
  * Exactly equals.
338
350
  */
339
351
  static equals(a, b) {
@@ -372,7 +384,7 @@ var DXN = class _DXN {
372
384
  }
373
385
  }
374
386
  /**
375
- * @example `dxn:type:example.com/type/Contact`
387
+ * @example `dxn:type:example.com/type/Person`
376
388
  */
377
389
  static fromTypename(typename) {
378
390
  return new _DXN(_DXN.kind.TYPE, [
@@ -380,7 +392,7 @@ var DXN = class _DXN {
380
392
  ]);
381
393
  }
382
394
  /**
383
- * @example `dxn:type:example.com/type/Contact:0.1.0`
395
+ * @example `dxn:type:example.com/type/Person:0.1.0`
384
396
  */
385
397
  // TODO(dmaretskyi): Consider using @ as the version separator.
386
398
  static fromTypenameAndVersion(typename, version) {
@@ -423,8 +435,28 @@ var DXN = class _DXN {
423
435
  ] : []
424
436
  ]);
425
437
  }
438
+ #kind;
439
+ #parts;
440
+ constructor(kind, parts) {
441
+ assertArgument(parts.length > 0, "parts", `Invalid DXN: ${parts}`);
442
+ assertArgument(parts.every((part) => typeof part === "string" && part.length > 0 && part.indexOf(":") === -1), "parts", `Invalid DXN: ${parts}`);
443
+ switch (kind) {
444
+ case _DXN.kind.TYPE:
445
+ if (parts.length > 2) {
446
+ throw new Error("Invalid DXN.kind.TYPE");
447
+ }
448
+ break;
449
+ case _DXN.kind.ECHO:
450
+ if (parts.length !== 2) {
451
+ throw new Error("Invalid DXN.kind.ECHO");
452
+ }
453
+ break;
454
+ }
455
+ this.#kind = kind;
456
+ this.#parts = parts;
457
+ }
426
458
  toString() {
427
- return `dxn:${_class_private_field_get(this, _kind)}:${_class_private_field_get(this, _parts).join(":")}`;
459
+ return `dxn:${this.#kind}:${this.#parts.join(":")}`;
428
460
  }
429
461
  toJSON() {
430
462
  return this.toString();
@@ -432,13 +464,13 @@ var DXN = class _DXN {
432
464
  /**
433
465
  * Used by Node.js to get textual representation of this object when it's printed with a `console.log` statement.
434
466
  */
435
- [_inspectCustom](depth, options, inspectFn) {
467
+ [inspectCustom](depth, options, inspectFn) {
436
468
  const printControlCode = (code) => {
437
469
  return `\x1B[${code}m`;
438
470
  };
439
471
  return printControlCode(inspectFn.colors.blueBright[0]) + this.toString() + printControlCode(inspectFn.colors.reset[0]);
440
472
  }
441
- get [_devtoolsFormatter]() {
473
+ get [devtoolsFormatter]() {
442
474
  return {
443
475
  header: () => {
444
476
  return [
@@ -452,14 +484,14 @@ var DXN = class _DXN {
452
484
  };
453
485
  }
454
486
  get kind() {
455
- return _class_private_field_get(this, _kind);
487
+ return this.#kind;
456
488
  }
457
489
  get parts() {
458
- return _class_private_field_get(this, _parts);
490
+ return this.#parts;
459
491
  }
460
492
  // TODO(burdon): Should getters fail?
461
493
  get typename() {
462
- invariant2(_class_private_field_get(this, _kind) === _DXN.kind.TYPE, void 0, {
494
+ invariant2(this.#kind === _DXN.kind.TYPE, void 0, {
463
495
  F: __dxlog_file2,
464
496
  L: 250,
465
497
  S: this,
@@ -468,22 +500,22 @@ var DXN = class _DXN {
468
500
  ""
469
501
  ]
470
502
  });
471
- return _class_private_field_get(this, _parts)[0];
503
+ return this.#parts[0];
472
504
  }
473
505
  equals(other) {
474
506
  return _DXN.equals(this, other);
475
507
  }
476
508
  hasTypenameOf(typename) {
477
- return _class_private_field_get(this, _kind) === _DXN.kind.TYPE && _class_private_field_get(this, _parts).length === 1 && _class_private_field_get(this, _parts)[0] === typename;
509
+ return this.#kind === _DXN.kind.TYPE && this.#parts.length === 1 && this.#parts[0] === typename;
478
510
  }
479
511
  isLocalObjectId() {
480
- return _class_private_field_get(this, _kind) === _DXN.kind.ECHO && _class_private_field_get(this, _parts)[0] === LOCAL_SPACE_TAG && _class_private_field_get(this, _parts).length === 2;
512
+ return this.#kind === _DXN.kind.ECHO && this.#parts[0] === LOCAL_SPACE_TAG && this.#parts.length === 2;
481
513
  }
482
514
  asTypeDXN() {
483
515
  if (this.kind !== _DXN.kind.TYPE) {
484
516
  return void 0;
485
517
  }
486
- const [type, version] = _class_private_field_get(this, _parts);
518
+ const [type, version] = this.#parts;
487
519
  return {
488
520
  // TODO(wittjosiah): Should be `typename` for consistency.
489
521
  type,
@@ -494,7 +526,7 @@ var DXN = class _DXN {
494
526
  if (this.kind !== _DXN.kind.ECHO) {
495
527
  return void 0;
496
528
  }
497
- const [spaceId, echoId] = _class_private_field_get(this, _parts);
529
+ const [spaceId, echoId] = this.#parts;
498
530
  return {
499
531
  spaceId: spaceId === LOCAL_SPACE_TAG ? void 0 : spaceId,
500
532
  // TODO(burdon): objectId.
@@ -505,7 +537,7 @@ var DXN = class _DXN {
505
537
  if (this.kind !== _DXN.kind.QUEUE) {
506
538
  return void 0;
507
539
  }
508
- const [subspaceTag, spaceId, queueId, objectId] = _class_private_field_get(this, _parts);
540
+ const [subspaceTag, spaceId, queueId, objectId] = this.#parts;
509
541
  if (typeof queueId !== "string") {
510
542
  return void 0;
511
543
  }
@@ -520,71 +552,12 @@ var DXN = class _DXN {
520
552
  * Produces a new DXN with the given parts appended.
521
553
  */
522
554
  extend(parts) {
523
- return new _DXN(_class_private_field_get(this, _kind), [
524
- ..._class_private_field_get(this, _parts),
555
+ return new _DXN(this.#kind, [
556
+ ...this.#parts,
525
557
  ...parts
526
558
  ]);
527
559
  }
528
- constructor(kind, parts) {
529
- _class_private_field_init(this, _kind, {
530
- writable: true,
531
- value: void 0
532
- });
533
- _class_private_field_init(this, _parts, {
534
- writable: true,
535
- value: void 0
536
- });
537
- assertArgument(parts.length > 0, "parts", `Invalid DXN: ${parts}`);
538
- assertArgument(parts.every((part) => typeof part === "string" && part.length > 0 && part.indexOf(":") === -1), "parts", `Invalid DXN: ${parts}`);
539
- switch (kind) {
540
- case _DXN.kind.TYPE:
541
- if (parts.length > 2) {
542
- throw new Error("Invalid DXN.kind.TYPE");
543
- }
544
- break;
545
- case _DXN.kind.ECHO:
546
- if (parts.length !== 2) {
547
- throw new Error("Invalid DXN.kind.ECHO");
548
- }
549
- break;
550
- }
551
- _class_private_field_set(this, _kind, kind);
552
- _class_private_field_set(this, _parts, parts);
553
- }
554
560
  };
555
- _define_property2(DXN, "Schema", Schema3.NonEmptyString.pipe(
556
- Schema3.pattern(/^dxn:([^:]+):(?:[^:]+:?)+[^:]$/),
557
- // TODO(dmaretskyi): To set the format we need to move the annotation IDs out of the echo-schema package.
558
- // FormatAnnotation.set(FormatEnum.DXN),
559
- Schema3.annotations({
560
- title: "DXN",
561
- description: "DXN URI",
562
- examples: [
563
- "dxn:type:example.com/type/MyType",
564
- "dxn:echo:@:01J00J9B45YHYSGZQTQMSKMGJ6"
565
- ]
566
- })
567
- ));
568
- _define_property2(DXN, "kind", Object.freeze({
569
- /**
570
- * dxn:type:<type_name>[:<version>]
571
- */
572
- TYPE: "type",
573
- /**
574
- * dxn:echo:<space_id>:<echo_id>
575
- * dxn:echo:@:<echo_id>
576
- */
577
- // TODO(burdon): Rename to OBJECT? (BREAKING CHANGE to update "echo").
578
- // TODO(burdon): Add separate Kind for space?
579
- ECHO: "echo",
580
- /**
581
- * The subspace tag enables us to partition queues by usage within the context of a space.
582
- * dxn:queue:<subspace_tag>:<space_id>:<queue_id>[:object_id]
583
- * dxn:queue:data:BA25QRC2FEWCSAMRP4RZL65LWJ7352CKE:01J00J9B45YHYSGZQTQMSKMGJ6
584
- * dxn:queue:trace:BA25QRC2FEWCSAMRP4RZL65LWJ7352CKE:01J00J9B45YHYSGZQTQMSKMGJ6
585
- */
586
- QUEUE: "queue"
587
- }));
588
561
 
589
562
  // src/identity-did.ts
590
563
  init_inject_globals();
@@ -642,27 +615,13 @@ init_inject_globals();
642
615
  var import_base32_decode3 = __toESM(require_base32_decode(), 1);
643
616
  import { devtoolsFormatter as devtoolsFormatter2, equalsSymbol, inspectCustom as inspectCustom2, truncateKey } from "@dxos/debug";
644
617
  import { invariant as invariant4 } from "@dxos/invariant";
645
- function _define_property3(obj, key, value) {
646
- if (key in obj) {
647
- Object.defineProperty(obj, key, {
648
- value,
649
- enumerable: true,
650
- configurable: true,
651
- writable: true
652
- });
653
- } else {
654
- obj[key] = value;
655
- }
656
- return obj;
657
- }
658
618
  var __dxlog_file4 = "/__w/dxos/dxos/packages/common/keys/src/public-key.ts";
659
619
  var PUBLIC_KEY_LENGTH = 32;
660
620
  var SECRET_KEY_LENGTH = 64;
661
621
  var isLikeArrayBuffer = (value) => typeof value === "object" && value !== null && Object.getPrototypeOf(value).constructor.name === "ArrayBuffer";
662
- var _inspectCustom2 = inspectCustom2;
663
- var _devtoolsFormatter2 = devtoolsFormatter2;
664
- var _equalsSymbol = equalsSymbol;
665
622
  var PublicKey = class _PublicKey {
623
+ _value;
624
+ static ZERO = _PublicKey.from("00".repeat(PUBLIC_KEY_LENGTH));
666
625
  /**
667
626
  * Creates new instance of PublicKey automatically determining the input format.
668
627
  * @param source A Buffer, or Uint8Array, or hex encoded string, or something with an `asUint8Array` method on it
@@ -814,6 +773,12 @@ var PublicKey = class _PublicKey {
814
773
  });
815
774
  return new _PublicKey(new Uint8Array((0, import_base32_decode3.default)(encoded.slice(1), "RFC4648")));
816
775
  }
776
+ constructor(_value) {
777
+ this._value = _value;
778
+ if (!(_value instanceof Uint8Array)) {
779
+ throw new TypeError(`Expected Uint8Array, got: ${_value}`);
780
+ }
781
+ }
817
782
  toString() {
818
783
  return this.toHex();
819
784
  }
@@ -847,7 +812,7 @@ var PublicKey = class _PublicKey {
847
812
  /**
848
813
  * Used by Node.js to get textual representation of this object when it's printed with a `console.log` statement.
849
814
  */
850
- [_inspectCustom2](depth, options, inspectFn) {
815
+ [inspectCustom2](depth, options, inspectFn) {
851
816
  if (!options.colors || typeof process.stdout.hasColors !== "function" || !process.stdout.hasColors()) {
852
817
  return `<PublicKey ${this.truncate()}>`;
853
818
  }
@@ -872,7 +837,7 @@ var PublicKey = class _PublicKey {
872
837
  const color = colors[this.getInsecureHash(colors.length)];
873
838
  return `PublicKey(${printControlCode(inspectFn.colors[color][0])}${this.truncate()}${printControlCode(inspectFn.colors.reset[0])})`;
874
839
  }
875
- get [_devtoolsFormatter2]() {
840
+ get [devtoolsFormatter2]() {
876
841
  return {
877
842
  header: () => {
878
843
  const colors = [
@@ -925,25 +890,17 @@ var PublicKey = class _PublicKey {
925
890
  }
926
891
  let equal = true;
927
892
  for (let i = 0; i < this._value.length; i++) {
928
- equal && (equal = this._value[i] === otherConverted._value[i]);
893
+ equal &&= this._value[i] === otherConverted._value[i];
929
894
  }
930
895
  return equal;
931
896
  }
932
- [_equalsSymbol](other) {
897
+ [equalsSymbol](other) {
933
898
  if (!_PublicKey.isPublicKey(other)) {
934
899
  return false;
935
900
  }
936
901
  return this.equals(other);
937
902
  }
938
- constructor(_value) {
939
- _define_property3(this, "_value", void 0);
940
- this._value = _value;
941
- if (!(_value instanceof Uint8Array)) {
942
- throw new TypeError(`Expected Uint8Array, got: ${_value}`);
943
- }
944
- }
945
903
  };
946
- _define_property3(PublicKey, "ZERO", PublicKey.from("00".repeat(PUBLIC_KEY_LENGTH)));
947
904
  export {
948
905
  DXN,
949
906
  DXN_ECHO_REGEXP,
@@ -954,6 +911,7 @@ export {
954
911
  PublicKey,
955
912
  QueueSubspaceTags,
956
913
  SECRET_KEY_LENGTH,
914
+ SimplePRNG,
957
915
  SpaceId
958
916
  };
959
917
  //# sourceMappingURL=index.mjs.map