Skip to content

Conversation

@jdlcdl
Copy link
Collaborator

@jdlcdl jdlcdl commented Sep 8, 2025

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:

  • addresses
  • 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:

  • Code
  • Tests
  • 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
  • Other

@codecov
Copy link

codecov bot commented Sep 8, 2025

Codecov Report

❌ Patch coverage is 96.72131% with 2 lines in your changes missing coverage. Please review.
✅ 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 ⚠️
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           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

  moved from original prototype in kef.unwrap(),
  so that callers that know context can quickly rule-out very unlikely
  strings that would otherwise result in prompting for "Decrypt?"...
  based on non-uniform distribution of bytes in the payload.
example) An ascii string -- or even UTF-8 string, is "almost" never a KEF.
@jdlcdl jdlcdl force-pushed the kef_priority_is_plain branch from bbcaa2b to 0bdf481 Compare September 8, 2025 14:28
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.

1 participant