@dxos/keys
Advanced tools
Comparing version 0.6.11 to 0.6.12-main.5cc132e
@@ -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":31290,"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":9593,"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":27271},"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":7909},"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":2292}},"bytes":17311}}} |
@@ -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":31290,"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":9593,"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":27270},"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":7899},"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":2292}},"bytes":17291}}} |
@@ -32,2 +32,3 @@ /** | ||
isTypeDXNOf(typename: string): boolean; | ||
isLocalEchoObjectDXN(): boolean; | ||
toString(): string; | ||
@@ -34,0 +35,0 @@ } |
{ | ||
"name": "@dxos/keys", | ||
"version": "0.6.11", | ||
"version": "0.6.12-main.5cc132e", | ||
"description": "Key utils and definitions.", | ||
@@ -13,3 +13,4 @@ "homepage": "https://dxos.org", | ||
"node": { | ||
"default": "./dist/lib/node/index.cjs" | ||
"require": "./dist/lib/node/index.cjs", | ||
"default": "./dist/lib/node-esm/index.mjs" | ||
}, | ||
@@ -28,5 +29,5 @@ "types": "./dist/types/src/index.d.ts" | ||
"dependencies": { | ||
"@dxos/debug": "0.6.11", | ||
"@dxos/node-std": "0.6.11", | ||
"@dxos/invariant": "0.6.11" | ||
"@dxos/debug": "0.6.12-main.5cc132e", | ||
"@dxos/invariant": "0.6.12-main.5cc132e", | ||
"@dxos/node-std": "0.6.12-main.5cc132e" | ||
}, | ||
@@ -33,0 +34,0 @@ "devDependencies": { |
@@ -34,2 +34,5 @@ // | ||
static parse(dxn: string): DXN { | ||
if (typeof dxn !== 'string') { | ||
throw new Error('Invalid DXN'); | ||
} | ||
const [prefix, kind, ...parts] = dxn.split(':'); | ||
@@ -81,2 +84,6 @@ if (!(prefix === 'dxn')) { | ||
isLocalEchoObjectDXN() { | ||
return this.#kind === DXN.kind.ECHO && this.#parts[0] === LOCAL_SPACE_TAG && this.#parts.length === 2; | ||
} | ||
toString() { | ||
@@ -83,0 +90,0 @@ return `dxn:${this.#kind}:${this.#parts.join(':')}`; |
@@ -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'; |
@@ -23,2 +23,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. | ||
@@ -44,3 +50,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)); | ||
@@ -47,0 +53,0 @@ } else if (typeof source === 'string') { |
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
173333
36
2418
10
+ Added@dxos/debug@0.6.12-main.5cc132e(transitive)
+ Added@dxos/node-std@0.6.12-main.5cc132e(transitive)
- Removed@dxos/debug@0.6.11(transitive)
- Removed@dxos/node-std@0.6.11(transitive)