OverviewFilesCommitsIssuesDocsReleasesPeers

hyperident commits / 40a488f

README: rewrite to match current CLI surface
Audit found ~half the CLI undocumented and the architecture section listing only 3 of 7 lib modules. Rewrite covers all device subcommands (bootstrap / create-network / share / join / status / sync / mesh join|leave / revoke), the file-signing pipeline, the debug subsystem, and the actual lib/ layout (DeviceLinkingManager, DeviceMeshManager, DebugManager). Drops the `pear run` install path (being removed from Pear runtime) in favour of `pgh app install`. Adds an upfront naming-collision note: this standalone CLI is NOT the same codebase as packages/hyper-identity (the shared IdentityRegistry + DeviceLinker library used by pear-git-v3, hypernote, etc). They share `keet-identity-key` and the name "hyperident", and that is the only overlap. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
40a488f28941e01f9526cf9e1a699836ee34f2bd
by plankatron <fleeky@gmail.com> · 2026-05-03T14:08:07.000Z

Changed files (1) +159 -233

README.md +159 -233
……@@ -1,331 +1,257 @@
11# Hyperident
22
3**Deterministic Identity Management for Hyperswarm Networks**
3**Deterministic identity + signing + device-chain CLI for Hyperswarm applications**
44
5Hyperident provides deterministic, cross-device identity management for Hyperswarm applications, enabling consistent network addresses through named profiles.
5Standalone command-line tool that wraps `keet-identity-key` to give a
6local identity vault (`~/.hyperident/`), named profiles that resolve
7deterministically to Hyperswarm topics, file signing, and device
8chain export/import + network mesh pairing.
69
7## 🚀 Quick Start
10> **Naming caveat — read first.** This CLI is a different codebase
11> from `packages/hyper-identity` (the shared library used by
12> pear-git-v3, hypernote, pear-git, hyper-social-web). Both consume
13> `keet-identity-key`; both manage device chains; that is the only
14> overlap. If you are looking for the multi-app `IdentityRegistry` /
15> `DeviceLinker` shared library, see `packages/hyper-identity`. If
16> you want a one-shot identity + deterministic Hyperswarm topic CLI,
17> you are in the right place.
18
19## Quick start
820
921```bash
10# Initialize your identity
11node index.js init
22# Initialize identity (creates ~/.hyperident/)
23bare index.js init
1224
13# Create a profile
14node index.js create-profile work "Work projects"
25# Create a profile for deterministic addressing
26bare index.js create-profile work "Work projects"
1527
16# Start SOCKS proxy with deterministic address
17node socks-server.js server --profile work
28# Get the deterministic Hyperswarm topic for that profile
29bare index.js address work
1830```
1931
20## 📦 Installation
32## Installation
33
34### Local development
2135
22### Local Development
2336```bash
2437git clone <repository-url>
2538cd hyperident
2639npm install
2740```
2841
29### Global Installation (Optional)
30```bash
31npm install -g .
32# Then use: hyperident init (instead of node index.js init)
33```
42### Bare runtime (recommended)
3443
35### Bare Runtime (recommended)
3644```bash
45npm install -g bare-runtime
3746bare index.js init
3847bare index.js list-profiles
3948```
4049
41### Pear Runtime (legacy)
42```bash
43pear run pear://bdkaqufc8o6h75cbxrkzxjqadzqkyq11bws3iuxsb8kk5jjpuado
44```
45
46## 🔧 Commands
47
48### `node index.js init [--with-passphrase]`
49Initialize a new identity with optional passphrase protection.
50
51```bash
52# Create unencrypted identity
53node index.js init
54
55# Create encrypted identity
56node index.js init --with-passphrase
57```
58
59### `node index.js create-profile <name> [description]`
60Create a new profile for deterministic addressing.
61
62```bash
63node index.js create-profile work "Work projects"
64node index.js create-profile personal
65```
66
67### `node index.js list-profiles`
68List all created profiles.
69
70```bash
71node index.js list-profiles
72```
73
74### `node index.js delete-profile <name>`
75Delete an existing profile.
76
77```bash
78node index.js delete-profile work
79```
80
81### `node index.js address <profile> [--cached]`
82Get the deterministic address for a profile.
83
84```bash
85node index.js address work
86node index.js address work --cached # Use cached address
87```
88
89### `node index.js refresh-addresses`
90Refresh all cached addresses.
50### Pear app install (production)
9151
9252```bash
93node index.js refresh-addresses
53pgh app install pear://bdkaqufc8o6h75cbxrkzxjqadzqkyq11bws3iuxsb8kk5jjpuado --name hyperident
54hyperident init
9455```
9556
96### `node index.js export-addresses [file] [--enhanced]`
97Export addresses for external programs.
57The `pear run pear://...` flow that older docs mention is being
58removed from the Pear runtime. Use `pgh app install` instead.
9859
99```bash
100# Basic export to console
101node index.js export-addresses
102
103# Export to file
104node index.js export-addresses addresses.json
105
106# Enhanced export with multiple formats
107node index.js export-addresses --enhanced
108node index.js export-addresses addresses-enhanced.json --enhanced
109```
110
111### Data Signing Commands
60## Commands
11261
113### `node index.js sign <file>`
114Sign a file with your device identity.
62All commands accept the binary as either `bare index.js`, `node
63index.js`, or — once installed via Pear — `hyperident`. Examples
64below use `bare index.js`.
11565
116```bash
117node index.js sign document.pdf
118# Creates document.pdf.sig
119```
120
121### `node index.js verify <signature> <file>`
122Verify a signature against the original file.
66### Identity
12367
12468```bash
125node index.js verify document.pdf.sig document.pdf
69bare index.js init # plaintext mnemonic
70bare index.js init --with-passphrase # encrypted at rest
71bare index.js init --device-name "laptop"
12672```
12773
128### `node index.js export-signing-config`
129Export signing configuration for applications.
74### Profiles
13075
13176```bash
132node index.js export-signing-config
77bare index.js create-profile <name> [description]
78bare index.js list-profiles
79bare index.js delete-profile <name>
80bare index.js address <profile> [--cached]
81bare index.js refresh-addresses
82bare index.js export-addresses [file] [--enhanced]
13383```
13484
135### Device Management Commands
136
137### `node index.js device list`
138List device information.
85`address <profile>` returns a 32-byte hex string that can be used
86directly as a Hyperswarm topic. Two devices using the same profile
87name resolve to the same topic.
13988
140```bash
141node index.js device list
142```
143
144### `node index.js device export [file]`
145Export device bundle for cross-device sync.
89### File signing
14690
14791```bash
148node index.js device export
149node index.js device export device-bundle.json
92bare index.js sign <file> # writes <file>.sig
93bare index.js verify <signature> <file>
94bare index.js export-signing-config # JSON for app integration
15095```
15196
152### `node index.js device import <file> --device-name <name>`
153Import device bundle on a new device.
154
155```bash
156node index.js device import device-bundle.json --device-name "laptop"
157```
97### Device chain — manual export/import
15898
159### `node index.js device verify`
160Verify device chain integrity.
99For copying an identity onto another device by transferring a bundle
100file out-of-band (USB stick, encrypted email, etc).
161101
162102```bash
163node index.js device verify
103bare index.js device list
104bare index.js device export [file] # default: device-bundle.json
105bare index.js device import <file> --device-name <name>
106bare index.js device verify
164107```
165108
166### Debug Commands
167
168### `node index.js debug inspect [--passphrase]`
169Inspect identity and system state.
170
171```bash
172node index.js debug inspect
173node index.js debug inspect --passphrase # For encrypted identities
174```
109### Device chain — network pairing (identity mesh)
175110
176### `node index.js debug health`
177Run comprehensive health check.
111For linking devices over a Hyperswarm-discovered identity mesh.
112The first device bootstraps; subsequent devices join via a shared
113code.
178114
179115```bash
180node index.js debug health
116bare index.js device bootstrap # be the first node
117bare index.js device create-network # spin up a mesh
118bare index.js device share [--timeout <minutes>]
119bare index.js device join <code> --device-name <name>
120bare index.js device status
121bare index.js device sync # pull peer profiles
122bare index.js device mesh join
123bare index.js device mesh leave
124bare index.js device revoke <device-id>
181125```
182126
183### `node index.js debug network`
184Run network diagnostics.
127### Debug
185128
186129```bash
187node index.js debug network
130bare index.js debug inspect [--passphrase]
131bare index.js debug health
132bare index.js debug network
133bare index.js debug trust
134bare index.js debug system
188135```
189136
190### `node index.js debug trust`
191Verify trust relationships.
137## SOCKS proxy integration
192138
193```bash
194node index.js debug trust
195```
196
197### `node index.js debug system`
198Show system information.
139Optional companion: a SOCKS proxy bound to a profile's deterministic
140address.
199141
200142```bash
201node index.js debug system
143node socks-server.js server --profile work # bound to profile address
144node socks-server.js server # random address
145node socks-server.js server --profile work --port 8080
202146```
203147
204## 🌐 SOCKS Proxy Integration
148## Storage layout
205149
206### Start with Profile (Deterministic)
207```bash
208node socks-server.js server --profile work
209150```
210
211### Start without Profile (Random)
212```bash
213node socks-server.js server
151~/.hyperident/
152├── identity private mnemonic (encrypted if --with-passphrase). 600.
153├── identity.pub public key, hex. 644.
154├── profiles.json profile name → metadata + cached address. 644.
155└── device-chain keet-identity-key device proof chain.
214156```
215157
216### Custom Port
217```bash
218node socks-server.js server --profile work --port 8080
219```
158## Cross-device sync
220159
221## 🔐 Security Features
160Two paths:
222161
223- **Secure File Permissions**: Identity files protected with 600 permissions
224- **Optional Encryption**: Passphrase-protected identities using SHA256 + XOR
225- **Cross-Platform**: Works on Linux, macOS, Windows, and mobile via Pear
226- **Deterministic**: Same profile generates identical addresses across devices
1621. **Manual bundle transfer** — `device export` produces a
163 self-contained JSON bundle. Move it to the second device via any
164 trusted channel, then `device import bundle.json --device-name
165 "phone"`.
1662. **Identity mesh over Hyperswarm** — bootstrap a mesh on device A,
167 `device share` to print a code, then on device B run `device join
168 <code> --device-name "phone"`. Subsequent profile changes
169 propagate via `device sync`.
227170
228## 📁 File Structure
171## Architecture
229172
230173```
231~/.hyperident/
232├── identity # Private identity (600 permissions)
233├── identity.pub # Public key (644 permissions)
234└── profiles.json # Profile definitions (644 permissions)
174index.js CLI dispatcher
175lib/identity-manager.js IdentityManager (all static methods)
176lib/crypto.js CryptoManager — passphrase encryption,
177 raw device-keypair generation, hashing
178lib/file-ops.js FileManager — ~/.hyperident/* I/O with
179 proper file permissions
180lib/validation.js CLI arg + profile-name validation
181lib/device-linking-manager.js Network device pairing — share/join codes,
182 blind-pair flow over Hyperswarm
183lib/device-mesh-manager.js Identity mesh discovery + cross-device
184 profile sync
185lib/debug-manager.js Health / network / trust / system
186 diagnostics for `debug` subcommands
187socks-server.js Optional SOCKS proxy
235188```
236189
237## 🔄 Cross-Device Sync
238
239To use the same identity across devices:
190`IdentityManager` exposes only static methods —
191`generateIdentity`, `saveIdentity`, `loadIdentity`,
192`createProfile`, `listProfiles`, `getProfileAddress`, `signData`,
193`verifySignature`, `exportSigningConfig`, `identityExists`. There
194is no `new IdentityManager()` instance form; older example code that
195shows `await identity.init()` is wrong.
240196
2411. **Backup**: Copy `~/.hyperident/` directory
2422. **Restore**: Place files in `~/.hyperident/` on new device
2433. **Verify**: Run `node index.js list-profiles`
197## Security
244198
245## 🛠️ Development
199- Identity files written with `600` permissions; public key with
200 `644`.
201- Optional passphrase encryption (`--with-passphrase`) — passphrase
202 must be ≥8 chars; lost passphrase = lost identity.
203- Device-chain proofs via `keet-identity-key.bootstrap()`; chain
204 validity checkable with `device verify`.
205- Cross-platform: Linux, macOS, Windows; mobile via Pear.
246206
247### Run Tests
248```bash
249npm test
250```
207## Tests
251208
252### Development Mode
253209```bash
254npm run dev
210npm test # brittle test/*.test.js
211npm run dev # bare index.js
212npm run socks # node socks-server.js
255213```
256214
257### SOCKS Server
258```bash
259npm run socks
260```
215The root-level `test-keet-api*.js`, `demo.js`, `verify.js`,
216`test-device-chain-workflow.js` and `tampered-file.txt` /
217`test-file.txt*` fixtures are scratch scripts from the initial
218build; they are **not** wired into `npm test` and may be out of date.
261219
262## 📊 Performance
220## Performance
263221
264- **Startup Time**: <250ms without passphrase, <2s with passphrase
265- **Memory Usage**: Minimal footprint
266- **File I/O**: Atomic operations with proper error handling
222- Startup: <250ms without passphrase, <2s with passphrase decryption.
223- File I/O: atomic writes with proper error handling.
224- Memory: minimal footprint (single CLI process, no background
225 daemon).
267226
268## 🔍 Troubleshooting
227## Troubleshooting
269228
270### Identity Not Found
271```bash
272# Initialize first
273node index.js init
274```
229**Identity not found.** Run `bare index.js init` first.
275230
276### Profile Not Found
277```bash
278# List available profiles
279node index.js list-profiles
231**Profile not found.** Run `bare index.js list-profiles` to see what
232exists, then `bare index.js create-profile <name>` if needed.
280233
281# Create the profile
282node index.js create-profile <name>
283```
234**Permission errors.** Check directory permissions:
284235
285### Permission Errors
286236```bash
287# Check directory permissions
288237ls -la ~/.hyperident/
289
290# Fix permissions if needed
291238chmod 700 ~/.hyperident/
292239chmod 600 ~/.hyperident/identity
293240```
294241
295## 🏗️ Architecture
296
297### Core Components
242**Encrypted identity won't unlock.** Run `bare index.js debug inspect
243--passphrase` to confirm the passphrase is correct before moving on
244to other diagnostics.
298245
299- **CryptoManager**: Handles encryption, key derivation, and hashing
300- **FileManager**: Manages secure file operations with proper permissions
301- **IdentityManager**: Coordinates identity and profile management
302- **SOCKS Integration**: Bridges Hyperident with hyperswarm-socks
246## Related
303247
304### Key Features
248- [`packages/hyper-identity`](../../packages/hyper-identity) — the
249 shared `IdentityRegistry` + `DeviceLinker` library used by
250 pear-git-v3, hypernote, pear-git. **Different codebase.**
251- [keet-identity-key](https://github.com/holepunchto/keet-identity-key) — upstream identity key generation
252- [hyperswarm](https://github.com/hyperswarm/hyperswarm) — P2P networking
253- [Pear Runtime](https://pears.com) — cross-platform P2P runtime
305254
306- **Deterministic Addressing**: Same profile → same address across devices
307- **Profile Management**: Named profiles for different use cases
308- **Security First**: Proper file permissions and optional encryption
309- **Backward Compatible**: Works with existing hyperswarm-socks functionality
310
311## 📄 License
255## License
312256
313257Apache-2.0
314
315## 🤝 Contributing
316
3171. Fork the repository
3182. Create a feature branch
3193. Add tests for new functionality
3204. Ensure all tests pass
3215. Submit a pull request
322
323## 🔗 Related Projects
324
325- [keet-identity-key](https://github.com/holepunchto/keet-identity-key) - Identity key generation
326- [hyperswarm](https://github.com/hyperswarm/hyperswarm) - P2P networking
327- [Pear Runtime](https://pears.com) - Cross-platform runtime
328
329---
330
331**Made with ❤️ for the Hypercore ecosystem**