Skip to content

feat(eth-wallet): add capability-driven Ethereum wallet subcluster#841

Closed
sirtimid wants to merge 1 commit intomainfrom
sirtimid/eth-wallet
Closed

feat(eth-wallet): add capability-driven Ethereum wallet subcluster#841
sirtimid wants to merge 1 commit intomainfrom
sirtimid/eth-wallet

Conversation

@sirtimid
Copy link
Contributor

Summary

Adds @ocap/eth-wallet, a new package implementing a capability-driven Ethereum wallet as an OCAP kernel subcluster. This is Phase 1 — all local wallet operations with stubs for peer wallet connectivity (Phase 2).

The wallet is composed of four vats orchestrated by a coordinator that resolves signing strategy (delegation → local key → peer wallet → reject):

  • Coordinator vat — bootstrap vat, public API, signing strategy resolution, delegation management
  • Keyring vat — SRP mnemonic and throwaway key management, HD derivation, transaction/message/EIP-712 signing via viem
  • Delegation vat — EIP-7710 delegation lifecycle (create, sign, receive, revoke, match against actions)
  • Provider vat — JSON-RPC communication wrapper

Changes

  • New packages/eth-wallet/ package with full source under src/ and vat definitions in src/vats/
  • Library modules (lib/) for keyring, signing, delegation, caveats (ABI encoding for enforcer contracts), and provider
  • Cluster config using bundleSpec (pre-built bundles via ocap bundle src/vats)
  • Superstruct-based runtime types for all domain objects (delegations, transactions, caveats, etc.)
  • Public API exports for external consumers (cluster config factory, caveat encoders, delegation utilities, type structs)
  • Shared test/helpers.ts with makeMockBaggage() used across all vat tests

Testing

109 unit tests covering all library functions and vat behavior. Each vat has co-located tests exercising its full API. The coordinator vat tests wire real keyring and delegation vats (with a mock E() proxy) to validate cross-vat signing flows, delegation creation, and peer wallet fallback. All tests pass lint, TypeScript type checking, and depcheck.

🤖 Generated with Claude Code

…hereum wallet subcluster

Implements Phase 1 of the eth-wallet subcluster with:

- Keyring management (SRP mnemonic + throwaway keys, HD derivation, signing)
- EIP-7710 delegation framework (create, sign, receive, revoke, match)
- Coordinator vat orchestrating signing strategy resolution (delegation → local → peer)
- Provider vat wrapping JSON-RPC communication
- Cluster config using bundleSpec with `ocap bundle` build step
- 109 unit tests, all lint-clean

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@socket-security
Copy link

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedviem@​2.46.19910010098100

View full report

@socket-security
Copy link

Caution

MetaMask internal reviewing guidelines:

  • Do not ignore-all
  • Each alert has instructions on how to review if you don't know what it means. If lost, ask your Security Liaison or the supply-chain group
  • Copy-paste ignore lines for specific packages or a group of one kind with a note on what research you did to deem it safe.
    @SocketSecurity ignore npm/PACKAGE@VERSION
Action Severity Alert  (click "▶" to expand/collapse)
Block Medium
Network access: npm ox in module globalThis["fetch"]

Module: globalThis["fetch"]

Location: Package overview

From: ?npm/viem@2.46.1npm/ox@0.12.1

ℹ Read more on: This package | This alert | What is network access?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Packages should remove all network access that is functionally unnecessary. Consumers should audit network access to ensure legitimate use.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/ox@0.12.1. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Block Medium
Network access: npm viem in module globalThis["fetch"]

Module: globalThis["fetch"]

Location: Package overview

From: packages/eth-wallet/package.jsonnpm/viem@2.46.1

ℹ Read more on: This package | This alert | What is network access?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Packages should remove all network access that is functionally unnecessary. Consumers should audit network access to ensure legitimate use.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/viem@2.46.1. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn Low
Potential code anomaly (AI signal): npm viem is 100.0% likely to have a medium risk anomaly

Notes: The code implements a cross-chain deposit flow with proper validations, artifact reads, and on-chain interactions. There is no evidence of hidden backdoors, data exfiltration, or malware. The main security considerations relate to token approval logic and correct configuration of flags to avoid granting excessive allowances. Overall, the module appears legitimate for a bridge deposit flow, with moderate risk primarily around configuration of approvals and correct handling of gas/fees.

Confidence: 1.00

Severity: 0.60

From: packages/eth-wallet/package.jsonnpm/viem@2.46.1

ℹ Read more on: This package | This alert | What is an AI-detected potential code anomaly?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: An AI system found a low-risk anomaly in this package. It may still be fine to use, but you should check that it is safe before proceeding.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/viem@2.46.1. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

View full report

@sirtimid sirtimid closed this Feb 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments