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

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.
@@ -109,7 +109,7 @@ init_inject_globals();
109
109
  import { Schema } from "effect";
110
110
  import { ulid } from "ulidx";
111
111
  var ObjectIdSchema = Schema.String.pipe(Schema.pattern(/^[0-7][0-9A-HJKMNP-TV-Z]{25}$/i)).annotations({
112
- description: "a Universally Unique Lexicographically Sortable Identifier",
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 {
@@ -117,7 +117,7 @@ var ObjectId = class extends ObjectIdSchema {
117
117
  try {
118
118
  Schema.decodeSync(ObjectId)(id);
119
119
  return true;
120
- } catch (err) {
120
+ } catch {
121
121
  return false;
122
122
  }
123
123
  }
@@ -207,121 +207,143 @@ var randomBytes = (length) => {
207
207
  };
208
208
 
209
209
  // 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;
210
225
  var __dxlog_file = "/__w/dxos/dxos/packages/common/keys/src/space-id.ts";
211
226
  var MULTIBASE_PREFIX = "B";
212
227
  var ENCODED_LENGTH = 33;
213
228
  var isValid = (value) => {
214
229
  return typeof value === "string" && value.startsWith(MULTIBASE_PREFIX) && value.length === ENCODED_LENGTH;
215
230
  };
216
- var SpaceId = class extends Schema2.String.pipe(Schema2.filter(isValid)) {
217
- static {
218
- this.byteLength = 20;
219
- }
220
- static {
221
- this.encode = (value) => {
222
- invariant(value instanceof Uint8Array, "Invalid type", {
223
- F: __dxlog_file,
224
- L: 43,
225
- S: this,
226
- A: [
227
- "value instanceof Uint8Array",
228
- "'Invalid type'"
229
- ]
230
- });
231
- invariant(value.length === SpaceId.byteLength, "Invalid length", {
232
- F: __dxlog_file,
233
- L: 44,
234
- S: this,
235
- A: [
236
- "value.length === SpaceId.byteLength",
237
- "'Invalid length'"
238
- ]
239
- });
240
- return MULTIBASE_PREFIX + base32Encode(value, "RFC4648");
241
- };
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);
266
+
267
+ // 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");
242
271
  }
243
- static {
244
- this.decode = (value) => {
245
- invariant(value.startsWith(MULTIBASE_PREFIX), "Invalid multibase32 encoding", {
246
- F: __dxlog_file,
247
- L: 49,
248
- S: this,
249
- A: [
250
- "value.startsWith(MULTIBASE_PREFIX)",
251
- "'Invalid multibase32 encoding'"
252
- ]
253
- });
254
- return new Uint8Array((0, import_base32_decode.default)(value.slice(1), "RFC4648"));
255
- };
272
+ }
273
+ function _class_apply_descriptor_get(receiver, descriptor) {
274
+ if (descriptor.get) {
275
+ return descriptor.get.call(receiver);
256
276
  }
257
- static {
258
- this.isValid = isValid;
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;
259
287
  }
260
- static {
261
- this.random = () => {
262
- return SpaceId.encode(randomBytes(SpaceId.byteLength));
263
- };
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");
264
292
  }
265
- };
266
-
267
- // src/dxn.ts
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
+ }
268
321
  var __dxlog_file2 = "/__w/dxos/dxos/packages/common/keys/src/dxn.ts";
269
322
  var LOCAL_SPACE_TAG = "@";
323
+ var DXN_ECHO_REGEXP = /@(dxn:[a-zA-Z0-p:@]+)/;
270
324
  var QueueSubspaceTags = Object.freeze({
271
325
  DATA: "data",
272
326
  TRACE: "trace"
273
327
  });
328
+ var _kind = /* @__PURE__ */ new WeakMap();
329
+ var _parts = /* @__PURE__ */ new WeakMap();
330
+ var _inspectCustom = inspectCustom;
331
+ var _devtoolsFormatter = devtoolsFormatter;
274
332
  var DXN = class _DXN {
275
- static {
276
- // TODO(dmaretskyi): Should this be a transformation into the DXN type?
277
- this.Schema = Schema3.NonEmptyString.pipe(
278
- Schema3.pattern(/^dxn:([^:]+):(?:[^:]+:?)+[^:]$/),
279
- // TODO(dmaretskyi): To set the format we need to move the annotation IDs out of the echo-schema package.
280
- // FormatAnnotation.set(FormatEnum.DXN),
281
- Schema3.annotations({
282
- title: "DXN",
283
- description: "DXN URI",
284
- examples: [
285
- "dxn:type:example.com/type/MyType",
286
- "dxn:echo:@:01J00J9B45YHYSGZQTQMSKMGJ6"
287
- ]
288
- })
289
- );
290
- }
291
333
  static hash(dxn) {
292
334
  return dxn.toString();
293
335
  }
294
- static {
295
- /**
296
- * Kind constants.
297
- */
298
- this.kind = Object.freeze({
299
- /**
300
- * dxn:type:<type name>[:<version>]
301
- */
302
- TYPE: "type",
303
- /**
304
- * dxn:echo:<space id>:<echo id>
305
- * dxn:echo:@:<echo id>
306
- */
307
- // TODO(burdon): Rename to OBJECT? (BREAKING CHANGE).
308
- // TODO(burdon): Add separate Kind for space.
309
- ECHO: "echo",
310
- /**
311
- * The subspace tag enables us to partition queues by usage within the context of a space.
312
- * dxn:queue:<subspace_tag>:<space_id>:<queue_id>[:object_id]
313
- * dxn:queue:data:BA25QRC2FEWCSAMRP4RZL65LWJ7352CKE:01J00J9B45YHYSGZQTQMSKMGJ6
314
- * dxn:queue:trace:BA25QRC2FEWCSAMRP4RZL65LWJ7352CKE:01J00J9B45YHYSGZQTQMSKMGJ6
315
- */
316
- QUEUE: "queue"
317
- });
318
- }
319
- get kind() {
320
- return this.#kind;
321
- }
336
+ /**
337
+ * Exactly equals.
338
+ */
322
339
  static equals(a, b) {
323
340
  return a.kind === b.kind && a.parts.length === b.parts.length && a.parts.every((part, i) => part === b.parts[i]);
324
341
  }
342
+ static equalsEchoId(a, b) {
343
+ const a1 = a.asEchoDXN();
344
+ const b1 = b.asEchoDXN();
345
+ return !!a1 && !!b1 && a1.echoId === b1.echoId;
346
+ }
325
347
  // TODO(burdon): Rename isValid.
326
348
  static isDXNString(dxn) {
327
349
  return dxn.startsWith("dxn:");
@@ -345,7 +367,7 @@ var DXN = class _DXN {
345
367
  static tryParse(dxn) {
346
368
  try {
347
369
  return _DXN.parse(dxn);
348
- } catch (error) {
370
+ } catch {
349
371
  return void 0;
350
372
  }
351
373
  }
@@ -368,43 +390,30 @@ var DXN = class _DXN {
368
390
  ]);
369
391
  }
370
392
  /**
393
+ * @example `dxn:echo:BA25QRC2FEWCSAMRP4RZL65LWJ7352CKE:01J00J9B45YHYSGZQTQMSKMGJ6`
394
+ */
395
+ static fromSpaceAndObjectId(spaceId, objectId) {
396
+ assertArgument(SpaceId.isValid(spaceId), `Invalid space ID: ${spaceId}`);
397
+ assertArgument(ObjectId.isValid(objectId), "objectId", `Invalid object ID: ${objectId}`);
398
+ return new _DXN(_DXN.kind.ECHO, [
399
+ spaceId,
400
+ objectId
401
+ ]);
402
+ }
403
+ /**
371
404
  * @example `dxn:echo:@:01J00J9B45YHYSGZQTQMSKMGJ6`
372
405
  */
373
406
  static fromLocalObjectId(id) {
374
- assertArgument(ObjectId.isValid(id), `Invalid object ID: ${id}`);
407
+ assertArgument(ObjectId.isValid(id), "id", `Invalid object ID: ${id}`);
375
408
  return new _DXN(_DXN.kind.ECHO, [
376
409
  LOCAL_SPACE_TAG,
377
410
  id
378
411
  ]);
379
412
  }
380
413
  static fromQueue(subspaceTag, spaceId, queueId, objectId) {
381
- invariant2(SpaceId.isValid(spaceId), void 0, {
382
- F: __dxlog_file2,
383
- L: 151,
384
- S: this,
385
- A: [
386
- "SpaceId.isValid(spaceId)",
387
- ""
388
- ]
389
- });
390
- invariant2(ObjectId.isValid(queueId), void 0, {
391
- F: __dxlog_file2,
392
- L: 152,
393
- S: this,
394
- A: [
395
- "ObjectId.isValid(queueId)",
396
- ""
397
- ]
398
- });
399
- invariant2(!objectId || ObjectId.isValid(objectId), void 0, {
400
- F: __dxlog_file2,
401
- L: 153,
402
- S: this,
403
- A: [
404
- "!objectId || ObjectId.isValid(objectId)",
405
- ""
406
- ]
407
- });
414
+ assertArgument(SpaceId.isValid(spaceId), `Invalid space ID: ${spaceId}`);
415
+ assertArgument(ObjectId.isValid(queueId), "queueId", `Invalid queue ID: ${queueId}`);
416
+ assertArgument(!objectId || ObjectId.isValid(objectId), "objectId", `Invalid object ID: ${objectId}`);
408
417
  return new _DXN(_DXN.kind.QUEUE, [
409
418
  subspaceTag,
410
419
  spaceId,
@@ -414,44 +423,8 @@ var DXN = class _DXN {
414
423
  ] : []
415
424
  ]);
416
425
  }
417
- #kind;
418
- #parts;
419
- constructor(kind, parts) {
420
- invariant2(parts.length > 0, void 0, {
421
- F: __dxlog_file2,
422
- L: 162,
423
- S: this,
424
- A: [
425
- "parts.length > 0",
426
- ""
427
- ]
428
- });
429
- invariant2(parts.every((part) => typeof part === "string" && part.length > 0 && part.indexOf(":") === -1), void 0, {
430
- F: __dxlog_file2,
431
- L: 163,
432
- S: this,
433
- A: [
434
- "parts.every((part) => typeof part === 'string' && part.length > 0 && part.indexOf(':') === -1)",
435
- ""
436
- ]
437
- });
438
- switch (kind) {
439
- case _DXN.kind.TYPE:
440
- if (parts.length > 2) {
441
- throw new Error('Invalid "type" DXN');
442
- }
443
- break;
444
- case _DXN.kind.ECHO:
445
- if (parts.length !== 2) {
446
- throw new Error('Invalid "echo" DXN');
447
- }
448
- break;
449
- }
450
- this.#kind = kind;
451
- this.#parts = parts;
452
- }
453
426
  toString() {
454
- return `dxn:${this.#kind}:${this.#parts.join(":")}`;
427
+ return `dxn:${_class_private_field_get(this, _kind)}:${_class_private_field_get(this, _parts).join(":")}`;
455
428
  }
456
429
  toJSON() {
457
430
  return this.toString();
@@ -459,13 +432,13 @@ var DXN = class _DXN {
459
432
  /**
460
433
  * Used by Node.js to get textual representation of this object when it's printed with a `console.log` statement.
461
434
  */
462
- [inspectCustom](depth, options, inspectFn) {
435
+ [_inspectCustom](depth, options, inspectFn) {
463
436
  const printControlCode = (code) => {
464
437
  return `\x1B[${code}m`;
465
438
  };
466
439
  return printControlCode(inspectFn.colors.blueBright[0]) + this.toString() + printControlCode(inspectFn.colors.reset[0]);
467
440
  }
468
- get [devtoolsFormatter]() {
441
+ get [_devtoolsFormatter]() {
469
442
  return {
470
443
  header: () => {
471
444
  return [
@@ -478,33 +451,39 @@ var DXN = class _DXN {
478
451
  }
479
452
  };
480
453
  }
454
+ get kind() {
455
+ return _class_private_field_get(this, _kind);
456
+ }
481
457
  get parts() {
482
- return this.#parts;
458
+ return _class_private_field_get(this, _parts);
483
459
  }
484
460
  // TODO(burdon): Should getters fail?
485
461
  get typename() {
486
- invariant2(this.#kind === _DXN.kind.TYPE, void 0, {
462
+ invariant2(_class_private_field_get(this, _kind) === _DXN.kind.TYPE, void 0, {
487
463
  F: __dxlog_file2,
488
- L: 218,
464
+ L: 250,
489
465
  S: this,
490
466
  A: [
491
467
  "this.#kind === DXN.kind.TYPE",
492
468
  ""
493
469
  ]
494
470
  });
495
- return this.#parts[0];
471
+ return _class_private_field_get(this, _parts)[0];
472
+ }
473
+ equals(other) {
474
+ return _DXN.equals(this, other);
496
475
  }
497
476
  hasTypenameOf(typename) {
498
- return this.#kind === _DXN.kind.TYPE && this.#parts.length === 1 && this.#parts[0] === 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;
499
478
  }
500
479
  isLocalObjectId() {
501
- return this.#kind === _DXN.kind.ECHO && this.#parts[0] === LOCAL_SPACE_TAG && this.#parts.length === 2;
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;
502
481
  }
503
482
  asTypeDXN() {
504
483
  if (this.kind !== _DXN.kind.TYPE) {
505
484
  return void 0;
506
485
  }
507
- const [type, version] = this.#parts;
486
+ const [type, version] = _class_private_field_get(this, _parts);
508
487
  return {
509
488
  // TODO(wittjosiah): Should be `typename` for consistency.
510
489
  type,
@@ -515,9 +494,10 @@ var DXN = class _DXN {
515
494
  if (this.kind !== _DXN.kind.ECHO) {
516
495
  return void 0;
517
496
  }
518
- const [spaceId, echoId] = this.#parts;
497
+ const [spaceId, echoId] = _class_private_field_get(this, _parts);
519
498
  return {
520
499
  spaceId: spaceId === LOCAL_SPACE_TAG ? void 0 : spaceId,
500
+ // TODO(burdon): objectId.
521
501
  echoId
522
502
  };
523
503
  }
@@ -525,7 +505,7 @@ var DXN = class _DXN {
525
505
  if (this.kind !== _DXN.kind.QUEUE) {
526
506
  return void 0;
527
507
  }
528
- const [subspaceTag, spaceId, queueId, objectId] = this.#parts;
508
+ const [subspaceTag, spaceId, queueId, objectId] = _class_private_field_get(this, _parts);
529
509
  if (typeof queueId !== "string") {
530
510
  return void 0;
531
511
  }
@@ -536,7 +516,75 @@ var DXN = class _DXN {
536
516
  objectId
537
517
  };
538
518
  }
519
+ /**
520
+ * Produces a new DXN with the given parts appended.
521
+ */
522
+ extend(parts) {
523
+ return new _DXN(_class_private_field_get(this, _kind), [
524
+ ..._class_private_field_get(this, _parts),
525
+ ...parts
526
+ ]);
527
+ }
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
+ }
539
554
  };
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
+ }));
540
588
 
541
589
  // src/identity-did.ts
542
590
  init_inject_globals();
@@ -594,14 +642,27 @@ init_inject_globals();
594
642
  var import_base32_decode3 = __toESM(require_base32_decode(), 1);
595
643
  import { devtoolsFormatter as devtoolsFormatter2, equalsSymbol, inspectCustom as inspectCustom2, truncateKey } from "@dxos/debug";
596
644
  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
+ }
597
658
  var __dxlog_file4 = "/__w/dxos/dxos/packages/common/keys/src/public-key.ts";
598
659
  var PUBLIC_KEY_LENGTH = 32;
599
660
  var SECRET_KEY_LENGTH = 64;
600
661
  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;
601
665
  var PublicKey = class _PublicKey {
602
- static {
603
- this.ZERO = _PublicKey.from("00".repeat(PUBLIC_KEY_LENGTH));
604
- }
605
666
  /**
606
667
  * Creates new instance of PublicKey automatically determining the input format.
607
668
  * @param source A Buffer, or Uint8Array, or hex encoded string, or something with an `asUint8Array` method on it
@@ -610,7 +671,7 @@ var PublicKey = class _PublicKey {
610
671
  static from(source) {
611
672
  invariant4(source, void 0, {
612
673
  F: __dxlog_file4,
613
- L: 49,
674
+ L: 50,
614
675
  S: this,
615
676
  A: [
616
677
  "source",
@@ -702,7 +763,7 @@ var PublicKey = class _PublicKey {
702
763
  static bufferize(str) {
703
764
  invariant4(typeof str === "string", "Invalid type", {
704
765
  F: __dxlog_file4,
705
- L: 152,
766
+ L: 153,
706
767
  S: this,
707
768
  A: [
708
769
  "typeof str === 'string'",
@@ -725,7 +786,7 @@ var PublicKey = class _PublicKey {
725
786
  }
726
787
  invariant4(key instanceof Buffer2, "Invalid type", {
727
788
  F: __dxlog_file4,
728
- L: 171,
789
+ L: 172,
729
790
  S: this,
730
791
  A: [
731
792
  "key instanceof Buffer",
@@ -744,7 +805,7 @@ var PublicKey = class _PublicKey {
744
805
  static fromMultibase32(encoded) {
745
806
  invariant4(encoded.startsWith("B"), "Invalid multibase32 encoding", {
746
807
  F: __dxlog_file4,
747
- L: 184,
808
+ L: 185,
748
809
  S: this,
749
810
  A: [
750
811
  "encoded.startsWith('B')",
@@ -753,12 +814,6 @@ var PublicKey = class _PublicKey {
753
814
  });
754
815
  return new _PublicKey(new Uint8Array((0, import_base32_decode3.default)(encoded.slice(1), "RFC4648")));
755
816
  }
756
- constructor(_value) {
757
- this._value = _value;
758
- if (!(_value instanceof Uint8Array)) {
759
- throw new TypeError(`Expected Uint8Array, got: ${_value}`);
760
- }
761
- }
762
817
  toString() {
763
818
  return this.toHex();
764
819
  }
@@ -792,7 +847,7 @@ var PublicKey = class _PublicKey {
792
847
  /**
793
848
  * Used by Node.js to get textual representation of this object when it's printed with a `console.log` statement.
794
849
  */
795
- [inspectCustom2](depth, options, inspectFn) {
850
+ [_inspectCustom2](depth, options, inspectFn) {
796
851
  if (!options.colors || typeof process.stdout.hasColors !== "function" || !process.stdout.hasColors()) {
797
852
  return `<PublicKey ${this.truncate()}>`;
798
853
  }
@@ -817,7 +872,7 @@ var PublicKey = class _PublicKey {
817
872
  const color = colors[this.getInsecureHash(colors.length)];
818
873
  return `PublicKey(${printControlCode(inspectFn.colors[color][0])}${this.truncate()}${printControlCode(inspectFn.colors.reset[0])})`;
819
874
  }
820
- get [devtoolsFormatter2]() {
875
+ get [_devtoolsFormatter2]() {
821
876
  return {
822
877
  header: () => {
823
878
  const colors = [
@@ -870,19 +925,28 @@ var PublicKey = class _PublicKey {
870
925
  }
871
926
  let equal = true;
872
927
  for (let i = 0; i < this._value.length; i++) {
873
- equal &&= this._value[i] === otherConverted._value[i];
928
+ equal && (equal = this._value[i] === otherConverted._value[i]);
874
929
  }
875
930
  return equal;
876
931
  }
877
- [equalsSymbol](other) {
932
+ [_equalsSymbol](other) {
878
933
  if (!_PublicKey.isPublicKey(other)) {
879
934
  return false;
880
935
  }
881
936
  return this.equals(other);
882
937
  }
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
+ }
883
945
  };
946
+ _define_property3(PublicKey, "ZERO", PublicKey.from("00".repeat(PUBLIC_KEY_LENGTH)));
884
947
  export {
885
948
  DXN,
949
+ DXN_ECHO_REGEXP,
886
950
  IdentityDid,
887
951
  LOCAL_SPACE_TAG,
888
952
  ObjectId,