OverviewFilesCommitsIssuesDocsReleasesPeers

hyper-identity commits / 6c47ab5

test harness: run green under bare (not just node)
The suite was node-only — test:bare died on raw 'fs'/'os' imports, a bare-only 'bare-path' source import, an undefined global `process`, and a node-only `delete process.env`. None of this was caught because every test ran on node while production runs on bare. Fixes, all via the #node:* bridge: - lib/identity-manager.js: bare-path -> #node:path (was bare-only; broke node) - test files: raw fs/os/path -> #node:*; add `import process from #node:process`; helpers.js crypto -> hypercore-crypto (repo convention) - ssh-scan.test.js: `delete process.env.HOME` -> assign '' (bare-process env is a Proxy that rejects delete; source treats falsy HOME as unset either way) - package.json: declare bare-os, add #node:os to the imports map Result: 95/95 tests, 261/261 asserts under BOTH node and bare. This also validates the prior createUser/view-migration commits under bare. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
6c47ab5b4049f2a2325ada2615a7d91099b58f74
by plankatron <fleeky@gmail.com> · 2026-06-04T15:22:20.000Z

Changed files (6) +20 -14

lib/identity-manager.js +1 -1
……@@ -2,7 +2,7 @@ import process from '#node:process'
22import crypto from 'hypercore-crypto'
33import sodium from 'sodium-native'
44import b4a from 'b4a'
5import { join } from 'bare-path'
5import { join } from '#node:path'
66import { SecureStorage } from './secure-storage.js'
77
88/**
package.json +2 -0
……@@ -33,6 +33,7 @@
3333 "b4a": "^1.6.4",
3434 "bare-fs": "^4.0.0",
3535 "bare-net": "^1.0.0",
36 "bare-os": "^3.9.1",
3637 "bare-path": "^3.0.0",
3738 "bare-process": "^4.0.0",
3839 "bip39-mnemonic": "^2.5.0",
……@@ -57,6 +58,7 @@
5758 "#node:fs": { "bare": "bare-fs", "default": "fs" },
5859 "#node:fs/promises": { "bare": "bare-fs/promises", "default": "fs/promises" },
5960 "#node:path": { "bare": "bare-path", "default": "path" },
61 "#node:os": { "bare": "bare-os", "default": "os" },
6062 "#node:net": { "bare": "bare-net", "default": "net" },
6163 "#node:process": { "bare": "bare-process", "default": "process" }
6264 },
test/helpers.js +3 -3
……@@ -1,9 +1,9 @@
11import Corestore from 'corestore'
22import Hyperbee from 'hyperbee'
33import RAM from 'random-access-memory'
4import path from 'path'
5import os from 'os'
6import crypto from 'crypto'
4import path from '#node:path'
5import os from '#node:os'
6import crypto from 'hypercore-crypto'
77
88/**
99 * Create an in-memory Corestore + Hyperbee for testing
test/hyperident-vault.test.js +3 -3
……@@ -7,9 +7,9 @@
77 */
88
99import test from 'brittle'
10import fs from 'fs'
11import path from 'path'
12import os from 'os'
10import fs from '#node:fs'
11import path from '#node:path'
12import os from '#node:os'
1313import b4a from 'b4a'
1414import IdentityKey from 'keet-identity-key'
1515import crypto from 'hypercore-crypto'
test/ssh-auto-import.test.js +4 -3
……@@ -1,7 +1,8 @@
11import test from 'brittle'
2import { mkdtempSync, mkdirSync, writeFileSync } from 'fs'
3import { tmpdir } from 'os'
4import { join } from 'path'
2import { mkdtempSync, mkdirSync, writeFileSync } from '#node:fs'
3import { tmpdir } from '#node:os'
4import { join } from '#node:path'
5import process from '#node:process'
56
67import { autoImportLocalSSHKeys } from '../lib/auth/ssh-auto-import.js'
78
test/ssh-scan.test.js +7 -4
……@@ -1,7 +1,8 @@
11import test from 'brittle'
2import { mkdtempSync, writeFileSync, mkdirSync, symlinkSync, chmodSync } from 'fs'
3import { tmpdir } from 'os'
4import { join } from 'path'
2import { mkdtempSync, writeFileSync, mkdirSync, symlinkSync, chmodSync } from '#node:fs'
3import { tmpdir } from '#node:os'
4import { join } from '#node:path'
5import process from '#node:process'
56
67import { scanSSHKeys, scanHomeSSHKeys } from '../lib/auth/ssh-scan.js'
78import { SSHKeyParser } from '../lib/auth/ssh-parser.js'
……@@ -64,8 +65,10 @@ test('SSHKeyParser.fingerprint is deterministic and matches ssh-keygen format',
6465})
6566
6667test('scanHomeSSHKeys returns [] without $HOME', async (t) => {
68 // Cross-runtime: bare-process's env is a Proxy that rejects `delete`,
69 // so blank it instead (the source treats falsy HOME the same as unset).
6770 const origHome = process.env.HOME
68 delete process.env.HOME
71 process.env.HOME = ''
6972 t.teardown(() => { if (origHome) process.env.HOME = origHome })
7073
7174 const result = await scanHomeSSHKeys()