Skip to content

Commit

Permalink
Provide an import command
Browse files Browse the repository at this point in the history
  • Loading branch information
mxcl committed Dec 20, 2024
1 parent 7bb160b commit 7f67658
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions bpb/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ fn main() -> Result<(), Error> {
bail!("Must specify a userid argument, e.g.: `bpb init \"username <email>\"`")
}
}
Some("import") => import(),
Some("upgrade") => upgrade(),
Some("print") => print_public_key(),
Some("--help") => print_help_message(),
Expand Down Expand Up @@ -145,6 +146,15 @@ fn upgrade() -> Result<(), Error> {
config.write()
}

fn import() -> Result<(), Error> {
let config = Config::load()?;
let service = config.service();
let account = config.user_id();

let key = std::env::args().nth(2).unwrap();
add_keychain_item(service, account, &key)
}

fn legacy_keys_file() -> String {
std::env::var("BPB_KEYS")
.unwrap_or_else(|_| format!("{}/.bpb_keys.toml", std::env::var("HOME").unwrap()))
Expand Down

0 comments on commit 7f67658

Please sign in to comment.