@dxos/keys 0.8.4-main.1da679c → 0.8.4-main.21d9917

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.
@@ -82,18 +82,20 @@ var require_base32_decode = __commonJS({
82
82
  });
83
83
 
84
84
  // src/dxn.ts
85
- import { Schema as Schema3 } from "effect";
85
+ import * as Schema3 from "effect/Schema";
86
86
  import { devtoolsFormatter, inspectCustom } from "@dxos/debug";
87
87
  import { assertArgument, invariant as invariant2 } from "@dxos/invariant";
88
88
 
89
89
  // src/object-id.ts
90
- import { Schema } from "effect";
91
- import { ulid } from "ulidx";
90
+ import * as Schema from "effect/Schema";
91
+ import { monotonicFactory } from "ulidx";
92
92
  var ObjectIdSchema = Schema.String.pipe(Schema.pattern(/^[0-7][0-9A-HJKMNP-TV-Z]{25}$/i)).annotations({
93
93
  description: "A Universally Unique Lexicographically Sortable Identifier",
94
94
  pattern: "^[0-7][0-9A-HJKMNP-TV-Z]{25}$"
95
95
  });
96
96
  var ObjectId = class extends ObjectIdSchema {
97
+ static #factory = monotonicFactory();
98
+ static #seedTime = void 0;
97
99
  static isValid(id) {
98
100
  try {
99
101
  Schema.decodeSync(ObjectId)(id);
@@ -103,7 +105,46 @@ var ObjectId = class extends ObjectIdSchema {
103
105
  }
104
106
  }
105
107
  static random() {
106
- return ulid();
108
+ return this.#factory(this.#seedTime);
109
+ }
110
+ static dangerouslyDisableRandomness() {
111
+ this.#factory = monotonicFactory(makeTestPRNG());
112
+ this.#seedTime = (/* @__PURE__ */ new Date("2025-01-01")).getTime();
113
+ }
114
+ };
115
+ var makeTestPRNG = () => {
116
+ const rng = new SimplePRNG();
117
+ return () => {
118
+ return rng.next();
119
+ };
120
+ };
121
+ var SimplePRNG = class _SimplePRNG {
122
+ #seed;
123
+ // LCG parameters (from Numerical Recipes)
124
+ static #a = 1664525;
125
+ static #c = 1013904223;
126
+ static #m = Math.pow(2, 32);
127
+ /**
128
+ * Creates a new PRNG instance.
129
+ * @param seed - Initial seed value. If not provided, uses 0.
130
+ */
131
+ constructor(seed = 0) {
132
+ this.#seed = seed;
133
+ }
134
+ /**
135
+ * Generates the next pseudo-random number in the range [0, 1).
136
+ * @returns A pseudo-random number between 0 (inclusive) and 1 (exclusive).
137
+ */
138
+ next() {
139
+ this.#seed = (_SimplePRNG.#a * this.#seed + _SimplePRNG.#c) % _SimplePRNG.#m;
140
+ return this.#seed / _SimplePRNG.#m;
141
+ }
142
+ /**
143
+ * Resets the generator with a new seed.
144
+ * @param seed - New seed value.
145
+ */
146
+ reset(seed) {
147
+ this.#seed = seed;
107
148
  }
108
149
  };
109
150
 
@@ -170,7 +211,7 @@ function base32Encode(data, variant, options) {
170
211
  }
171
212
 
172
213
  // src/space-id.ts
173
- import { Schema as Schema2 } from "effect";
214
+ import * as Schema2 from "effect/Schema";
174
215
  import { invariant } from "@dxos/invariant";
175
216
 
176
217
  // src/random-bytes.ts
@@ -182,117 +223,54 @@ var randomBytes = (length) => {
182
223
  };
183
224
 
184
225
  // src/space-id.ts
185
- function _define_property(obj, key, value) {
186
- if (key in obj) {
187
- Object.defineProperty(obj, key, {
188
- value,
189
- enumerable: true,
190
- configurable: true,
191
- writable: true
192
- });
193
- } else {
194
- obj[key] = value;
195
- }
196
- return obj;
197
- }
198
- var _Schema_String_pipe;
199
- var _class;
200
226
  var __dxlog_file = "/__w/dxos/dxos/packages/common/keys/src/space-id.ts";
201
227
  var MULTIBASE_PREFIX = "B";
202
228
  var ENCODED_LENGTH = 33;
203
229
  var isValid = (value) => {
204
230
  return typeof value === "string" && value.startsWith(MULTIBASE_PREFIX) && value.length === ENCODED_LENGTH;
205
231
  };
206
- var SpaceId = (_class = class extends (_Schema_String_pipe = Schema2.String.pipe(Schema2.filter(isValid))) {
207
- }, _define_property(_class, "byteLength", 20), _define_property(_class, "encode", (value) => {
208
- invariant(value instanceof Uint8Array, "Invalid type", {
209
- F: __dxlog_file,
210
- L: 43,
211
- S: _class,
212
- A: [
213
- "value instanceof Uint8Array",
214
- "'Invalid type'"
215
- ]
216
- });
217
- invariant(value.length === SpaceId.byteLength, "Invalid length", {
218
- F: __dxlog_file,
219
- L: 44,
220
- S: _class,
221
- A: [
222
- "value.length === SpaceId.byteLength",
223
- "'Invalid length'"
224
- ]
225
- });
226
- return MULTIBASE_PREFIX + base32Encode(value, "RFC4648");
227
- }), _define_property(_class, "decode", (value) => {
228
- invariant(value.startsWith(MULTIBASE_PREFIX), "Invalid multibase32 encoding", {
229
- F: __dxlog_file,
230
- L: 49,
231
- S: _class,
232
- A: [
233
- "value.startsWith(MULTIBASE_PREFIX)",
234
- "'Invalid multibase32 encoding'"
235
- ]
236
- });
237
- return new Uint8Array((0, import_base32_decode.default)(value.slice(1), "RFC4648"));
238
- }), _define_property(_class, "isValid", isValid), _define_property(_class, "random", () => {
239
- return SpaceId.encode(randomBytes(SpaceId.byteLength));
240
- }), _class);
232
+ var SpaceId = class extends Schema2.String.pipe(Schema2.filter(isValid)) {
233
+ static byteLength = 20;
234
+ static encode = (value) => {
235
+ invariant(value instanceof Uint8Array, "Invalid type", {
236
+ F: __dxlog_file,
237
+ L: 43,
238
+ S: this,
239
+ A: [
240
+ "value instanceof Uint8Array",
241
+ "'Invalid type'"
242
+ ]
243
+ });
244
+ invariant(value.length === SpaceId.byteLength, "Invalid length", {
245
+ F: __dxlog_file,
246
+ L: 44,
247
+ S: this,
248
+ A: [
249
+ "value.length === SpaceId.byteLength",
250
+ "'Invalid length'"
251
+ ]
252
+ });
253
+ return MULTIBASE_PREFIX + base32Encode(value, "RFC4648");
254
+ };
255
+ static decode = (value) => {
256
+ invariant(value.startsWith(MULTIBASE_PREFIX), "Invalid multibase32 encoding", {
257
+ F: __dxlog_file,
258
+ L: 49,
259
+ S: this,
260
+ A: [
261
+ "value.startsWith(MULTIBASE_PREFIX)",
262
+ "'Invalid multibase32 encoding'"
263
+ ]
264
+ });
265
+ return new Uint8Array((0, import_base32_decode.default)(value.slice(1), "RFC4648"));
266
+ };
267
+ static isValid = isValid;
268
+ static random = () => {
269
+ return SpaceId.encode(randomBytes(SpaceId.byteLength));
270
+ };
271
+ };
241
272
 
242
273
  // src/dxn.ts
243
- function _check_private_redeclaration(obj, privateCollection) {
244
- if (privateCollection.has(obj)) {
245
- throw new TypeError("Cannot initialize the same private elements twice on an object");
246
- }
247
- }
248
- function _class_apply_descriptor_get(receiver, descriptor) {
249
- if (descriptor.get) {
250
- return descriptor.get.call(receiver);
251
- }
252
- return descriptor.value;
253
- }
254
- function _class_apply_descriptor_set(receiver, descriptor, value) {
255
- if (descriptor.set) {
256
- descriptor.set.call(receiver, value);
257
- } else {
258
- if (!descriptor.writable) {
259
- throw new TypeError("attempted to set read only private field");
260
- }
261
- descriptor.value = value;
262
- }
263
- }
264
- function _class_extract_field_descriptor(receiver, privateMap, action) {
265
- if (!privateMap.has(receiver)) {
266
- throw new TypeError("attempted to " + action + " private field on non-instance");
267
- }
268
- return privateMap.get(receiver);
269
- }
270
- function _class_private_field_get(receiver, privateMap) {
271
- var descriptor = _class_extract_field_descriptor(receiver, privateMap, "get");
272
- return _class_apply_descriptor_get(receiver, descriptor);
273
- }
274
- function _class_private_field_init(obj, privateMap, value) {
275
- _check_private_redeclaration(obj, privateMap);
276
- privateMap.set(obj, value);
277
- }
278
- function _class_private_field_set(receiver, privateMap, value) {
279
- var descriptor = _class_extract_field_descriptor(receiver, privateMap, "set");
280
- _class_apply_descriptor_set(receiver, descriptor, value);
281
- return value;
282
- }
283
- function _define_property2(obj, key, value) {
284
- if (key in obj) {
285
- Object.defineProperty(obj, key, {
286
- value,
287
- enumerable: true,
288
- configurable: true,
289
- writable: true
290
- });
291
- } else {
292
- obj[key] = value;
293
- }
294
- return obj;
295
- }
296
274
  var __dxlog_file2 = "/__w/dxos/dxos/packages/common/keys/src/dxn.ts";
297
275
  var LOCAL_SPACE_TAG = "@";
298
276
  var DXN_ECHO_REGEXP = /@(dxn:[a-zA-Z0-p:@]+)/;
@@ -300,15 +278,49 @@ var QueueSubspaceTags = Object.freeze({
300
278
  DATA: "data",
301
279
  TRACE: "trace"
302
280
  });
303
- var _kind = /* @__PURE__ */ new WeakMap();
304
- var _parts = /* @__PURE__ */ new WeakMap();
305
- var _inspectCustom = inspectCustom;
306
- var _devtoolsFormatter = devtoolsFormatter;
307
281
  var DXN = class _DXN {
282
+ // TODO(burdon): Rename to DXN (i.e., DXN.DXN).
283
+ // TODO(dmaretskyi): Should this be a transformation into the DXN type?
284
+ static Schema = Schema3.NonEmptyString.pipe(
285
+ Schema3.pattern(/^dxn:([^:]+):(?:[^:]+:?)+[^:]$/),
286
+ // TODO(dmaretskyi): To set the format we need to move the annotation IDs out of the echo-schema package.
287
+ // FormatAnnotation.set(TypeFormat.DXN),
288
+ Schema3.annotations({
289
+ title: "DXN",
290
+ description: "DXN URI",
291
+ examples: [
292
+ "dxn:type:example.com/type/MyType",
293
+ "dxn:echo:@:01J00J9B45YHYSGZQTQMSKMGJ6"
294
+ ]
295
+ })
296
+ );
308
297
  static hash(dxn) {
309
298
  return dxn.toString();
310
299
  }
311
300
  /**
301
+ * Kind constants.
302
+ */
303
+ static kind = Object.freeze({
304
+ /**
305
+ * dxn:type:<type_name>[:<version>]
306
+ */
307
+ TYPE: "type",
308
+ /**
309
+ * dxn:echo:<space_id>:<echo_id>
310
+ * dxn:echo:@:<echo_id>
311
+ */
312
+ // TODO(burdon): Rename to OBJECT? (BREAKING CHANGE to update "echo").
313
+ // TODO(burdon): Add separate Kind for space?
314
+ ECHO: "echo",
315
+ /**
316
+ * The subspace tag enables us to partition queues by usage within the context of a space.
317
+ * dxn:queue:<subspace_tag>:<space_id>:<queue_id>[:object_id]
318
+ * dxn:queue:data:BA25QRC2FEWCSAMRP4RZL65LWJ7352CKE:01J00J9B45YHYSGZQTQMSKMGJ6
319
+ * dxn:queue:trace:BA25QRC2FEWCSAMRP4RZL65LWJ7352CKE:01J00J9B45YHYSGZQTQMSKMGJ6
320
+ */
321
+ QUEUE: "queue"
322
+ });
323
+ /**
312
324
  * Exactly equals.
313
325
  */
314
326
  static equals(a, b) {
@@ -347,7 +359,7 @@ var DXN = class _DXN {
347
359
  }
348
360
  }
349
361
  /**
350
- * @example `dxn:type:example.com/type/Contact`
362
+ * @example `dxn:type:example.com/type/Person`
351
363
  */
352
364
  static fromTypename(typename) {
353
365
  return new _DXN(_DXN.kind.TYPE, [
@@ -355,7 +367,7 @@ var DXN = class _DXN {
355
367
  ]);
356
368
  }
357
369
  /**
358
- * @example `dxn:type:example.com/type/Contact:0.1.0`
370
+ * @example `dxn:type:example.com/type/Person:0.1.0`
359
371
  */
360
372
  // TODO(dmaretskyi): Consider using @ as the version separator.
361
373
  static fromTypenameAndVersion(typename, version) {
@@ -398,8 +410,28 @@ var DXN = class _DXN {
398
410
  ] : []
399
411
  ]);
400
412
  }
413
+ #kind;
414
+ #parts;
415
+ constructor(kind, parts) {
416
+ assertArgument(parts.length > 0, "parts", `Invalid DXN: ${parts}`);
417
+ assertArgument(parts.every((part) => typeof part === "string" && part.length > 0 && part.indexOf(":") === -1), "parts", `Invalid DXN: ${parts}`);
418
+ switch (kind) {
419
+ case _DXN.kind.TYPE:
420
+ if (parts.length > 2) {
421
+ throw new Error("Invalid DXN.kind.TYPE");
422
+ }
423
+ break;
424
+ case _DXN.kind.ECHO:
425
+ if (parts.length !== 2) {
426
+ throw new Error("Invalid DXN.kind.ECHO");
427
+ }
428
+ break;
429
+ }
430
+ this.#kind = kind;
431
+ this.#parts = parts;
432
+ }
401
433
  toString() {
402
- return `dxn:${_class_private_field_get(this, _kind)}:${_class_private_field_get(this, _parts).join(":")}`;
434
+ return `dxn:${this.#kind}:${this.#parts.join(":")}`;
403
435
  }
404
436
  toJSON() {
405
437
  return this.toString();
@@ -407,13 +439,13 @@ var DXN = class _DXN {
407
439
  /**
408
440
  * Used by Node.js to get textual representation of this object when it's printed with a `console.log` statement.
409
441
  */
410
- [_inspectCustom](depth, options, inspectFn) {
442
+ [inspectCustom](depth, options, inspectFn) {
411
443
  const printControlCode = (code) => {
412
444
  return `\x1B[${code}m`;
413
445
  };
414
446
  return printControlCode(inspectFn.colors.blueBright[0]) + this.toString() + printControlCode(inspectFn.colors.reset[0]);
415
447
  }
416
- get [_devtoolsFormatter]() {
448
+ get [devtoolsFormatter]() {
417
449
  return {
418
450
  header: () => {
419
451
  return [
@@ -427,14 +459,14 @@ var DXN = class _DXN {
427
459
  };
428
460
  }
429
461
  get kind() {
430
- return _class_private_field_get(this, _kind);
462
+ return this.#kind;
431
463
  }
432
464
  get parts() {
433
- return _class_private_field_get(this, _parts);
465
+ return this.#parts;
434
466
  }
435
467
  // TODO(burdon): Should getters fail?
436
468
  get typename() {
437
- invariant2(_class_private_field_get(this, _kind) === _DXN.kind.TYPE, void 0, {
469
+ invariant2(this.#kind === _DXN.kind.TYPE, void 0, {
438
470
  F: __dxlog_file2,
439
471
  L: 250,
440
472
  S: this,
@@ -443,22 +475,22 @@ var DXN = class _DXN {
443
475
  ""
444
476
  ]
445
477
  });
446
- return _class_private_field_get(this, _parts)[0];
478
+ return this.#parts[0];
447
479
  }
448
480
  equals(other) {
449
481
  return _DXN.equals(this, other);
450
482
  }
451
483
  hasTypenameOf(typename) {
452
- 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;
484
+ return this.#kind === _DXN.kind.TYPE && this.#parts.length === 1 && this.#parts[0] === typename;
453
485
  }
454
486
  isLocalObjectId() {
455
- 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;
487
+ return this.#kind === _DXN.kind.ECHO && this.#parts[0] === LOCAL_SPACE_TAG && this.#parts.length === 2;
456
488
  }
457
489
  asTypeDXN() {
458
490
  if (this.kind !== _DXN.kind.TYPE) {
459
491
  return void 0;
460
492
  }
461
- const [type, version] = _class_private_field_get(this, _parts);
493
+ const [type, version] = this.#parts;
462
494
  return {
463
495
  // TODO(wittjosiah): Should be `typename` for consistency.
464
496
  type,
@@ -469,7 +501,7 @@ var DXN = class _DXN {
469
501
  if (this.kind !== _DXN.kind.ECHO) {
470
502
  return void 0;
471
503
  }
472
- const [spaceId, echoId] = _class_private_field_get(this, _parts);
504
+ const [spaceId, echoId] = this.#parts;
473
505
  return {
474
506
  spaceId: spaceId === LOCAL_SPACE_TAG ? void 0 : spaceId,
475
507
  // TODO(burdon): objectId.
@@ -480,7 +512,7 @@ var DXN = class _DXN {
480
512
  if (this.kind !== _DXN.kind.QUEUE) {
481
513
  return void 0;
482
514
  }
483
- const [subspaceTag, spaceId, queueId, objectId] = _class_private_field_get(this, _parts);
515
+ const [subspaceTag, spaceId, queueId, objectId] = this.#parts;
484
516
  if (typeof queueId !== "string") {
485
517
  return void 0;
486
518
  }
@@ -495,71 +527,12 @@ var DXN = class _DXN {
495
527
  * Produces a new DXN with the given parts appended.
496
528
  */
497
529
  extend(parts) {
498
- return new _DXN(_class_private_field_get(this, _kind), [
499
- ..._class_private_field_get(this, _parts),
530
+ return new _DXN(this.#kind, [
531
+ ...this.#parts,
500
532
  ...parts
501
533
  ]);
502
534
  }
503
- constructor(kind, parts) {
504
- _class_private_field_init(this, _kind, {
505
- writable: true,
506
- value: void 0
507
- });
508
- _class_private_field_init(this, _parts, {
509
- writable: true,
510
- value: void 0
511
- });
512
- assertArgument(parts.length > 0, "parts", `Invalid DXN: ${parts}`);
513
- assertArgument(parts.every((part) => typeof part === "string" && part.length > 0 && part.indexOf(":") === -1), "parts", `Invalid DXN: ${parts}`);
514
- switch (kind) {
515
- case _DXN.kind.TYPE:
516
- if (parts.length > 2) {
517
- throw new Error("Invalid DXN.kind.TYPE");
518
- }
519
- break;
520
- case _DXN.kind.ECHO:
521
- if (parts.length !== 2) {
522
- throw new Error("Invalid DXN.kind.ECHO");
523
- }
524
- break;
525
- }
526
- _class_private_field_set(this, _kind, kind);
527
- _class_private_field_set(this, _parts, parts);
528
- }
529
535
  };
530
- _define_property2(DXN, "Schema", Schema3.NonEmptyString.pipe(
531
- Schema3.pattern(/^dxn:([^:]+):(?:[^:]+:?)+[^:]$/),
532
- // TODO(dmaretskyi): To set the format we need to move the annotation IDs out of the echo-schema package.
533
- // FormatAnnotation.set(FormatEnum.DXN),
534
- Schema3.annotations({
535
- title: "DXN",
536
- description: "DXN URI",
537
- examples: [
538
- "dxn:type:example.com/type/MyType",
539
- "dxn:echo:@:01J00J9B45YHYSGZQTQMSKMGJ6"
540
- ]
541
- })
542
- ));
543
- _define_property2(DXN, "kind", Object.freeze({
544
- /**
545
- * dxn:type:<type_name>[:<version>]
546
- */
547
- TYPE: "type",
548
- /**
549
- * dxn:echo:<space_id>:<echo_id>
550
- * dxn:echo:@:<echo_id>
551
- */
552
- // TODO(burdon): Rename to OBJECT? (BREAKING CHANGE to update "echo").
553
- // TODO(burdon): Add separate Kind for space?
554
- ECHO: "echo",
555
- /**
556
- * The subspace tag enables us to partition queues by usage within the context of a space.
557
- * dxn:queue:<subspace_tag>:<space_id>:<queue_id>[:object_id]
558
- * dxn:queue:data:BA25QRC2FEWCSAMRP4RZL65LWJ7352CKE:01J00J9B45YHYSGZQTQMSKMGJ6
559
- * dxn:queue:trace:BA25QRC2FEWCSAMRP4RZL65LWJ7352CKE:01J00J9B45YHYSGZQTQMSKMGJ6
560
- */
561
- QUEUE: "queue"
562
- }));
563
536
 
564
537
  // src/identity-did.ts
565
538
  var import_base32_decode2 = __toESM(require_base32_decode(), 1);
@@ -615,27 +588,13 @@ var ENCODED_LENGTH2 = 42;
615
588
  var import_base32_decode3 = __toESM(require_base32_decode(), 1);
616
589
  import { devtoolsFormatter as devtoolsFormatter2, equalsSymbol, inspectCustom as inspectCustom2, truncateKey } from "@dxos/debug";
617
590
  import { invariant as invariant4 } from "@dxos/invariant";
618
- function _define_property3(obj, key, value) {
619
- if (key in obj) {
620
- Object.defineProperty(obj, key, {
621
- value,
622
- enumerable: true,
623
- configurable: true,
624
- writable: true
625
- });
626
- } else {
627
- obj[key] = value;
628
- }
629
- return obj;
630
- }
631
591
  var __dxlog_file4 = "/__w/dxos/dxos/packages/common/keys/src/public-key.ts";
632
592
  var PUBLIC_KEY_LENGTH = 32;
633
593
  var SECRET_KEY_LENGTH = 64;
634
594
  var isLikeArrayBuffer = (value) => typeof value === "object" && value !== null && Object.getPrototypeOf(value).constructor.name === "ArrayBuffer";
635
- var _inspectCustom2 = inspectCustom2;
636
- var _devtoolsFormatter2 = devtoolsFormatter2;
637
- var _equalsSymbol = equalsSymbol;
638
595
  var PublicKey = class _PublicKey {
596
+ _value;
597
+ static ZERO = _PublicKey.from("00".repeat(PUBLIC_KEY_LENGTH));
639
598
  /**
640
599
  * Creates new instance of PublicKey automatically determining the input format.
641
600
  * @param source A Buffer, or Uint8Array, or hex encoded string, or something with an `asUint8Array` method on it
@@ -787,6 +746,12 @@ var PublicKey = class _PublicKey {
787
746
  });
788
747
  return new _PublicKey(new Uint8Array((0, import_base32_decode3.default)(encoded.slice(1), "RFC4648")));
789
748
  }
749
+ constructor(_value) {
750
+ this._value = _value;
751
+ if (!(_value instanceof Uint8Array)) {
752
+ throw new TypeError(`Expected Uint8Array, got: ${_value}`);
753
+ }
754
+ }
790
755
  toString() {
791
756
  return this.toHex();
792
757
  }
@@ -820,7 +785,7 @@ var PublicKey = class _PublicKey {
820
785
  /**
821
786
  * Used by Node.js to get textual representation of this object when it's printed with a `console.log` statement.
822
787
  */
823
- [_inspectCustom2](depth, options, inspectFn) {
788
+ [inspectCustom2](depth, options, inspectFn) {
824
789
  if (!options.colors || typeof process.stdout.hasColors !== "function" || !process.stdout.hasColors()) {
825
790
  return `<PublicKey ${this.truncate()}>`;
826
791
  }
@@ -845,7 +810,7 @@ var PublicKey = class _PublicKey {
845
810
  const color = colors[this.getInsecureHash(colors.length)];
846
811
  return `PublicKey(${printControlCode(inspectFn.colors[color][0])}${this.truncate()}${printControlCode(inspectFn.colors.reset[0])})`;
847
812
  }
848
- get [_devtoolsFormatter2]() {
813
+ get [devtoolsFormatter2]() {
849
814
  return {
850
815
  header: () => {
851
816
  const colors = [
@@ -898,25 +863,17 @@ var PublicKey = class _PublicKey {
898
863
  }
899
864
  let equal = true;
900
865
  for (let i = 0; i < this._value.length; i++) {
901
- equal && (equal = this._value[i] === otherConverted._value[i]);
866
+ equal &&= this._value[i] === otherConverted._value[i];
902
867
  }
903
868
  return equal;
904
869
  }
905
- [_equalsSymbol](other) {
870
+ [equalsSymbol](other) {
906
871
  if (!_PublicKey.isPublicKey(other)) {
907
872
  return false;
908
873
  }
909
874
  return this.equals(other);
910
875
  }
911
- constructor(_value) {
912
- _define_property3(this, "_value", void 0);
913
- this._value = _value;
914
- if (!(_value instanceof Uint8Array)) {
915
- throw new TypeError(`Expected Uint8Array, got: ${_value}`);
916
- }
917
- }
918
876
  };
919
- _define_property3(PublicKey, "ZERO", PublicKey.from("00".repeat(PUBLIC_KEY_LENGTH)));
920
877
  export {
921
878
  DXN,
922
879
  DXN_ECHO_REGEXP,
@@ -927,6 +884,7 @@ export {
927
884
  PublicKey,
928
885
  QueueSubspaceTags,
929
886
  SECRET_KEY_LENGTH,
887
+ SimplePRNG,
930
888
  SpaceId
931
889
  };
932
890
  //# sourceMappingURL=index.mjs.map