wisespace-io / yubico-rs

Yubikey client API library, Challenge-Response & Configuration
Other
52 stars 13 forks source link

Fix minimal example #25

Closed mihaigalos closed 2 years ago

mihaigalos commented 2 years ago

This PR fixes the minimal "default" example on how to validate an OTP. I'm contributing this because I ran the 1st, simplest example but it didn't work because of an unknown reason:

/tmp/tmp.R4rXVYa3vY/yubico-rs master » cargo run --example otp                                                                                                                                                       
   Compiling yubico v0.11.0 (/tmp/tmp.R4rXVYa3vY/yubico-rs)                                                                                                                                                          
    Finished dev [unoptimized + debuginfo] target(s) in 2.84s                                                                                                                                                        
     Running `target/debug/examples/otp`                                                                                                                                                                             
Error: The OTP has invalid format. 

The reason turned out to be hard-coded variables in the otp.rs.

With this PR, I'm realigning the file to others in the hierarchy.


The output is now:

/tmp/tmp.Y7icMn2EZB/yubico-rs fix/minimal-example » cargo run --release --example otp
    Finished release [optimized] target(s) in 0.06s
     Running `target/release/examples/otp`
Please plug in a yubikey and enter an OTP
ccccccXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
The OTP is valid.
pierre-l commented 2 years ago

Looks good to me. Thank you @mihaigalos!