@dxos/keys 0.8.4-main.f9ba587 → 0.8.4-main.fd6878d
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/dist/lib/browser/index.mjs +114 -144
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +114 -144
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/dxn.d.ts +11 -2
- package/dist/types/src/dxn.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +1 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/public-key.d.ts +2 -2
- package/dist/types/src/public-key.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +8 -10
- package/src/dxn.ts +35 -11
- package/src/index.ts +1 -1
- package/src/object-id.ts +2 -2
- package/src/public-key.ts +4 -3
- package/src/random-bytes.ts +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"inject-globals:@inject-globals":{"bytes":324,"imports":[{"path":"@dxos/node-std/inject-globals","kind":"import-statement","external":true}],"format":"esm"},"src/object-id.ts":{"bytes":
|
|
1
|
+
{"inputs":{"inject-globals:@inject-globals":{"bytes":324,"imports":[{"path":"@dxos/node-std/inject-globals","kind":"import-statement","external":true}],"format":"esm"},"src/object-id.ts":{"bytes":3441,"imports":[{"path":"effect","kind":"import-statement","external":true},{"path":"ulidx","kind":"import-statement","external":true},{"path":"@inject-globals","kind":"import-statement","external":true}],"format":"esm"},"../../../node_modules/.pnpm/base32-decode@1.0.0/node_modules/base32-decode/index.js":{"bytes":1217,"imports":[{"path":"@inject-globals","kind":"import-statement","external":true}],"format":"cjs"},"../../../node_modules/.pnpm/to-data-view@2.0.0/node_modules/to-data-view/index.js":{"bytes":410,"imports":[{"path":"@inject-globals","kind":"import-statement","external":true}],"format":"esm"},"../../../node_modules/.pnpm/base32-encode@2.0.0/node_modules/base32-encode/index.js":{"bytes":1266,"imports":[{"path":"../../../node_modules/.pnpm/to-data-view@2.0.0/node_modules/to-data-view/index.js","kind":"import-statement","original":"to-data-view"},{"path":"@inject-globals","kind":"import-statement","external":true}],"format":"esm"},"src/random-bytes.ts":{"bytes":1746,"imports":[{"path":"@inject-globals","kind":"import-statement","external":true},{"path":"@dxos/node-std/crypto","kind":"require-call","external":true}],"format":"esm"},"src/space-id.ts":{"bytes":5978,"imports":[{"path":"../../../node_modules/.pnpm/base32-decode@1.0.0/node_modules/base32-decode/index.js","kind":"import-statement","original":"base32-decode"},{"path":"../../../node_modules/.pnpm/base32-encode@2.0.0/node_modules/base32-encode/index.js","kind":"import-statement","original":"base32-encode"},{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"src/random-bytes.ts","kind":"import-statement","original":"./random-bytes"},{"path":"@inject-globals","kind":"import-statement","external":true}],"format":"esm"},"src/dxn.ts":{"bytes":30537,"imports":[{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/debug","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"src/object-id.ts","kind":"import-statement","original":"./object-id"},{"path":"src/space-id.ts","kind":"import-statement","original":"./space-id"},{"path":"@inject-globals","kind":"import-statement","external":true}],"format":"esm"},"src/identity-did.ts":{"bytes":5438,"imports":[{"path":"../../../node_modules/.pnpm/base32-decode@1.0.0/node_modules/base32-decode/index.js","kind":"import-statement","original":"base32-decode"},{"path":"../../../node_modules/.pnpm/base32-encode@2.0.0/node_modules/base32-encode/index.js","kind":"import-statement","original":"base32-encode"},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"src/random-bytes.ts","kind":"import-statement","original":"./random-bytes"},{"path":"@inject-globals","kind":"import-statement","external":true}],"format":"esm"},"src/public-key.ts":{"bytes":30965,"imports":[{"path":"../../../node_modules/.pnpm/base32-decode@1.0.0/node_modules/base32-decode/index.js","kind":"import-statement","original":"base32-decode"},{"path":"../../../node_modules/.pnpm/base32-encode@2.0.0/node_modules/base32-encode/index.js","kind":"import-statement","original":"base32-encode"},{"path":"@dxos/debug","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"src/random-bytes.ts","kind":"import-statement","original":"./random-bytes"},{"path":"@inject-globals","kind":"import-statement","external":true}],"format":"esm"},"src/index.ts":{"bytes":849,"imports":[{"path":"src/dxn.ts","kind":"import-statement","original":"./dxn"},{"path":"src/identity-did.ts","kind":"import-statement","original":"./identity-did"},{"path":"src/object-id.ts","kind":"import-statement","original":"./object-id"},{"path":"src/public-key.ts","kind":"import-statement","original":"./public-key"},{"path":"src/space-id.ts","kind":"import-statement","original":"./space-id"},{"path":"@inject-globals","kind":"import-statement","external":true}],"format":"esm"}},"outputs":{"dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":44082},"dist/lib/browser/index.mjs":{"imports":[{"path":"@dxos/node-std/inject-globals","kind":"import-statement","external":true},{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/debug","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"effect","kind":"import-statement","external":true},{"path":"ulidx","kind":"import-statement","external":true},{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/node-std/crypto","kind":"require-call","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/debug","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true}],"exports":["DXN","DXN_ECHO_REGEXP","IdentityDid","LOCAL_SPACE_TAG","ObjectId","PUBLIC_KEY_LENGTH","PublicKey","QueueSubspaceTags","SECRET_KEY_LENGTH","SpaceId"],"entryPoint":"src/index.ts","inputs":{"inject-globals:@inject-globals":{"bytesInOutput":171},"../../../node_modules/.pnpm/base32-decode@1.0.0/node_modules/base32-decode/index.js":{"bytesInOutput":1590},"src/index.ts":{"bytesInOutput":23},"src/dxn.ts":{"bytesInOutput":7042},"src/object-id.ts":{"bytesInOutput":541},"src/space-id.ts":{"bytesInOutput":1563},"../../../node_modules/.pnpm/base32-encode@2.0.0/node_modules/base32-encode/index.js":{"bytesInOutput":1229},"../../../node_modules/.pnpm/to-data-view@2.0.0/node_modules/to-data-view/index.js":{"bytesInOutput":418},"src/random-bytes.ts":{"bytesInOutput":237},"src/identity-did.ts":{"bytesInOutput":1557},"src/public-key.ts":{"bytesInOutput":7972}},"bytes":24936}}}
|
|
@@ -84,13 +84,13 @@ var require_base32_decode = __commonJS({
|
|
|
84
84
|
// src/dxn.ts
|
|
85
85
|
import { Schema as Schema3 } from "effect";
|
|
86
86
|
import { devtoolsFormatter, inspectCustom } from "@dxos/debug";
|
|
87
|
-
import { invariant as invariant2 } from "@dxos/invariant";
|
|
87
|
+
import { assertArgument, invariant as invariant2 } from "@dxos/invariant";
|
|
88
88
|
|
|
89
89
|
// src/object-id.ts
|
|
90
90
|
import { Schema } from "effect";
|
|
91
91
|
import { ulid } from "ulidx";
|
|
92
92
|
var ObjectIdSchema = Schema.String.pipe(Schema.pattern(/^[0-7][0-9A-HJKMNP-TV-Z]{25}$/i)).annotations({
|
|
93
|
-
description: "
|
|
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 {
|
|
@@ -98,7 +98,7 @@ var ObjectId = class extends ObjectIdSchema {
|
|
|
98
98
|
try {
|
|
99
99
|
Schema.decodeSync(ObjectId)(id);
|
|
100
100
|
return true;
|
|
101
|
-
} catch
|
|
101
|
+
} catch {
|
|
102
102
|
return false;
|
|
103
103
|
}
|
|
104
104
|
}
|
|
@@ -189,108 +189,96 @@ var isValid = (value) => {
|
|
|
189
189
|
return typeof value === "string" && value.startsWith(MULTIBASE_PREFIX) && value.length === ENCODED_LENGTH;
|
|
190
190
|
};
|
|
191
191
|
var SpaceId = class extends Schema2.String.pipe(Schema2.filter(isValid)) {
|
|
192
|
-
static
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
};
|
|
231
|
-
}
|
|
232
|
-
static {
|
|
233
|
-
this.isValid = isValid;
|
|
234
|
-
}
|
|
235
|
-
static {
|
|
236
|
-
this.random = () => {
|
|
237
|
-
return SpaceId.encode(randomBytes(SpaceId.byteLength));
|
|
238
|
-
};
|
|
239
|
-
}
|
|
192
|
+
static byteLength = 20;
|
|
193
|
+
static encode = (value) => {
|
|
194
|
+
invariant(value instanceof Uint8Array, "Invalid type", {
|
|
195
|
+
F: __dxlog_file,
|
|
196
|
+
L: 43,
|
|
197
|
+
S: this,
|
|
198
|
+
A: [
|
|
199
|
+
"value instanceof Uint8Array",
|
|
200
|
+
"'Invalid type'"
|
|
201
|
+
]
|
|
202
|
+
});
|
|
203
|
+
invariant(value.length === SpaceId.byteLength, "Invalid length", {
|
|
204
|
+
F: __dxlog_file,
|
|
205
|
+
L: 44,
|
|
206
|
+
S: this,
|
|
207
|
+
A: [
|
|
208
|
+
"value.length === SpaceId.byteLength",
|
|
209
|
+
"'Invalid length'"
|
|
210
|
+
]
|
|
211
|
+
});
|
|
212
|
+
return MULTIBASE_PREFIX + base32Encode(value, "RFC4648");
|
|
213
|
+
};
|
|
214
|
+
static decode = (value) => {
|
|
215
|
+
invariant(value.startsWith(MULTIBASE_PREFIX), "Invalid multibase32 encoding", {
|
|
216
|
+
F: __dxlog_file,
|
|
217
|
+
L: 49,
|
|
218
|
+
S: this,
|
|
219
|
+
A: [
|
|
220
|
+
"value.startsWith(MULTIBASE_PREFIX)",
|
|
221
|
+
"'Invalid multibase32 encoding'"
|
|
222
|
+
]
|
|
223
|
+
});
|
|
224
|
+
return new Uint8Array((0, import_base32_decode.default)(value.slice(1), "RFC4648"));
|
|
225
|
+
};
|
|
226
|
+
static isValid = isValid;
|
|
227
|
+
static random = () => {
|
|
228
|
+
return SpaceId.encode(randomBytes(SpaceId.byteLength));
|
|
229
|
+
};
|
|
240
230
|
};
|
|
241
231
|
|
|
242
232
|
// src/dxn.ts
|
|
243
233
|
var __dxlog_file2 = "/__w/dxos/dxos/packages/common/keys/src/dxn.ts";
|
|
244
234
|
var LOCAL_SPACE_TAG = "@";
|
|
235
|
+
var DXN_ECHO_REGEXP = /@(dxn:[a-zA-Z0-p:@]+)/;
|
|
245
236
|
var QueueSubspaceTags = Object.freeze({
|
|
246
237
|
DATA: "data",
|
|
247
238
|
TRACE: "trace"
|
|
248
239
|
});
|
|
249
240
|
var DXN = class _DXN {
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
}
|
|
241
|
+
// TODO(burdon): Rename to DXN (i.e., DXN.DXN).
|
|
242
|
+
// TODO(dmaretskyi): Should this be a transformation into the DXN type?
|
|
243
|
+
static Schema = Schema3.NonEmptyString.pipe(
|
|
244
|
+
Schema3.pattern(/^dxn:([^:]+):(?:[^:]+:?)+[^:]$/),
|
|
245
|
+
// TODO(dmaretskyi): To set the format we need to move the annotation IDs out of the echo-schema package.
|
|
246
|
+
// FormatAnnotation.set(FormatEnum.DXN),
|
|
247
|
+
Schema3.annotations({
|
|
248
|
+
title: "DXN",
|
|
249
|
+
description: "DXN URI",
|
|
250
|
+
examples: [
|
|
251
|
+
"dxn:type:example.com/type/MyType",
|
|
252
|
+
"dxn:echo:@:01J00J9B45YHYSGZQTQMSKMGJ6"
|
|
253
|
+
]
|
|
254
|
+
})
|
|
255
|
+
);
|
|
266
256
|
static hash(dxn) {
|
|
267
257
|
return dxn.toString();
|
|
268
258
|
}
|
|
269
|
-
|
|
259
|
+
/**
|
|
260
|
+
* Kind constants.
|
|
261
|
+
*/
|
|
262
|
+
static kind = Object.freeze({
|
|
270
263
|
/**
|
|
271
|
-
*
|
|
264
|
+
* dxn:type:<type name>[:<version>]
|
|
272
265
|
*/
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
* dxn:queue:trace:BA25QRC2FEWCSAMRP4RZL65LWJ7352CKE:01J00J9B45YHYSGZQTQMSKMGJ6
|
|
290
|
-
*/
|
|
291
|
-
QUEUE: "queue"
|
|
292
|
-
});
|
|
293
|
-
}
|
|
266
|
+
TYPE: "type",
|
|
267
|
+
/**
|
|
268
|
+
* dxn:echo:<space id>:<echo id>
|
|
269
|
+
* dxn:echo:@:<echo id>
|
|
270
|
+
*/
|
|
271
|
+
// TODO(burdon): Rename to OBJECT? (BREAKING CHANGE).
|
|
272
|
+
// TODO(burdon): Add separate Kind for space.
|
|
273
|
+
ECHO: "echo",
|
|
274
|
+
/**
|
|
275
|
+
* The subspace tag enables us to partition queues by usage within the context of a space.
|
|
276
|
+
* dxn:queue:<subspace_tag>:<space_id>:<queue_id>[:object_id]
|
|
277
|
+
* dxn:queue:data:BA25QRC2FEWCSAMRP4RZL65LWJ7352CKE:01J00J9B45YHYSGZQTQMSKMGJ6
|
|
278
|
+
* dxn:queue:trace:BA25QRC2FEWCSAMRP4RZL65LWJ7352CKE:01J00J9B45YHYSGZQTQMSKMGJ6
|
|
279
|
+
*/
|
|
280
|
+
QUEUE: "queue"
|
|
281
|
+
});
|
|
294
282
|
get kind() {
|
|
295
283
|
return this.#kind;
|
|
296
284
|
}
|
|
@@ -320,7 +308,7 @@ var DXN = class _DXN {
|
|
|
320
308
|
static tryParse(dxn) {
|
|
321
309
|
try {
|
|
322
310
|
return _DXN.parse(dxn);
|
|
323
|
-
} catch
|
|
311
|
+
} catch {
|
|
324
312
|
return void 0;
|
|
325
313
|
}
|
|
326
314
|
}
|
|
@@ -343,42 +331,30 @@ var DXN = class _DXN {
|
|
|
343
331
|
]);
|
|
344
332
|
}
|
|
345
333
|
/**
|
|
334
|
+
* @example `dxn:echo:BA25QRC2FEWCSAMRP4RZL65LWJ7352CKE:01J00J9B45YHYSGZQTQMSKMGJ6`
|
|
335
|
+
*/
|
|
336
|
+
static fromSpaceAndObjectId(spaceId, objectId) {
|
|
337
|
+
assertArgument(SpaceId.isValid(spaceId), `Invalid space ID: ${spaceId}`);
|
|
338
|
+
assertArgument(ObjectId.isValid(objectId), `Invalid object ID: ${objectId}`);
|
|
339
|
+
return new _DXN(_DXN.kind.ECHO, [
|
|
340
|
+
spaceId,
|
|
341
|
+
objectId
|
|
342
|
+
]);
|
|
343
|
+
}
|
|
344
|
+
/**
|
|
346
345
|
* @example `dxn:echo:@:01J00J9B45YHYSGZQTQMSKMGJ6`
|
|
347
346
|
*/
|
|
348
347
|
static fromLocalObjectId(id) {
|
|
348
|
+
assertArgument(ObjectId.isValid(id), `Invalid object ID: ${id}`);
|
|
349
349
|
return new _DXN(_DXN.kind.ECHO, [
|
|
350
350
|
LOCAL_SPACE_TAG,
|
|
351
351
|
id
|
|
352
352
|
]);
|
|
353
353
|
}
|
|
354
354
|
static fromQueue(subspaceTag, spaceId, queueId, objectId) {
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
S: this,
|
|
359
|
-
A: [
|
|
360
|
-
"SpaceId.isValid(spaceId)",
|
|
361
|
-
""
|
|
362
|
-
]
|
|
363
|
-
});
|
|
364
|
-
invariant2(ObjectId.isValid(queueId), void 0, {
|
|
365
|
-
F: __dxlog_file2,
|
|
366
|
-
L: 151,
|
|
367
|
-
S: this,
|
|
368
|
-
A: [
|
|
369
|
-
"ObjectId.isValid(queueId)",
|
|
370
|
-
""
|
|
371
|
-
]
|
|
372
|
-
});
|
|
373
|
-
invariant2(!objectId || ObjectId.isValid(objectId), void 0, {
|
|
374
|
-
F: __dxlog_file2,
|
|
375
|
-
L: 152,
|
|
376
|
-
S: this,
|
|
377
|
-
A: [
|
|
378
|
-
"!objectId || ObjectId.isValid(objectId)",
|
|
379
|
-
""
|
|
380
|
-
]
|
|
381
|
-
});
|
|
355
|
+
assertArgument(SpaceId.isValid(spaceId), `Invalid space ID: ${spaceId}`);
|
|
356
|
+
assertArgument(ObjectId.isValid(queueId), `Invalid queue ID: ${queueId}`);
|
|
357
|
+
assertArgument(!objectId || ObjectId.isValid(objectId), `Invalid object ID: ${objectId}`);
|
|
382
358
|
return new _DXN(_DXN.kind.QUEUE, [
|
|
383
359
|
subspaceTag,
|
|
384
360
|
spaceId,
|
|
@@ -391,24 +367,8 @@ var DXN = class _DXN {
|
|
|
391
367
|
#kind;
|
|
392
368
|
#parts;
|
|
393
369
|
constructor(kind, parts) {
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
L: 161,
|
|
397
|
-
S: this,
|
|
398
|
-
A: [
|
|
399
|
-
"parts.length > 0",
|
|
400
|
-
""
|
|
401
|
-
]
|
|
402
|
-
});
|
|
403
|
-
invariant2(parts.every((part) => typeof part === "string" && part.length > 0 && part.indexOf(":") === -1), void 0, {
|
|
404
|
-
F: __dxlog_file2,
|
|
405
|
-
L: 162,
|
|
406
|
-
S: this,
|
|
407
|
-
A: [
|
|
408
|
-
"parts.every((part) => typeof part === 'string' && part.length > 0 && part.indexOf(':') === -1)",
|
|
409
|
-
""
|
|
410
|
-
]
|
|
411
|
-
});
|
|
370
|
+
assertArgument(parts.length > 0, `Invalid DXN: ${parts}`);
|
|
371
|
+
assertArgument(parts.every((part) => typeof part === "string" && part.length > 0 && part.indexOf(":") === -1), `Invalid DXN: ${parts}`);
|
|
412
372
|
switch (kind) {
|
|
413
373
|
case _DXN.kind.TYPE:
|
|
414
374
|
if (parts.length > 2) {
|
|
@@ -459,7 +419,7 @@ var DXN = class _DXN {
|
|
|
459
419
|
get typename() {
|
|
460
420
|
invariant2(this.#kind === _DXN.kind.TYPE, void 0, {
|
|
461
421
|
F: __dxlog_file2,
|
|
462
|
-
L:
|
|
422
|
+
L: 234,
|
|
463
423
|
S: this,
|
|
464
424
|
A: [
|
|
465
425
|
"this.#kind === DXN.kind.TYPE",
|
|
@@ -480,6 +440,7 @@ var DXN = class _DXN {
|
|
|
480
440
|
}
|
|
481
441
|
const [type, version] = this.#parts;
|
|
482
442
|
return {
|
|
443
|
+
// TODO(wittjosiah): Should be `typename` for consistency.
|
|
483
444
|
type,
|
|
484
445
|
version
|
|
485
446
|
};
|
|
@@ -509,6 +470,15 @@ var DXN = class _DXN {
|
|
|
509
470
|
objectId
|
|
510
471
|
};
|
|
511
472
|
}
|
|
473
|
+
/**
|
|
474
|
+
* Produces a new DXN with the given parts appended.
|
|
475
|
+
*/
|
|
476
|
+
extend(parts) {
|
|
477
|
+
return new _DXN(this.#kind, [
|
|
478
|
+
...this.#parts,
|
|
479
|
+
...parts
|
|
480
|
+
]);
|
|
481
|
+
}
|
|
512
482
|
};
|
|
513
483
|
|
|
514
484
|
// src/identity-did.ts
|
|
@@ -570,9 +540,8 @@ var PUBLIC_KEY_LENGTH = 32;
|
|
|
570
540
|
var SECRET_KEY_LENGTH = 64;
|
|
571
541
|
var isLikeArrayBuffer = (value) => typeof value === "object" && value !== null && Object.getPrototypeOf(value).constructor.name === "ArrayBuffer";
|
|
572
542
|
var PublicKey = class _PublicKey {
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
}
|
|
543
|
+
_value;
|
|
544
|
+
static ZERO = _PublicKey.from("00".repeat(PUBLIC_KEY_LENGTH));
|
|
576
545
|
/**
|
|
577
546
|
* Creates new instance of PublicKey automatically determining the input format.
|
|
578
547
|
* @param source A Buffer, or Uint8Array, or hex encoded string, or something with an `asUint8Array` method on it
|
|
@@ -581,7 +550,7 @@ var PublicKey = class _PublicKey {
|
|
|
581
550
|
static from(source) {
|
|
582
551
|
invariant4(source, void 0, {
|
|
583
552
|
F: __dxlog_file4,
|
|
584
|
-
L:
|
|
553
|
+
L: 50,
|
|
585
554
|
S: this,
|
|
586
555
|
A: [
|
|
587
556
|
"source",
|
|
@@ -673,7 +642,7 @@ var PublicKey = class _PublicKey {
|
|
|
673
642
|
static bufferize(str) {
|
|
674
643
|
invariant4(typeof str === "string", "Invalid type", {
|
|
675
644
|
F: __dxlog_file4,
|
|
676
|
-
L:
|
|
645
|
+
L: 153,
|
|
677
646
|
S: this,
|
|
678
647
|
A: [
|
|
679
648
|
"typeof str === 'string'",
|
|
@@ -696,7 +665,7 @@ var PublicKey = class _PublicKey {
|
|
|
696
665
|
}
|
|
697
666
|
invariant4(key instanceof Buffer, "Invalid type", {
|
|
698
667
|
F: __dxlog_file4,
|
|
699
|
-
L:
|
|
668
|
+
L: 172,
|
|
700
669
|
S: this,
|
|
701
670
|
A: [
|
|
702
671
|
"key instanceof Buffer",
|
|
@@ -715,7 +684,7 @@ var PublicKey = class _PublicKey {
|
|
|
715
684
|
static fromMultibase32(encoded) {
|
|
716
685
|
invariant4(encoded.startsWith("B"), "Invalid multibase32 encoding", {
|
|
717
686
|
F: __dxlog_file4,
|
|
718
|
-
L:
|
|
687
|
+
L: 185,
|
|
719
688
|
S: this,
|
|
720
689
|
A: [
|
|
721
690
|
"encoded.startsWith('B')",
|
|
@@ -854,6 +823,7 @@ var PublicKey = class _PublicKey {
|
|
|
854
823
|
};
|
|
855
824
|
export {
|
|
856
825
|
DXN,
|
|
826
|
+
DXN_ECHO_REGEXP,
|
|
857
827
|
IdentityDid,
|
|
858
828
|
LOCAL_SPACE_TAG,
|
|
859
829
|
ObjectId,
|