@dxos/keys 0.6.13 → 0.6.14-main.2b6a0f3
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 +50 -29
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node/index.cjs +49 -28
- package/dist/lib/node/index.cjs.map +3 -3
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +613 -0
- package/dist/lib/node-esm/index.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -0
- package/dist/types/src/dxn.d.ts +11 -0
- package/dist/types/src/dxn.d.ts.map +1 -1
- package/dist/types/src/public-key.d.ts +3 -3
- package/dist/types/src/public-key.d.ts.map +1 -1
- package/package.json +7 -5
- package/src/dxn.ts +45 -2
- package/src/public-key.test.ts +1 -2
- package/src/public-key.ts +20 -7
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"inputs":{"node_modules/.pnpm/base32-decode@1.0.0/node_modules/base32-decode/index.js":{"bytes":1217,"imports":[],"format":"cjs"},"node_modules/.pnpm/to-data-view@2.0.0/node_modules/to-data-view/index.js":{"bytes":410,"imports":[],"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"}],"format":"esm"},"packages/common/keys/src/random-bytes.ts":{"bytes":1792,"imports":[{"path":"node:crypto","kind":"require-call","external":true}],"format":"esm"},"packages/common/keys/src/public-key.ts":{"bytes":31358,"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":"packages/common/keys/src/random-bytes.ts","kind":"import-statement","original":"./random-bytes"}],"format":"esm"},"packages/common/keys/src/types.ts":{"bytes":528,"imports":[],"format":"esm"},"packages/common/keys/src/space-id.ts":{"bytes":5162,"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":"packages/common/keys/src/random-bytes.ts","kind":"import-statement","original":"./random-bytes"}],"format":"esm"},"packages/common/keys/src/dxn.ts":{"bytes":13066,"imports":[{"path":"@dxos/debug","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true}],"format":"esm"},"packages/common/keys/src/index.ts":{"bytes":746,"imports":[{"path":"packages/common/keys/src/public-key.ts","kind":"import-statement","original":"./public-key"},{"path":"packages/common/keys/src/types.ts","kind":"import-statement","original":"./types"},{"path":"packages/common/keys/src/space-id.ts","kind":"import-statement","original":"./space-id"},{"path":"packages/common/keys/src/dxn.ts","kind":"import-statement","original":"./dxn"}],"format":"esm"}},"outputs":{"packages/common/keys/dist/lib/node-esm/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":29352},"packages/common/keys/dist/lib/node-esm/index.mjs":{"imports":[{"path":"@dxos/debug","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"node: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","LOCAL_SPACE_TAG","PUBLIC_KEY_LENGTH","PublicKey","SECRET_KEY_LENGTH","SpaceId"],"entryPoint":"packages/common/keys/src/index.ts","inputs":{"node_modules/.pnpm/base32-decode@1.0.0/node_modules/base32-decode/index.js":{"bytesInOutput":1554},"packages/common/keys/src/public-key.ts":{"bytesInOutput":7891},"node_modules/.pnpm/to-data-view@2.0.0/node_modules/to-data-view/index.js":{"bytesInOutput":395},"node_modules/.pnpm/base32-encode@2.0.0/node_modules/base32-encode/index.js":{"bytesInOutput":1206},"packages/common/keys/src/random-bytes.ts":{"bytesInOutput":204},"packages/common/keys/src/index.ts":{"bytesInOutput":0},"packages/common/keys/src/space-id.ts":{"bytesInOutput":1431},"packages/common/keys/src/dxn.ts":{"bytesInOutput":2936}},"bytes":18019}}}
|
package/dist/types/src/dxn.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { inspect, InspectOptionsStylized } from 'node:util';
|
|
2
|
+
import { inspectCustom } from '@dxos/debug';
|
|
1
3
|
/**
|
|
2
4
|
* DXN unambiguously names a resource like an ECHO object, schema definition, plugin, etc.
|
|
3
5
|
* Each DXN starts with a dx prefix, followed by a resource kind.
|
|
@@ -25,11 +27,20 @@ export declare class DXN {
|
|
|
25
27
|
TYPE: "type";
|
|
26
28
|
}>;
|
|
27
29
|
static parse(dxn: string): DXN;
|
|
30
|
+
static equals(a: DXN, b: DXN): boolean;
|
|
31
|
+
static isDXNString(dxn: string): boolean;
|
|
32
|
+
static typename(type: string): DXN;
|
|
33
|
+
static localEchoObjectDXN(id: string): DXN;
|
|
28
34
|
constructor(kind: string, parts: string[]);
|
|
29
35
|
get kind(): string;
|
|
30
36
|
get parts(): string[];
|
|
31
37
|
isTypeDXNOf(typename: string): boolean;
|
|
38
|
+
isLocalEchoObjectDXN(): boolean;
|
|
32
39
|
toString(): string;
|
|
40
|
+
/**
|
|
41
|
+
* Used by Node.js to get textual representation of this object when it's printed with a `console.log` statement.
|
|
42
|
+
*/
|
|
43
|
+
[inspectCustom](depth: number, options: InspectOptionsStylized, inspectFn: typeof inspect): string;
|
|
33
44
|
}
|
|
34
45
|
/**
|
|
35
46
|
* Tags for ECHO DXNs that should resolve the object ID in the local space.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dxn.d.ts","sourceRoot":"","sources":["../../../src/dxn.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dxn.d.ts","sourceRoot":"","sources":["../../../src/dxn.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAC;AAEjE,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAG5C;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,GAAG;;IACd;;OAEG;IACH,MAAM,CAAC,IAAI;;;OAGR;IAEH,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG;IAiB9B,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG;IAI5B,MAAM,CAAC,WAAW,CAAC,GAAG,EAAE,MAAM;IAI9B,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM;IAI5B,MAAM,CAAC,kBAAkB,CAAC,EAAE,EAAE,MAAM;gBAOxB,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE;IAsBzC,IAAI,IAAI,WAEP;IAED,IAAI,KAAK,aAER;IAED,WAAW,CAAC,QAAQ,EAAE,MAAM;IAI5B,oBAAoB;IAIpB,QAAQ;IAIR;;OAEG;IACH,CAAC,aAAa,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,sBAAsB,EAAE,SAAS,EAAE,OAAO,OAAO;CAS1F;AAED;;GAEG;AACH,eAAO,MAAM,eAAe,MAAM,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { inspect, type InspectOptionsStylized } from 'node:util';
|
|
2
|
-
import { devtoolsFormatter, type DevtoolsFormatter, equalsSymbol, type Equatable } from '@dxos/debug';
|
|
1
|
+
import { type inspect, type InspectOptionsStylized } from 'node:util';
|
|
2
|
+
import { devtoolsFormatter, type DevtoolsFormatter, equalsSymbol, type Equatable, inspectCustom } from '@dxos/debug';
|
|
3
3
|
export declare const PUBLIC_KEY_LENGTH = 32;
|
|
4
4
|
export declare const SECRET_KEY_LENGTH = 64;
|
|
5
5
|
/**
|
|
@@ -80,7 +80,7 @@ export declare class PublicKey implements Equatable {
|
|
|
80
80
|
/**
|
|
81
81
|
* Used by Node.js to get textual representation of this object when it's printed with a `console.log` statement.
|
|
82
82
|
*/
|
|
83
|
-
[
|
|
83
|
+
[inspectCustom](depth: number, options: InspectOptionsStylized, inspectFn: typeof inspect): string;
|
|
84
84
|
get [devtoolsFormatter](): DevtoolsFormatter;
|
|
85
85
|
/**
|
|
86
86
|
* Test this key for equality with some other key.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"public-key.d.ts","sourceRoot":"","sources":["../../../src/public-key.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,OAAO,EAAE,KAAK,sBAAsB,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"public-key.d.ts","sourceRoot":"","sources":["../../../src/public-key.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,sBAAsB,EAAE,MAAM,WAAW,CAAC;AAEtE,OAAO,EACL,iBAAiB,EACjB,KAAK,iBAAiB,EACtB,YAAY,EACZ,KAAK,SAAS,EACd,aAAa,EAEd,MAAM,aAAa,CAAC;AAKrB,eAAO,MAAM,iBAAiB,KAAK,CAAC;AACpC,eAAO,MAAM,iBAAiB,KAAK,CAAC;AAEpC;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,MAAM,GAAG,UAAU,GAAG,WAAW,GAAG,MAAM,CAAC;AAQnF;;;;GAIG;AACH,qBAAa,SAAU,YAAW,SAAS;IAqJ7B,OAAO,CAAC,QAAQ,CAAC,MAAM;IApJnC,MAAM,CAAC,IAAI,YAAkD;IAE7D;;;;OAIG;IACH,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,aAAa,GAAG,SAAS;IAoB7C;;;;OAIG;IACH,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,aAAa,GAAG,SAAS,GAAG,SAAS;IAiB9D;;OAEG;IACH,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,MAAM;IAU1B;;OAEG;IACH,MAAM,CAAC,MAAM,IAAI,SAAS;IAK1B,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS;IAIhD,MAAM,CAAE,cAAc,IAAI,SAAS,CAAC,SAAS,CAAC;IAQ9C;;OAEG;IACH,MAAM,CAAC,WAAW,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,SAAS;IAIlD;;OAEG;IACH,MAAM,CAAC,oBAAoB,CAAC,KAAK,EAAE,GAAG,GAAG,OAAO,CAAC,KAAK,IAAI,SAAS;IAMnE;;OAEG;IACH,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,aAAa,EAAE,KAAK,EAAE,aAAa;IAIvD;;;;OAIG;IACH,MAAM,CAAC,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM;IAQrC;;;;OAIG;IACH,MAAM,CAAC,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,GAAG,WAAW,GAAG,MAAM;IAWhE;;;OAGG;IACH,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,SAAS,GAAG,MAAM;IAInC,MAAM,CAAC,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS;gBAMrB,MAAM,EAAE,UAAU;IAM/C,QAAQ,IAAI,MAAM;IAIlB,MAAM;IAIN,OAAO,IAAI,MAAM;IAIjB,IAAI,MAAM,WAET;IAED,KAAK,IAAI,MAAM;IAIf,aAAa,IAAI,MAAM;IAIvB,QAAQ,CAAC,MAAM,YAAY;IAI3B,QAAQ,IAAI,MAAM;IAIlB,YAAY,IAAI,UAAU;IAI1B,eAAe,CAAC,MAAM,EAAE,MAAM;IAI9B;;OAEG;IACH,CAAC,aAAa,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,sBAAsB,EAAE,SAAS,EAAE,OAAO,OAAO;IAgCzF,IAAI,CAAC,iBAAiB,CAAC,IAAI,iBAAiB,CA8B3C;IAED;;OAEG;IACH,MAAM,CAAC,KAAK,EAAE,aAAa;IAc3B,CAAC,YAAY,CAAC,CAAC,KAAK,EAAE,GAAG;CAO1B"}
|
package/package.json
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/keys",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.14-main.2b6a0f3",
|
|
4
4
|
"description": "Key utils and definitions.",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"author": "DXOS.org",
|
|
9
|
+
"sideEffects": false,
|
|
9
10
|
"exports": {
|
|
10
11
|
".": {
|
|
11
12
|
"browser": "./dist/lib/browser/index.mjs",
|
|
12
13
|
"node": {
|
|
13
|
-
"
|
|
14
|
+
"require": "./dist/lib/node/index.cjs",
|
|
15
|
+
"default": "./dist/lib/node-esm/index.mjs"
|
|
14
16
|
},
|
|
15
17
|
"types": "./dist/types/src/index.d.ts"
|
|
16
18
|
}
|
|
@@ -24,9 +26,9 @@
|
|
|
24
26
|
"src"
|
|
25
27
|
],
|
|
26
28
|
"dependencies": {
|
|
27
|
-
"@dxos/debug": "0.6.
|
|
28
|
-
"@dxos/invariant": "0.6.
|
|
29
|
-
"@dxos/node-std": "0.6.
|
|
29
|
+
"@dxos/debug": "0.6.14-main.2b6a0f3",
|
|
30
|
+
"@dxos/invariant": "0.6.14-main.2b6a0f3",
|
|
31
|
+
"@dxos/node-std": "0.6.14-main.2b6a0f3"
|
|
30
32
|
},
|
|
31
33
|
"devDependencies": {
|
|
32
34
|
"base32-decode": "^1.0.0",
|
package/src/dxn.ts
CHANGED
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import type { inspect, InspectOptionsStylized } from 'node:util';
|
|
6
|
+
|
|
7
|
+
import { inspectCustom } from '@dxos/debug';
|
|
5
8
|
import { invariant } from '@dxos/invariant';
|
|
6
9
|
|
|
7
10
|
/**
|
|
@@ -31,6 +34,9 @@ export class DXN {
|
|
|
31
34
|
});
|
|
32
35
|
|
|
33
36
|
static parse(dxn: string): DXN {
|
|
37
|
+
if (typeof dxn !== 'string') {
|
|
38
|
+
throw new Error('Invalid DXN');
|
|
39
|
+
}
|
|
34
40
|
const [prefix, kind, ...parts] = dxn.split(':');
|
|
35
41
|
if (!(prefix === 'dxn')) {
|
|
36
42
|
throw new Error('Invalid DXN');
|
|
@@ -44,6 +50,22 @@ export class DXN {
|
|
|
44
50
|
return new DXN(kind, parts);
|
|
45
51
|
}
|
|
46
52
|
|
|
53
|
+
static equals(a: DXN, b: DXN) {
|
|
54
|
+
return a.kind === b.kind && a.parts.length === b.parts.length && a.parts.every((part, i) => part === b.parts[i]);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
static isDXNString(dxn: string) {
|
|
58
|
+
return dxn.startsWith('dxn:');
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
static typename(type: string) {
|
|
62
|
+
return new DXN(DXN.kind.TYPE, [type]);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
static localEchoObjectDXN(id: string) {
|
|
66
|
+
return new DXN(DXN.kind.ECHO, [LOCAL_SPACE_TAG, id]);
|
|
67
|
+
}
|
|
68
|
+
|
|
47
69
|
#kind: string;
|
|
48
70
|
#parts: string[];
|
|
49
71
|
|
|
@@ -54,10 +76,14 @@ export class DXN {
|
|
|
54
76
|
// Per-type validation.
|
|
55
77
|
switch (kind) {
|
|
56
78
|
case DXN.kind.ECHO:
|
|
57
|
-
|
|
79
|
+
if (parts.length !== 2) {
|
|
80
|
+
throw new Error('Invalid "echo" DXN');
|
|
81
|
+
}
|
|
58
82
|
break;
|
|
59
83
|
case DXN.kind.TYPE:
|
|
60
|
-
|
|
84
|
+
if (parts.length !== 1) {
|
|
85
|
+
throw new Error('Invalid "type" DXN');
|
|
86
|
+
}
|
|
61
87
|
break;
|
|
62
88
|
}
|
|
63
89
|
|
|
@@ -77,9 +103,26 @@ export class DXN {
|
|
|
77
103
|
return this.#kind === DXN.kind.TYPE && this.#parts.length === 1 && this.#parts[0] === typename;
|
|
78
104
|
}
|
|
79
105
|
|
|
106
|
+
isLocalEchoObjectDXN() {
|
|
107
|
+
return this.#kind === DXN.kind.ECHO && this.#parts[0] === LOCAL_SPACE_TAG && this.#parts.length === 2;
|
|
108
|
+
}
|
|
109
|
+
|
|
80
110
|
toString() {
|
|
81
111
|
return `dxn:${this.#kind}:${this.#parts.join(':')}`;
|
|
82
112
|
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Used by Node.js to get textual representation of this object when it's printed with a `console.log` statement.
|
|
116
|
+
*/
|
|
117
|
+
[inspectCustom](depth: number, options: InspectOptionsStylized, inspectFn: typeof inspect) {
|
|
118
|
+
const printControlCode = (code: number) => {
|
|
119
|
+
return `\x1b[${code}m`;
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
return (
|
|
123
|
+
printControlCode(inspectFn.colors.blueBright![0]) + this.toString() + printControlCode(inspectFn.colors.reset![0])
|
|
124
|
+
);
|
|
125
|
+
}
|
|
83
126
|
}
|
|
84
127
|
|
|
85
128
|
/**
|
package/src/public-key.test.ts
CHANGED
package/src/public-key.ts
CHANGED
|
@@ -4,9 +4,16 @@
|
|
|
4
4
|
|
|
5
5
|
import base32Decode from 'base32-decode';
|
|
6
6
|
import base32Encode from 'base32-encode';
|
|
7
|
-
import { inspect, type InspectOptionsStylized } from 'node:util';
|
|
8
|
-
|
|
9
|
-
import {
|
|
7
|
+
import { type inspect, type InspectOptionsStylized } from 'node:util';
|
|
8
|
+
|
|
9
|
+
import {
|
|
10
|
+
devtoolsFormatter,
|
|
11
|
+
type DevtoolsFormatter,
|
|
12
|
+
equalsSymbol,
|
|
13
|
+
type Equatable,
|
|
14
|
+
inspectCustom,
|
|
15
|
+
truncateKey,
|
|
16
|
+
} from '@dxos/debug';
|
|
10
17
|
import { invariant } from '@dxos/invariant';
|
|
11
18
|
|
|
12
19
|
import { randomBytes } from './random-bytes';
|
|
@@ -19,6 +26,12 @@ export const SECRET_KEY_LENGTH = 64;
|
|
|
19
26
|
*/
|
|
20
27
|
export type PublicKeyLike = PublicKey | Buffer | Uint8Array | ArrayBuffer | string;
|
|
21
28
|
|
|
29
|
+
/**
|
|
30
|
+
* Vitest with JSDom causes instanceof ArrayBuffer check to fail
|
|
31
|
+
*/
|
|
32
|
+
const isLikeArrayBuffer = (value: any): value is ArrayBuffer =>
|
|
33
|
+
typeof value === 'object' && value !== null && Object.getPrototypeOf(value).constructor.name === 'ArrayBuffer';
|
|
34
|
+
|
|
22
35
|
/**
|
|
23
36
|
* The purpose of this class is to assure consistent use of keys throughout the project.
|
|
24
37
|
* Keys should be maintained as buffers in objects and proto definitions, and converted to hex
|
|
@@ -40,7 +53,7 @@ export class PublicKey implements Equatable {
|
|
|
40
53
|
return new PublicKey(new Uint8Array(source.buffer, source.byteOffset, source.byteLength));
|
|
41
54
|
} else if (source instanceof Uint8Array) {
|
|
42
55
|
return new PublicKey(source);
|
|
43
|
-
} else if (source instanceof ArrayBuffer) {
|
|
56
|
+
} else if (source instanceof ArrayBuffer || isLikeArrayBuffer(source)) {
|
|
44
57
|
return new PublicKey(new Uint8Array(source));
|
|
45
58
|
} else if (typeof source === 'string') {
|
|
46
59
|
// TODO(burdon): Check length.
|
|
@@ -222,7 +235,7 @@ export class PublicKey implements Equatable {
|
|
|
222
235
|
/**
|
|
223
236
|
* Used by Node.js to get textual representation of this object when it's printed with a `console.log` statement.
|
|
224
237
|
*/
|
|
225
|
-
[
|
|
238
|
+
[inspectCustom](depth: number, options: InspectOptionsStylized, inspectFn: typeof inspect) {
|
|
226
239
|
if (!options.colors || typeof process.stdout.hasColors !== 'function' || !process.stdout.hasColors()) {
|
|
227
240
|
return `<PublicKey ${this.truncate()}>`;
|
|
228
241
|
}
|
|
@@ -249,8 +262,8 @@ export class PublicKey implements Equatable {
|
|
|
249
262
|
];
|
|
250
263
|
const color = colors[this.getInsecureHash(colors.length)];
|
|
251
264
|
|
|
252
|
-
return `PublicKey(${printControlCode(
|
|
253
|
-
|
|
265
|
+
return `PublicKey(${printControlCode(inspectFn.colors[color]![0])}${this.truncate()}${printControlCode(
|
|
266
|
+
inspectFn.colors.reset![0],
|
|
254
267
|
)})`;
|
|
255
268
|
}
|
|
256
269
|
|