-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Common API changes needed to (later) add caBLE support.
- Loading branch information
Showing
31 changed files
with
1,703 additions
and
515 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
extern crate tracing; | ||
|
||
use std::fs::OpenOptions; | ||
|
||
use clap::{Args, Parser, Subcommand}; | ||
use webauthn_authenticator_rs::softtoken::{SoftToken, SoftTokenFile}; | ||
|
||
#[derive(Debug, clap::Parser)] | ||
#[clap(about = "SoftToken management tool")] | ||
pub struct CliParser { | ||
#[clap(subcommand)] | ||
pub commands: Opt, | ||
} | ||
|
||
#[derive(Debug, Subcommand)] | ||
pub enum Opt { | ||
Create(CreateArgs), | ||
} | ||
|
||
#[derive(Debug, Args)] | ||
pub struct CreateArgs { | ||
#[clap()] | ||
pub filename: String, | ||
} | ||
|
||
fn main() { | ||
use Opt::*; | ||
|
||
let opt = CliParser::parse(); | ||
tracing_subscriber::fmt::init(); | ||
match opt.commands { | ||
Create(args) => { | ||
let (token, _) = SoftToken::new().unwrap(); | ||
let f = OpenOptions::new() | ||
.write(true) | ||
.create_new(true) | ||
.open(args.filename) | ||
.unwrap(); | ||
let authenticator = SoftTokenFile::new(token, f); | ||
drop(authenticator); | ||
} | ||
} | ||
} |
Oops, something went wrong.