Open robin-nitrokey opened 1 year ago
Decoding a QR code should be easy to implement with pyzbar. Capturing it from the screen would probably be more complicated.
For reference, here is a Rust implementation of this feature for nitrocli
: https://git.ireas.org/nitrocli-otp-qr/tree/src/main.rs
Implementation idea: Add a class for the OTP data and add multiple constructors, e. g. from_raw_bytes
, from_base32
, from_otp_uri
. This would have the side effects of moving base32 decoding from the CLI into the library and making the API safer because it is harder to use the wrong encoding.
Many services use OTP URIs to configure OTP devices. It would be useful to be able to directly pass such a URI to pynitrokey instead of having to manually interpret it. As a second step, we could even support parsing QR codes with OTP URIs.