-
Notifications
You must be signed in to change notification settings - Fork 3
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
Make more items public #36
Conversation
c515afc
to
e9caedb
Compare
This is useful for factory resets in other implementations that might need to parse all the Pin data and don't use the delete_all filestore methods.
5ae0453
to
98eb1e5
Compare
src/lib.rs
Outdated
let msb = match path[0] { | ||
b'0' => 0x0, | ||
b'1' => 0x1, | ||
b'2' => 0x2, | ||
b'3' => 0x3, | ||
b'4' => 0x4, | ||
b'5' => 0x5, | ||
b'6' => 0x6, | ||
b'7' => 0x7, | ||
b'8' => 0x8, | ||
b'9' => 0x9, | ||
b'a' => 0xa, | ||
b'b' => 0xb, | ||
b'c' => 0xc, | ||
b'd' => 0xd, | ||
b'e' => 0xe, | ||
b'f' => 0xf, | ||
_ => return Err(PinIdFromStrError), | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we are this verbose, can we use a helper function so that we only have to do it once? Or maybe just use something like this:
fn parse_ascii_hex(a: u8) -> Option<u8> {
match a {
b'0'..=b'9' => Some(a - b'0'),
b'a'..=b'f' => Some(a - b'a' + 0xA),
_ => None,
}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This prompted me to look for a std solution and actually u8::from_str_radix
is available in core
so let's use that instead.
This PR makes more items public to enable other backends to implement the extension interface.
Motivated by the se050 backend, so this will stay as draft until the backend implements the trussed-auth functionality to avoid having many small PR for similar issues.