OverviewFilesCommitsIssuesDocsReleasesPeers

hyper-identity commits / 01e5a88

BrowserIdentity: get keypair from server instead of local generation
Noble-ed25519 pure-JS keygen blocks the browser main thread (BigInt scalar multiplication too heavy). Server generates keypair via sodium-native (fast, C) at POST /api/identity/generate. Browser stores it and only does signing locally (which noble handles fine). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
01e5a8897020e4eb162b1f321e06cb066cc320b7
by plankatron <fleeky@gmail.com> · 2026-03-30T23:34:04.000Z

Changed files (1) +5 -1

lib/browser-identity.js +5 -1
……@@ -36,7 +36,11 @@ export class BrowserIdentity {
3636 return this._keypair
3737 }
3838
39 this._keypair = await ANProtoClient.gen()
39 // Generate keypair on server (fast, uses sodium-native)
40 // Browser only stores it and uses it for signing
41 const result = await this._fetch('/api/identity/generate', { method: 'POST' })
42 this._keypair = result.keypair
43
4044 if (typeof localStorage !== 'undefined') {
4145 localStorage.setItem(this._keypairKey, this._keypair)
4246 }