Skip to content

Conversation

@hughns
Copy link
Member

@hughns hughns commented Dec 12, 2025

The purpose of this is to allow the UI to validate the entered check code and provide user with the ability to retry entering the code.

he existing send() function is one shot and does not allow for retries.

This is for use in a scenario where the user has mistyped the code rather than where a MITM attack has been detected.

I'm not wedded to the validate() name, so if something else is preferable I can change it.

  • Public API changes documented in changelogs (optional)

Signed-off-by: Hugh Nimmo-Smith [email protected]

@hughns hughns marked this pull request as ready for review December 12, 2025 12:27
@hughns hughns requested a review from a team as a code owner December 12, 2025 12:27
@hughns hughns requested review from poljar and removed request for a team December 12, 2025 12:27
@hughns hughns changed the title feat(sdk,ffi): add CheckCodeSender::validate() to allow UI to valid… feat(sdk,ffi): add CheckCodeSender::validate() Dec 12, 2025
@codspeed-hq
Copy link

codspeed-hq bot commented Dec 12, 2025

CodSpeed Performance Report

Merging #5957 will degrade performances by 39.25%

Comparing hughns:qr-validate-check-code (0f0b435) with main (ce65317)

Summary

❌ 1 regression
✅ 49 untouched

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Benchmarks breakdown

Benchmark BASE HEAD Change
Restore session [memory store] 268.4 ms 441.8 ms -39.25%

@codecov
Copy link

codecov bot commented Dec 12, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.52%. Comparing base (ce65317) to head (0f0b435).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5957      +/-   ##
==========================================
+ Coverage   88.51%   88.52%   +0.01%     
==========================================
  Files         363      363              
  Lines      103469   103480      +11     
  Branches   103469   103480      +11     
==========================================
+ Hits        91582    91603      +21     
+ Misses       7533     7522      -11     
- Partials     4354     4355       +1     

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

@hughns
Copy link
Member Author

hughns commented Dec 12, 2025

I will add some test coverage to this.

/// Returns `true` if the code is valid, `false` otherwise.
pub fn validate(&self, check_code: u8) -> bool {
self.inner.validate(check_code)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Why introducing a new method? The existing send could fail fast if the code is not correct after a local check.

Copy link
Contributor

Choose a reason for hiding this comment

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

Actually it's probably not a good idea to never send the code. So maybe add a parameter to the send method like validate: Boolean?
This is quite equivalent, so feel free to ignore my comments ;)

@hughns hughns marked this pull request as draft December 15, 2025 10:59
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.

2 participants