Skip to content

Commit 50e647e

Browse files
authored
fix: 🚀 remove otp-uri argument as now otp uris can be imported (#397)
otp uri argument in add subcommand can be misleading
2 parents cb58b67 + 809e667 commit 50e647e

File tree

2 files changed

+3
-14
lines changed

2 files changed

+3
-14
lines changed

src/args.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,6 @@ enum CotpSubcommands {
3131

3232
#[derive(Args)]
3333
pub struct AddArgs {
34-
/// Add OTP code via an OTP URI
35-
#[arg(short = 'u', long = "otpuri", required_unless_present = "label")]
36-
pub otp_uri: bool,
37-
3834
/// Specify the OTP code type
3935
#[arg(short = 't', long = "type", default_value = "totp")]
4036
pub otp_type: OTPType,
@@ -44,7 +40,7 @@ pub struct AddArgs {
4440
pub issuer: String,
4541

4642
/// Code label
47-
#[arg(short, long, required_unless_present = "otp_uri")]
43+
#[arg(short, long, required = true)]
4844
pub label: Option<String>,
4945

5046
/// OTP Algorithm

src/argument_functions.rs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ use crate::importers::authy_remote_debug::AuthyExportedList;
77
use crate::importers::converted::ConvertedJsonList;
88
use crate::importers::freeotp_plus::FreeOTPPlusJson;
99
use crate::importers::importer::import_from_path;
10-
use crate::otp::from_otp_uri::FromOtpUri;
1110
use crate::otp::otp_element::{OTPDatabase, OTPElement};
1211
use crate::utils;
1312
use color_eyre::eyre::{eyre, ErrReport};
@@ -49,14 +48,8 @@ pub fn import(matches: ImportArgs, mut database: OTPDatabase) -> color_eyre::Res
4948
}
5049

5150
pub fn add(matches: AddArgs, mut database: OTPDatabase) -> color_eyre::Result<OTPDatabase> {
52-
let otp_element = if matches.otp_uri {
53-
let mut otp_uri = rpassword::prompt_password("Insert the otp uri: ").unwrap();
54-
let result = OTPElement::from_otp_uri(otp_uri.as_str());
55-
otp_uri.zeroize();
56-
result?
57-
} else {
58-
get_from_args(matches)?
59-
};
51+
let otp_element = get_from_args(matches)?;
52+
6053
if !otp_element.valid_secret() {
6154
return Err(ErrReport::msg("Invalid secret."));
6255
}

0 commit comments

Comments
 (0)