Skip to content

refactor(wallet): typed SigningCancelledException with i18n message#318

Merged
TaprootFreak merged 2 commits into
developfrom
feat/signing-cancelled-exception
May 12, 2026
Merged

refactor(wallet): typed SigningCancelledException with i18n message#318
TaprootFreak merged 2 commits into
developfrom
feat/signing-cancelled-exception

Conversation

@TaprootFreak
Copy link
Copy Markdown
Contributor

Summary

Replaces the generic Exception('Signature was empty …') thrown at both empty-signature guard sites with a typed SigningCancelledException, so the KYC registration page can render a localised, user-facing message instead of a raw English exception string.

  • SigningCancelledException added under lib/packages/wallet/exceptions/
  • Both guard sites (Eip712Signer._signTypedData, DFXAuthService.getSignature) throw the typed exception
  • signingCancelled i18n key added to strings_de.arb and strings_en.arb (alphabetisch sortiert)
  • KycRegistrationSubmitFailure now carries the original cause; the registration page resolves the localised message when the cause is SigningCancelledException
  • Unit tests cover both empty ('') and 0x BitBox return cases

Closes #316

Test plan

  • flutter analyze — clean (no new issues in touched files)
  • flutter test — all tests pass (3 new tests in eip712_signer_test.dart)
  • Manual: cancel BitBox sign during registration → SnackBar shows localised message in current app language

Replace generic Exception at both empty-signature guard sites with a
typed SigningCancelledException so the KYC registration page can show a
localised user message instead of a raw English exception string.

Closes #316
- Add `registrationFailed` i18n key (DE/EN) for the non-cancellation
  failure path so the snackbar is fully localised, not partially
- Collapse the two empty-signature tests into a single parametrised
  loop over `''` and `'0x'`
@TaprootFreak TaprootFreak marked this pull request as ready for review May 12, 2026 21:19
@TaprootFreak TaprootFreak merged commit 8ecc350 into develop May 12, 2026
1 check passed
@TaprootFreak TaprootFreak deleted the feat/signing-cancelled-exception branch May 12, 2026 21:19
TaprootFreak added a commit that referenced this pull request May 23, 2026
Tier-1 integration tests for the EIP-7702 delegation sign path. Stitches
Eip712Signer.signDelegation directly against the FakeBitboxCredentials
boundary (the production caller, RealUnitSellPaymentInfoService.confirmPayment,
delegates the EIP-712 sign here without further mutation). Pins:

* happy path on BOTH credential arms — FakeBitbox.success and a real
  EthPrivateKey both produce a 65-byte sig over the same payload, and the
  two sigs differ (no leaked default key path). Regression class: the
  polymorphic switch in _signTypedData wired both arms to the same key
  (PR #318).

* cancel — FakeBitbox.cancel returns "0x" and the post-sign guard in
  _signTypedData converts it into a typed SigningCancelledException,
  instead of letting the empty signature reach the backend.

* chainId-wiring — verified across [1, 11155111, 42161] that
  signDelegation forwards eip7702Data.domain.chainId verbatim to the
  BitBox sign call (both the int argument AND the chainId embedded in
  the json payload's domain). A wrong chainId here makes the BitBox
  display the wrong network — silent until the user spots it.

* disconnect — BitboxNotConnectedException at the BitBox boundary
  surfaces verbatim through Eip712Signer; it is NOT re-wrapped as
  SigningCancelledException (would mask a re-pair situation as a cancel
  prompt).

Test uses a RecordingFakeBitbox subclass to capture (chainId, jsonData)
without mocking the production signer.
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.

Typed SigningCancelledException with i18n message

1 participant