element-x-ada/features
Cobb de2edafe61 feat(wallet): rewrite SSSS on account data + AES-256-GCM envelope
The Rust SDK removed the low-level SecretStoreWrapper.putSecret/getSecret
API between 26.03.x and 26.04.x — it was an escape hatch we were using
to pin arbitrary bytes into a Matrix 4S slot. The SDK maintainers never
contracted that primitive; locking it down lets their recovery code
evolve without worrying about third-party storage.

This commit replaces that dependency with a self-contained design we
own end-to-end, so future SDK moves no longer break our backup flow.

### Design
- Slot: `com.sulkta.wallet.seed.v1` in Matrix account data.
  Our namespace, not a Matrix-spec 4S slot — we are NOT impersonating
  Matrix secret storage, we are holding our own opaque blob.
- Envelope (JSON): version tag, algorithm tag, random 12-byte IV, GCM
  output (ciphertext || tag), AAD = slot name. AES-256-GCM via stock
  javax.crypto. AAD binds a blob to its slot so a blob can't be lifted
  from one namespace and successfully opened in another.
- Key: derived from the user's existing Matrix recovery key via
  HKDF-SHA256 with info label "sulkta.wallet.seed.v1". The info label
  guarantees we never produce the same key bytes Matrix uses for its
  own crypto — same secret, different domain.
- I/O: client.setAccountData(key, json) + client.accountData(key)
  via the SDK; the homeserver only ever sees the opaque encrypted blob.

### Files
- api/walletsecretstorage/WalletSecretStorage.kt — new interface
- impl/walletsecretstorage/WalletSecretEnvelope.kt — AES-GCM envelope
  (with unit tests: round-trip, wrong key, tampered ct, tampered iv,
  wrong AAD, wrong version, malformed JSON)
- impl/walletsecretstorage/RecoveryKeyDerivation.kt — base58 decode
  + parity check + HKDF-SHA256 (with unit tests: determinism,
  whitespace tolerance, distinct info labels → distinct keys)
- impl/walletsecretstorage/MatrixAccountDataWalletSecretStorage.kt —
  WalletSecretStorage impl wrapping Client account data
- test/walletsecretstorage/FakeWalletSecretStorage.kt — in-memory fake
- api/MatrixClient.kt: old .secretStorage → .walletSecretStorage
- features/wallet/.../WalletBackupServiceImpl.kt — rewired to use the
  new interface; hasBackupWithoutKey now goes through the same path
  instead of manually poking the raw Matrix HTTP API.
- DELETED: api/secretstorage/SecretStorage.kt, SecretStore.kt, impl/
  secretstorage/RustSecretStorage.kt — the old SDK-dependent path.

### Backward compat note
Users who backed up a wallet seed on the OLD SDK have a blob in Matrix's
4S at `com.sulkta.cardano.wallet_seed`. This branch cannot read those.
Since the prior integration was only tested internally, acceptable
today — anyone with an old backup re-enters their mnemonic.
2026-04-17 10:16:53 -07:00
..
analytics Sync Strings from Localazy 2026-04-13 00:48:40 +00:00
announcement Merge pull request #6561 from element-hq/feature/bma/removeSpaceAnnouncement 2026-04-14 16:58:25 +02:00
cachecleaner Fix crash at startup 2025-11-19 09:34:17 +01:00
call Sync Strings from Localazy 2026-04-13 00:48:40 +00:00
createroom Sync Strings from Localazy 2026-04-13 00:48:40 +00:00
deactivation Sync Strings from Localazy 2026-04-13 00:48:40 +00:00
enterprise Let enterprise build be able to use a different notification channel for noisy notification. 2026-02-11 11:57:01 +01:00
forward Copyright: Add Element Creations Ltd. copyright 2025-11-10 11:05:05 +01:00
ftue Sync Strings from Localazy 2026-04-13 00:48:40 +00:00
home Merge pull request #6574 from element-hq/feature/valere/call/ongoing_voice_call_join 2026-04-14 22:47:58 +02:00
invite Sync Strings from Localazy 2026-04-13 00:48:40 +00:00
invitepeople Add confirmation dialog when inviting users with unknown identities (#6523) 2026-04-15 10:25:58 +01:00
joinroom Sync Strings from Localazy 2026-04-13 00:48:40 +00:00
knockrequests Sync Strings from Localazy 2026-04-13 00:48:40 +00:00
leaveroom Sync Strings from Localazy 2026-04-13 00:48:40 +00:00
licenses Copyright: Add Element Creations Ltd. copyright 2025-11-10 11:05:05 +01:00
linknewdevice Sync Strings from Localazy 2026-04-13 00:48:40 +00:00
location Sync Strings from Localazy 2026-04-13 00:48:40 +00:00
lockscreen Sync Strings from Localazy 2026-04-13 00:48:40 +00:00
login Merge pull request #6587 from element-hq/feature/bma/flagsFromOnBoarding 2026-04-15 16:16:23 +02:00
logout Sync Strings from Localazy 2026-04-13 00:48:40 +00:00
messages Merge branch 'main' into wallet 2026-04-16 22:05:16 -07:00
migration Depend on api not impl module. 2026-04-08 17:51:57 +02:00
networkmonitor Fix isInAirGappedEnvironment check for older APIs (#6573) 2026-04-14 15:52:41 +02:00
poll Sync Strings from Localazy 2026-04-13 00:48:40 +00:00
preferences Merge pull request #6587 from element-hq/feature/bma/flagsFromOnBoarding 2026-04-15 16:16:23 +02:00
rageshake Sync Strings from Localazy 2026-04-13 00:48:40 +00:00
reportroom Sync Strings from Localazy 2026-04-13 00:48:40 +00:00
rolesandpermissions Sync Strings from Localazy 2026-04-13 00:48:40 +00:00
roomaliasresolver Sync Strings from Localazy 2026-04-13 00:48:40 +00:00
roomcall feat: Default to camera muted when joining ongoing voice call 2026-04-14 14:45:35 +02:00
roomdetails Sync Strings from Localazy 2026-04-13 00:48:40 +00:00
roomdetailsedit Sync Strings from Localazy 2026-04-13 00:48:40 +00:00
roomdirectory Sync Strings from Localazy 2026-04-13 00:48:40 +00:00
roommembermoderation Sync Strings from Localazy 2026-04-13 00:48:40 +00:00
securebackup Sync Strings from Localazy 2026-04-13 00:48:40 +00:00
securityandprivacy Sync Strings from Localazy 2026-04-13 00:48:40 +00:00
share Add support for slash commands (under Feature Flag) (#6482) 2026-04-02 16:15:32 +02:00
signedout Sync Strings from Localazy 2026-04-13 00:48:40 +00:00
space Use @TestParameter instead of doing the work manually. 2026-04-15 08:39:14 +02:00
startchat Add confirmation dialog when inviting users with unknown identities (#6523) 2026-04-15 10:25:58 +01:00
userprofile Add confirmation dialog when inviting users with unknown identities (#6523) 2026-04-15 10:25:58 +01:00
verifysession Sync Strings from Localazy 2026-04-13 00:48:40 +00:00
viewfolder Revert "Use Folder icon from Compound." 2026-04-02 09:25:30 +02:00
wallet feat(wallet): rewrite SSSS on account data + AES-256-GCM envelope 2026-04-17 10:16:53 -07:00