Loading Data: fall-back to KEF
DRAFT: For a future release AFTER v25.09.0
What is this PR for?
Focus of this PR is to re-prioritize loading of data (scanned or from sd) to be treated as plaintext, within context, instead of first attempting to parse and decrypt a KEF envelope. PSBTs in particular, which are often loaded in binary, form can appear to be KEF, but if they can be parsed as PSBTs first, then user will not have to answer "No". If parsing fails, in this case -- as a PSBT, we could then fall-back to see if it was KEF, and try again after decryption.
Loading of datum-types TO DO:
- [x] addresses
- [x] descriptors
- [ ] messages to be signed
- [ ] PSBTs
In some cases, this is not possible, a KEF must be checked first, in cases where data is treated as random bytes and no other obvious parsing could be done... ie) for mnemonic entropy, passphrases, and for decryption keys we should check if it's a KEF first (rather than treating 32 bytes as a mnemonic, or base43 text as a passphrase, or a string of bytes as the decryption key when in fact these would normally parse as kef envelopes to prompt decryption... and in the case of a false-KEF the user will know NOT to decrypt.
In most other cases, we could try to parse in plaintext form first, and then fall back to trying KEF if it fails.
Changes made to:
- [x] Code
- [x] Tests
- [x] Docs
- [ ] CHANGELOG
Did you build the code and tested on device?
- [ ] Yes
What is the purpose of this pull request?
- [ ] Bug fix
- [ ] New feature
- [ ] Docs update
- [x] Other
Codecov Report
:x: Patch coverage is 96.72131% with 2 lines in your changes missing coverage. Please review.
:white_check_mark: Project coverage is 96.64%. Comparing base (8673400) to head (0bdf481).
| Files with missing lines | Patch % | Lines |
|---|---|---|
| src/krux/pages/home_pages/wallet_descriptor.py | 94.28% | 2 Missing :warning: |
Additional details and impacted files
@@ Coverage Diff @@
## develop #702 +/- ##
========================================
Coverage 96.64% 96.64%
========================================
Files 79 79
Lines 10150 10176 +26
========================================
+ Hits 9809 9835 +26
Misses 341 341
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.