feat(wallet): self-custodial LightChain browser wallet (MV3 EOA)#74
Merged
Conversation
A self-custodial EOA browser wallet for LightChain - a pure client-side key manager + signer (no smart contract, no server, no custody), built to a verified architecture spec and a 15-point adversarial security review. Core (functional on testnet): - BIP-39 (24-word) keyring with BIP-44 m/44'/60'/0'/0/x derivation via the audited @Scure libs; vault sealed with WebCrypto AES-256-GCM under a scrypt-derived key (random salt + nonce, recorded KDF params). - MV3 background service worker as the sole holder of plaintext keys (volatile memory + storage.session, honest threat model - no self-defeating "key next to ciphertext" scheme). Auto-lock via alarms; boots locked after restart. - EIP-1193 provider + EIP-6963 discovery (coexists with MetaMask, never clobbers window.ethereum); content/inpage are key-free relays; origin taken from the message sender. - Approval window for connect / personal_sign / eth_sendTransaction; the tx signed is exactly the tx displayed; non-text personal_sign payloads get a hard "unreadable data" warning; contract calls are flagged. - React popup: create/import, unlock, balance, send LCAI, gas-as-negligible. - Pinned LightChain chains only; never honors a dapp-supplied RPC url. Security review fixes applied: scryptAsync (non-blocking), chunked base64 (no btoa stack overflow), viem toHex not Node Buffer, approve==sign, RPC pinning. 14 keyring/vault unit tests (canonical BIP-44 vector, vault round-trip + wrong-password, base64 to 500KB). wxt build + tsc green. Excluded wallet/ from the root tsconfig so the Next app's typecheck/build is unaffected. The SDK-powered superpowers (worker dashboard, encrypted inference chat, DAO intelligence, bridge) are mapped and land next; an external audit gates meaningful mainnet funds.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
| GitGuardian id | GitGuardian status | Secret | Commit | Filename | |
|---|---|---|---|---|---|
| - | - | Generic Password | c6647f6 | wallet/src/keyring/vault.ts | View secret |
🛠 Guidelines to remediate hardcoded secrets
- Understand the implications of revoking this secret by investigating where it is used in your code.
- Replace and store your secret safely. Learn here the best practices.
- Revoke and rotate this secret.
- If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.
To avoid such incidents in the future consider
- following these best practices for managing and storing secrets including API keys and other credentials
- install secret detection on pre-commit to catch secret before it leaves your machine and ease remediation.
🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A self-custodial browser wallet for LightChain - a pure client-side EOA key manager + signer like Phantom/MetaMask. No smart contract, no server, no custody. Keys are generated + encrypted on-device and never leave it. New package:
wallet/.Built to a verified 2026 architecture spec and hardened against a 15-point adversarial security review (both run as multi-agent workflows before coding).
Core (functional on testnet)
m/44'/60'/0'/0/xvia the audited@scurelibs; vault sealed with WebCrypto AES-256-GCM under a scrypt-derived key (random salt + nonce per encrypt, recorded KDF params, auth-tag = password check).storage.session, with an honest threat model - no self-defeating "key stored beside ciphertext" scheme). Auto-lock via alarms; boots locked after restart.window.ethereum; content/inpage are key-free relays; origin taken from the message sender.personal_sign/eth_sendTransaction: the tx signed is exactly the tx shown (approve==sign); non-textpersonal_signpayloads get a hard "unreadable data" warning; contract calls flagged.Security-review fixes applied
scryptAsync(non-blocking SW), chunked base64 (nobtoastack overflow),viemtoHexnot NodeBuffer, approve==sign, RPC pinning, nowallet_addEthereumChainwith foreign RPC.Verification
wxt buildproduces a loadablechrome-mv3extension;tscclean; 14 keyring/vault unit tests (canonical BIP-44 vector to0x9858...aeda94, vault round-trip + wrong-password rejection, base64 to 500 KB). Root repo unaffected:wallet/is excluded from the Next app's tsconfig, so roottsc/next build/CI is untouched (491 root tests still green).Next (mapped, not yet built)
The SDK-powered superpowers - one-click worker staking + monitoring, encrypted pay-per-call inference chat, in-wallet DAO intelligence, the Ethereum bridge - wire through
lightnode-sdk(exact export map done). Production hardening from the review (dangerous-calldata decoding + simulation, full EIP-712, Ledger, OS-idle relock) and an external audit gate meaningful mainnet funds. None affect the self-custody guarantee.Community-built; not an official LightChain product.