Skip to content

Commit

Permalink
new phone # claim type, fixing bug with claim listing where short id …
Browse files Browse the repository at this point in the history
…was passed in incorrectly
  • Loading branch information
orthecreedence committed Feb 18, 2024
1 parent 67c8e46 commit 81c4f76
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/commands/claim.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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())?;
Expand All @@ -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)
Expand Down Expand Up @@ -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) => {
Expand Down
12 changes: 12 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.")
Expand Down Expand Up @@ -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::<String>("TYPE")
Expand Down

0 comments on commit 81c4f76

Please sign in to comment.