louib / challenge-response

Perform HMAC-SHA1 and OTP challenges with YubiKey, OnlyKey and NitroKey, in pure Rust.
Other
4 stars 1 forks source link

refactor: reuse read_serial fn with nusb #58

Closed louib closed 1 month ago

louib commented 1 month ago

Looks like the serial_number() function will not populate the serial number on the devices when using the nusb backend, so this PR moves the read_serial_from_device function to the generic Backend implementation, and reuses it in the nusb backend. I also noticed that the top-level read_serial_number and the read_serial_from_device functions were exactly the same except for the interface, so we're now reusing the backend to serve the request instead of duplicating the code.