mirror of
https://github.com/trussed-dev/trussed-auth.git
synced 2026-06-20 04:16:21 -07:00
Make PinId methods public
This commit is contained in:
committed by
sosthene-nitrokey
parent
203a90dd13
commit
0da268da20
+6
-2
@@ -110,7 +110,10 @@ const BACKEND_DIR: &str = "backend-auth";
|
||||
pub struct PinId(u8);
|
||||
|
||||
impl PinId {
|
||||
fn path(&self) -> PathBuf {
|
||||
/// Get the path to the PIN id.
|
||||
///
|
||||
/// Path are of the form `pin.XX` where `xx` is the hexadecimal representation of the PIN number.
|
||||
pub fn path(&self) -> PathBuf {
|
||||
let mut path = [0; 6];
|
||||
path[0..4].copy_from_slice(b"pin.");
|
||||
path[4..].copy_from_slice(&self.hex());
|
||||
@@ -118,7 +121,8 @@ impl PinId {
|
||||
PathBuf::from(&path)
|
||||
}
|
||||
|
||||
fn hex(&self) -> [u8; 2] {
|
||||
/// Get the hex representation of the PIN id
|
||||
pub fn hex(&self) -> [u8; 2] {
|
||||
const CHARS: &[u8; 16] = b"0123456789abcdef";
|
||||
[
|
||||
CHARS[usize::from(self.0 >> 4)],
|
||||
|
||||
Reference in New Issue
Block a user