diff --git a/src/commands/claim.rs b/src/commands/claim.rs index 781acd1..a74d371 100644 --- a/src/commands/claim.rs +++ b/src/commands/claim.rs @@ -149,6 +149,10 @@ pub fn view(id: &str, claim_id: &str, output: &str) -> Result<()> { let val = unwrap_maybe(maybe, masterkey_fn)?; Vec::from(val.as_bytes()) } + ClaimSpec::PhoneNumber(maybe) => { + let val = unwrap_maybe(maybe, masterkey_fn)?; + Vec::from(val.as_bytes()) + } _ => Err(anyhow!("Viewing is not implemented for this claim type"))?, }; util::write_file(output, output_bytes.as_slice())?; @@ -159,7 +163,7 @@ pub fn list(id: &str, private: bool, verbose: bool) -> Result<()> { let transactions = id::try_load_single_identity(id)?; let identity = util::build_identity(&transactions)?; let master_key_maybe = if private { - let master_key = util::passphrase_prompt(format!("Your master passphrase for identity {}", IdentityID::short(id)), identity.created())?; + let master_key = util::passphrase_prompt(format!("Your master passphrase for identity {}", IdentityID::short(&format!("{}", identity.id()))), identity.created())?; identity.test_master_key(&master_key) .map_err(|e| anyhow!("Incorrect passphrase: {:?}", e))?; Some(master_key) @@ -292,6 +296,7 @@ pub fn print_claims_table(claims: &Vec<(Claim, Timestamp)>, master_key_maybe: Op ClaimSpec::Domain(domain) => ("domain", extract_str!(domain)), ClaimSpec::Url(url) => ("url", extract_str!(url, |x: Url| String::from(x))), ClaimSpec::Address(address) => ("address", extract_str!(address)), + ClaimSpec::PhoneNumber(number) => ("phone #", extract_str!(number)), ClaimSpec::Relation(relation) => { let rel_str = match relation { MaybePrivate::Public(relationship) => { diff --git a/src/main.rs b/src/main.rs index da03ddd..1370332 100644 --- a/src/main.rs +++ b/src/main.rs @@ -356,6 +356,15 @@ fn run() -> Result<()> { .arg(claim_private_arg()) .arg(claim_name_arg()) ) + .subcommand( + Command::new("phone") + .about("Claim a phone number. (Hint: you might want the -p flag with this unless you like phone calls about your car's extended warranty)") + .arg(id_arg("The ID of the identity we want to add a claim to. This overrides the configured default identity.")) + .arg(stage_arg()) + .arg(signwith_arg()) + .arg(claim_private_arg()) + .arg(claim_name_arg()) + ) .subcommand( Command::new("relation") .about("Claim that you are in a relationship with another identity.") @@ -1281,6 +1290,9 @@ fn run() -> Result<()> { Some(("address", args)) => { easy_claim! { args, new_address, "Enter your address" } } + Some(("phone", args)) => { + easy_claim! { args, new_phone, "Enter your phone number" } + } Some(("relation", args)) => { let (id, private, name, stage, sign_with) = claim_args!(args); let ty = args.get_one::("TYPE")