@dxos/keys
Advanced tools
Comparing version 0.6.13 to 0.6.14-main.2b6a0f3
@@ -1,1 +0,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":"@dxos/node-std/crypto","kind":"require-call","external":true}],"format":"esm"},"packages/common/keys/src/public-key.ts":{"bytes":30405,"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/node-std/util","kind":"import-statement","external":true},{"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":8722,"imports":[{"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/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":26397},"packages/common/keys/dist/lib/browser/index.mjs":{"imports":[{"path":"@dxos/node-std/util","kind":"import-statement","external":true},{"path":"@dxos/debug","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/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":7733},"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":214},"packages/common/keys/src/index.ts":{"bytesInOutput":0},"packages/common/keys/src/space-id.ts":{"bytesInOutput":1431},"packages/common/keys/src/dxn.ts":{"bytesInOutput":2074}},"bytes":16917}}} | ||
{"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":"@dxos/node-std/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/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":29352},"packages/common/keys/dist/lib/browser/index.mjs":{"imports":[{"path":"@dxos/debug","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","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":214},"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":17937}}} |
@@ -1,1 +0,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":30405,"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":"node:util","kind":"import-statement","external":true},{"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":8722,"imports":[{"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/index.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":26396},"packages/common/keys/dist/lib/node/index.cjs":{"imports":[{"path":"node:util","kind":"import-statement","external":true},{"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/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":7723},"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":2074}},"bytes":16897}}} | ||
{"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/index.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":29351},"packages/common/keys/dist/lib/node/index.cjs":{"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":17927}}} |
@@ -0,1 +1,3 @@ | ||
import type { inspect, InspectOptionsStylized } from 'node:util'; | ||
import { inspectCustom } from '@dxos/debug'; | ||
/** | ||
@@ -28,2 +30,6 @@ * DXN unambiguously names a resource like an ECHO object, schema definition, plugin, etc. | ||
static parse(dxn: string): DXN; | ||
static equals(a: DXN, b: DXN): boolean; | ||
static isDXNString(dxn: string): boolean; | ||
static typename(type: string): DXN; | ||
static localEchoObjectDXN(id: string): DXN; | ||
constructor(kind: string, parts: string[]); | ||
@@ -33,3 +39,8 @@ get kind(): string; | ||
isTypeDXNOf(typename: string): boolean; | ||
isLocalEchoObjectDXN(): boolean; | ||
toString(): string; | ||
/** | ||
* Used by Node.js to get textual representation of this object when it's printed with a `console.log` statement. | ||
*/ | ||
[inspectCustom](depth: number, options: InspectOptionsStylized, inspectFn: typeof inspect): string; | ||
} | ||
@@ -36,0 +47,0 @@ /** |
@@ -1,3 +0,3 @@ | ||
import { inspect, type InspectOptionsStylized } from 'node:util'; | ||
import { devtoolsFormatter, type DevtoolsFormatter, equalsSymbol, type Equatable } from '@dxos/debug'; | ||
import { type inspect, type InspectOptionsStylized } from 'node:util'; | ||
import { devtoolsFormatter, type DevtoolsFormatter, equalsSymbol, type Equatable, inspectCustom } from '@dxos/debug'; | ||
export declare const PUBLIC_KEY_LENGTH = 32; | ||
@@ -83,3 +83,3 @@ export declare const SECRET_KEY_LENGTH = 64; | ||
*/ | ||
[inspect.custom](depth: number, options: InspectOptionsStylized): string; | ||
[inspectCustom](depth: number, options: InspectOptionsStylized, inspectFn: typeof inspect): string; | ||
get [devtoolsFormatter](): DevtoolsFormatter; | ||
@@ -86,0 +86,0 @@ /** |
{ | ||
"name": "@dxos/keys", | ||
"version": "0.6.13", | ||
"version": "0.6.14-main.2b6a0f3", | ||
"description": "Key utils and definitions.", | ||
@@ -9,2 +9,3 @@ "homepage": "https://dxos.org", | ||
"author": "DXOS.org", | ||
"sideEffects": false, | ||
"exports": { | ||
@@ -14,3 +15,4 @@ ".": { | ||
"node": { | ||
"default": "./dist/lib/node/index.cjs" | ||
"require": "./dist/lib/node/index.cjs", | ||
"default": "./dist/lib/node-esm/index.mjs" | ||
}, | ||
@@ -29,5 +31,5 @@ "types": "./dist/types/src/index.d.ts" | ||
"dependencies": { | ||
"@dxos/debug": "0.6.13", | ||
"@dxos/invariant": "0.6.13", | ||
"@dxos/node-std": "0.6.13" | ||
"@dxos/debug": "0.6.14-main.2b6a0f3", | ||
"@dxos/invariant": "0.6.14-main.2b6a0f3", | ||
"@dxos/node-std": "0.6.14-main.2b6a0f3" | ||
}, | ||
@@ -34,0 +36,0 @@ "devDependencies": { |
@@ -5,2 +5,5 @@ // | ||
import type { inspect, InspectOptionsStylized } from 'node:util'; | ||
import { inspectCustom } from '@dxos/debug'; | ||
import { invariant } from '@dxos/invariant'; | ||
@@ -35,2 +38,5 @@ | ||
static parse(dxn: string): DXN { | ||
if (typeof dxn !== 'string') { | ||
throw new Error('Invalid DXN'); | ||
} | ||
const [prefix, kind, ...parts] = dxn.split(':'); | ||
@@ -49,2 +55,18 @@ if (!(prefix === 'dxn')) { | ||
static equals(a: DXN, b: DXN) { | ||
return a.kind === b.kind && a.parts.length === b.parts.length && a.parts.every((part, i) => part === b.parts[i]); | ||
} | ||
static isDXNString(dxn: string) { | ||
return dxn.startsWith('dxn:'); | ||
} | ||
static typename(type: string) { | ||
return new DXN(DXN.kind.TYPE, [type]); | ||
} | ||
static localEchoObjectDXN(id: string) { | ||
return new DXN(DXN.kind.ECHO, [LOCAL_SPACE_TAG, id]); | ||
} | ||
#kind: string; | ||
@@ -60,6 +82,10 @@ #parts: string[]; | ||
case DXN.kind.ECHO: | ||
invariant(parts.length === 2); | ||
if (parts.length !== 2) { | ||
throw new Error('Invalid "echo" DXN'); | ||
} | ||
break; | ||
case DXN.kind.TYPE: | ||
invariant(parts.length === 1); | ||
if (parts.length !== 1) { | ||
throw new Error('Invalid "type" DXN'); | ||
} | ||
break; | ||
@@ -84,5 +110,22 @@ } | ||
isLocalEchoObjectDXN() { | ||
return this.#kind === DXN.kind.ECHO && this.#parts[0] === LOCAL_SPACE_TAG && this.#parts.length === 2; | ||
} | ||
toString() { | ||
return `dxn:${this.#kind}:${this.#parts.join(':')}`; | ||
} | ||
/** | ||
* Used by Node.js to get textual representation of this object when it's printed with a `console.log` statement. | ||
*/ | ||
[inspectCustom](depth: number, options: InspectOptionsStylized, inspectFn: typeof inspect) { | ||
const printControlCode = (code: number) => { | ||
return `\x1b[${code}m`; | ||
}; | ||
return ( | ||
printControlCode(inspectFn.colors.blueBright![0]) + this.toString() + printControlCode(inspectFn.colors.reset![0]) | ||
); | ||
} | ||
} | ||
@@ -89,0 +132,0 @@ |
@@ -5,4 +5,3 @@ // | ||
import { expect } from 'chai'; | ||
import { describe, test } from 'vitest'; | ||
import { describe, expect, test } from 'vitest'; | ||
@@ -9,0 +8,0 @@ import { PublicKey } from './public-key'; |
@@ -7,5 +7,12 @@ // | ||
import base32Encode from 'base32-encode'; | ||
import { inspect, type InspectOptionsStylized } from 'node:util'; | ||
import { type inspect, type InspectOptionsStylized } from 'node:util'; | ||
import { truncateKey, devtoolsFormatter, type DevtoolsFormatter, equalsSymbol, type Equatable } from '@dxos/debug'; | ||
import { | ||
devtoolsFormatter, | ||
type DevtoolsFormatter, | ||
equalsSymbol, | ||
type Equatable, | ||
inspectCustom, | ||
truncateKey, | ||
} from '@dxos/debug'; | ||
import { invariant } from '@dxos/invariant'; | ||
@@ -24,2 +31,8 @@ | ||
/** | ||
* Vitest with JSDom causes instanceof ArrayBuffer check to fail | ||
*/ | ||
const isLikeArrayBuffer = (value: any): value is ArrayBuffer => | ||
typeof value === 'object' && value !== null && Object.getPrototypeOf(value).constructor.name === 'ArrayBuffer'; | ||
/** | ||
* The purpose of this class is to assure consistent use of keys throughout the project. | ||
@@ -45,3 +58,3 @@ * Keys should be maintained as buffers in objects and proto definitions, and converted to hex | ||
return new PublicKey(source); | ||
} else if (source instanceof ArrayBuffer) { | ||
} else if (source instanceof ArrayBuffer || isLikeArrayBuffer(source)) { | ||
return new PublicKey(new Uint8Array(source)); | ||
@@ -228,3 +241,3 @@ } else if (typeof source === 'string') { | ||
*/ | ||
[inspect.custom](depth: number, options: InspectOptionsStylized) { | ||
[inspectCustom](depth: number, options: InspectOptionsStylized, inspectFn: typeof inspect) { | ||
if (!options.colors || typeof process.stdout.hasColors !== 'function' || !process.stdout.hasColors()) { | ||
@@ -256,4 +269,4 @@ return `<PublicKey ${this.truncate()}>`; | ||
return `PublicKey(${printControlCode(inspect.colors[color]![0])}${this.truncate()}${printControlCode( | ||
inspect.colors.reset![0], | ||
return `PublicKey(${printControlCode(inspectFn.colors[color]![0])}${this.truncate()}${printControlCode( | ||
inspectFn.colors.reset![0], | ||
)})`; | ||
@@ -260,0 +273,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
183512
36
2507
10
+ Added@dxos/debug@0.6.14-main.2b6a0f3(transitive)
+ Added@dxos/node-std@0.6.14-main.2b6a0f3(transitive)
- Removed@dxos/debug@0.6.13(transitive)
- Removed@dxos/node-std@0.6.13(transitive)