Skip to content

Implement wallet signers: Freighter, Rabet, keypair, and a shared interface #46

Description

@N-thnI

Description

Deliver all three signing adapters behind one interchangeable interface, with tests.

Problem Statement

Signing is scattered: the dashboard talks to Freighter and Rabet directly via src/lib/wallets/, and the relayer signs with an env secret through its own path. vero-guardian-dashboard#171 records the cost of that — the Freighter adapter does not normalise thrown errors the way Rabet does, so callers see different shapes depending on which wallet the user installed. The three adapters must share one interface, which is why they belong in a single change rather than three racing PRs.

Proposed Changes

  • Define Signer in src/signers/types.ts — one interface all three implement
  • src/signers/freighter.ts and src/signers/rabet.ts — detect absence without throwing (return WalletUnavailable), route every throw through normalizeError so cancellation surfaces as UserRejected, and refuse to sign on a network mismatch
  • src/signers/keypair.ts for server-side use — never log, serialise, or include the secret in errors; add redacting toString/toJSON
  • src/__tests__/signers.test.ts with mocked wallet globals, asserting identical VeroErrorCodes across adapters for equivalent failures, and asserting secret redaction explicitly

Technical Implementation Scaffolding

  • Target Repository: vero-sdk
  • Target Path: src/signers/
  • Branch Naming: feat/issue--wallet-signers
  • Authority Context: Security-sensitive — wallet signing and secret handling

Acceptance Criteria

  • All three adapters are interchangeable through Signer
  • Equivalent failures produce identical error codes across adapters
  • The keypair secret never appears in logs, errors, or serialised output, and a test asserts it
  • A network mismatch is refused before any signature prompt
  • npm test, npm run typecheck, npm run lint, and npm run build all pass

Definition of Done

  • Reviewed by lead maintainer
  • Pull request merged via verified status check

This issue is self-contained. Everything it needs already exists on main; it does not wait on any other issue. Deliver the module and its tests in one PR.

Metadata

Metadata

Assignees

Labels

GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardThird CampaignCampaign: Third Campaign

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions