Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

read_dir_first: stop at the first file that is alphabetically "after" not_before #151

Merged
merged 2 commits into from
Mar 28, 2024

Conversation

sosthene-nitrokey
Copy link
Contributor

In fido-authenticator, if we change the paths of RK to be: "rp_id.rk_id" instead of the current "rp_id/rk_id", we still want to be able to iterate over the keys even though we only know the "rp_id" and not the "rk_id". Therefore we need to be able to stop at "rp_id.***" when giving "rp_id" in not_before

This is technically a breaking change because now, given the files:

  • "aaa"
  • "aaabbb"

"read_dir_first" with "aaa" as not_before would only yield "aaa"
due to littlefs-project/littlefs#923. Now this will yield both files, and yield "aaabbb" first.

I beleive this behaviour is technically more correct as it is likely what would be expected to be yield expecting alphabetical order (though the order of the entries is still incorrect).

… `not_before`

In fido-authenticator, if we change the paths of RK  to be:
"rp_id.rk_id" instead of the current "rp_id/rk_id", we still want to be able
to iterate over the keys even though we only  know the "rp_id" and not the
"rk_id". Therefore we need to be able to stop at "rp_id.***" when giving "rp_id" in `not_before`

This is technically a breaking change because now, given the files:

- "aaa"
- "aaabbb"

 "read_dir_first"  with "aaa" as `not_before` would only yield "aaa"
due to littlefs-project/littlefs#923.
Now this will yield both files, and yield "aaabbb" first.

I beleive this behaviour is technically more correct as it is likely what
would be expected to be yield expecting alphabetical order
(though the order of the entries is still incorrect).
src/api.rs Outdated
@@ -244,7 +244,7 @@ pub mod request {
ReadDirFirst:
- location: Location
- dir: PathBuf
- not_before_filename: Option<PathBuf>
- not_before: Option<(PathBuf, bool)>
Copy link
Member

Choose a reason for hiding this comment

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

I don’t like this tuple, it’s very hard to understand. What do you think about moving the bool into a separate field that only has an effect if not_before_filename is set? Alternatively, a helper struct could be used.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I replaced it with an enum with 3 states.

@sosthene-nitrokey sosthene-nitrokey merged commit 06d0c6f into trussed-dev:main Mar 28, 2024
2 checks passed
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