Add setup instructions
This commit is contained in:
parent
ac9f033656
commit
3794c4d175
18
src/main.rs
18
src/main.rs
@ -20,7 +20,10 @@ struct Args {
|
|||||||
|
|
||||||
#[derive(Subcommand, Debug)]
|
#[derive(Subcommand, Debug)]
|
||||||
enum SubCommands {
|
enum SubCommands {
|
||||||
/// Get a code
|
/// Setup configuration
|
||||||
|
Setup,
|
||||||
|
|
||||||
|
/// Get a TOTP code
|
||||||
#[clap(arg_required_else_help = true)]
|
#[clap(arg_required_else_help = true)]
|
||||||
Code {
|
Code {
|
||||||
/// The secret to use
|
/// The secret to use
|
||||||
@ -34,13 +37,24 @@ enum SubCommands {
|
|||||||
/// Size of generated secret
|
/// Size of generated secret
|
||||||
#[clap(short, long, default_value_t = 6)]
|
#[clap(short, long, default_value_t = 6)]
|
||||||
len: usize,
|
len: usize,
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let args: Args = Args::parse();
|
let args: Args = Args::parse();
|
||||||
|
|
||||||
match args.command {
|
match args.command {
|
||||||
|
SubCommands::Setup => {
|
||||||
|
println!("To configure TOPT :");
|
||||||
|
println!("1. Please open https://mysignins.microsoft.com/security-info");
|
||||||
|
println!("2. Click on \"Add method\"");
|
||||||
|
println!("3. On the popup that appears, choose \"Authenticator app\" and click \"Add\".");
|
||||||
|
println!("4. Click on \"I want to use a different authenticator app\" and click \"Next\"");
|
||||||
|
println!("5. Click on \"Can't save image ?\" and copy the \"Secret key\"");
|
||||||
|
println!("6. Re-run this program running {} code --secret <SECRET>", std::env::args().next().unwrap());
|
||||||
|
println!("7. Back on the browser, click Next and paste copied code");
|
||||||
|
}
|
||||||
|
|
||||||
SubCommands::Code { secret, topt_step, len } => {
|
SubCommands::Code { secret, topt_step, len } => {
|
||||||
let totp_generator = TotpGenerator::new()
|
let totp_generator = TotpGenerator::new()
|
||||||
.set_digit(len).unwrap()
|
.set_digit(len).unwrap()
|
||||||
|
Loading…
Reference in New Issue
Block a user