Skip to content

feat(auction): encrypt Wraith Names auction recovery secrets - #238

Closed
Adedoyinjr wants to merge 20 commits into
wraith-protocol:developfrom
Adedoyinjr:kilo/autumn-tower-oc3
Closed

Adedoyinjr wants to merge 20 commits into
wraith-protocol:developfrom
Adedoyinjr:kilo/autumn-tower-oc3

Conversation

@Adedoyinjr

Copy link
Copy Markdown
Contributor

Summary

  • Encrypt auction bid recovery material using PBKDF2 and AES-GCM.
  • Add encrypted vault storage with passphrase-based unlocking.
  • Support explicit backup, recovery, and safe migration of legacy plaintext data.
  • Validate decrypted bid records before they reach auction operations.
  • Gate bidding and revealing on vault access.

Security

  • Keep passphrases and derived keys out of localStorage.
  • Preserve legacy recovery data until encrypted data is verified and the user confirms deletion.
  • Reject incorrect passphrases, corrupted ciphertext, and malformed bid records.

Tests

  • 134 tests passed.
  • TypeScript checks passed.
  • Prettier checks passed.
  • Production build succeeded.

Closes #214

kilo-code-bot Bot and others added 5 commits October 15, 2026 19:56
- Add unit-tests job that runs pnpm test:unit
- Add intentional failing test to verify CI detects failures
- Remove ci-test.test.ts after verifying CI detects failures
- All 105 unit tests pass
ci: add unit-test job to CI workflow
@vercel

vercel Bot commented Oct 17, 2026

Copy link
Copy Markdown

@kilo-code-bot[bot] is attempting to deploy a commit to the truthixify's projects Team on Vercel.

A member of the Team first needs to authorize it.

@truthixify truthixify left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Blocking findings:

  1. src/pages/NamesAuctions.tsx:213-227 broadcasts the on-chain commit first and only calls saveBid after submission succeeds. If IndexedDB/localStorage encryption or persistence fails (quota, browser policy, serialization, tab shutdown), the deposit is committed but the only salt is a local variable that is then lost, so the user cannot reveal the bid. Persist and verify the encrypted recovery record before signing/broadcasting; retain a recoverable pending record across ambiguous submission failures, and test a storage failure around submission.

  2. src/store/nameWatchlistStore.tsx:403-425 imports a backup by immediately overwriting the active encrypted vault with the imported one and resets the watchlist. Importing an older or different valid backup can therefore silently destroy the current browser's unrevealed bid secrets. Refuse replacement when a non-empty vault exists, or decrypt and merge with explicit conflict handling/confirmation after protecting the current vault; add a test with distinct current and imported bids.

  3. This head is currently conflicting and includes the commits from already-blocked PR #224, so none of the repository CI jobs ran for this PR (only the Vercel authorization status exists). Rebase the auction change onto current develop and get the unit/type/format/build jobs green so the claimed 134-test result is independently enforced.

Persist and read-back/verify the bid recovery record before signing or
broadcasting the on-chain commit, so a storage failure can never leave a
user without the salt needed to reveal. An ambiguous submission failure
retains the persisted recovery record for retry or recovery after reload.

Refuse to silently replace a non-empty encrypted vault on backup import;
replacement requires explicit confirmation, and the current vault is
preserved if validation, decryption, or persistence fails. Wrong-passphrase
and corrupted backups are handled safely.

Adds regression tests for storage-failure gating, pre-submission
verification, record retention on submission failure, import refusal,
explicit replacement, and failure rollback.

@truthixify truthixify left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The two code-level blockers from the prior review are fixed: saveBid is persisted and read-back verified before transaction submission, and backup import requires explicit replacement and validates before overwrite. The focused vault suites (34 tests) and branch build pass locally. This head is still conflicting with develop and remains stacked on the outdated #224 CI commits, so it cannot be merged or exercise the current required unit-test workflow. Please rebase onto current develop, drop the inherited #224 commits, and rerun CI; no additional vault-code blocker remains.

@truthixify truthixify left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Blocking findings on current head 732dfba:

  1. src/pages/NamesAuctions.tsx:701-703,764-785,822 makes an ambiguous submission unrecoverable in the UI. A timeout stores submissionStatus: "unknown" (or a reload can leave "pending"), but only "committed" records are allowed to reveal or refund. The only unknown-state action is an explorer link; there is no path that reconciles the transaction hash and persists committed or failed. A transaction that actually landed can therefore reach the reveal window while the saved secret is permanently gated out. Add deterministic reconciliation against Stellar RPC, persist the resolved state, and test reload -> confirmed -> reveal plus confirmed-not-submitted -> safe retry.

  2. This head still conflicts with develop and has no repository CI result (only the Vercel authorization failure). Rebase onto current develop and get the required unit/type/format/build jobs green.

The focused vault/submission suites (39 tests), production build, and formatting pass locally; the blocker is the missing recovery workflow, not the cryptographic persistence itself.

# Conflicts:
#	.github/workflows/ci.yml
#	src/App.tsx
#	src/lib/stellar/names.ts
#	src/pages/NamesAuctions.tsx
#	src/store/nameWatchlistStore.test.ts
#	src/store/nameWatchlistStore.tsx

@truthixify truthixify left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Persisting the recovery secret before signing is now covered, but the ambiguous-submission path remains permanently wedged. NamesAuctions.tsx:703-704 treats only submissionStatus === "committed" as a committed bid, while reveal and refund are gated on hasCommittedBid at lines 824 and 860. An unknown result only gets an explorer link; there is no Horizon/Soroban reconciliation that promotes a successful hash to committed or a rejected hash to failed. After a timeout, even a bid that landed on-chain cannot be revealed or refunded from this UI. Add persisted/reload-safe transaction reconciliation and tests for unknown-to-committed and unknown-to-failed transitions before enabling the downstream actions.

@truthixify truthixify left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Blocking findings on current head b4d1ac6:

  1. High correctness: src/lib/stellar/names.ts:755-765 treats every sendTransaction response except ERROR and TRY_AGAIN_LATER as a completed submission and returns its hash. In stellar-sdk 13.3.0, a successful sendTransaction call normally returns PENDING; that only confirms queue admission, not contract execution. src/lib/stellar/auctionBidSubmission.ts:69 then persists that PENDING transaction as committed, while src/lib/stellar/auctionBidReconciliation.ts:23-27 excludes committed records from later status checks. If execution subsequently reaches FAILED, the UI keeps a nonexistent bid committed, blocks a safe retry, and can expose reveal/refund actions for state that never landed. Keep PENDING/DUPLICATE records in the pending state and reconcile them through getTransaction until authoritative SUCCESS or FAILED, or await the terminal result before writing committed. Add a PENDING then FAILED regression that proves the bid becomes retryable, plus PENDING then SUCCESS.

  2. Medium CI: the required build job is red because format:check fails on auctionBidReconciliation.test.ts, auctionBidSubmission.test.ts, names.ts, NamesAuctions.tsx, and nameWatchlistStore.tsx. Format those files and rerun the required gate.

The focused reconciliation/submission/store suites pass 38/38, TypeScript checks pass, and a production build succeeds locally. The complete remote patch was also clean against the known PolinRider indicators.

@truthixify truthixify left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The prior PENDING correctness blocker is fixed on exact head c422461: queued/ambiguous submissions remain reconcilable, and the focused suites pass 38/38. The required build gate is still red because format:check fails on auctionBidReconciliation.test.ts, auctionBidSubmission.test.ts, names.ts, NamesAuctions.tsx, and nameWatchlistStore.tsx. Format those files and rerun CI. This head has the same tree as #241, so please coordinate one canonical PR to avoid duplicate merges.

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.

[Wave 10] Encrypt local Wraith Names auction recovery secrets

2 participants