Skip to content

Commit

Permalink
add decrypting payments id8 obtained when using integrated address
Browse files Browse the repository at this point in the history
  • Loading branch information
moneroexamples committed Jul 11, 2017
1 parent c44fa88 commit d83b918
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
13 changes: 12 additions & 1 deletion src/page.h
Original file line number Diff line number Diff line change
Expand Up @@ -1745,7 +1745,6 @@ namespace xmreg
<< e.what() << endl;
}


// get block cointaining this tx
block blk;

Expand Down Expand Up @@ -1790,6 +1789,7 @@ namespace xmreg
{"has_payment_id8" , txd.payment_id8 != null_hash8},
{"payment_id" , pid_str},
{"payment_id8" , pid8_str},
{"decrypted_payment_id8", string{}},
{"tx_prove" , tx_prove}
};

Expand All @@ -1814,6 +1814,17 @@ namespace xmreg
return string("Cant get key_derivation");
}

// decrypt encrypted payment id, as used in integreated addresses
crypto::hash8 decrypted_payment_id8 = txd.payment_id8;

if (decrypted_payment_id8 != null_hash8)
{
if (decrypt_payment_id(decrypted_payment_id8, pub_key, prv_view_key))
{
context["decrypted_payment_id8"] = pod_to_hex(decrypted_payment_id8);
}
}

mstch::array outputs;

uint64_t sum_xmr {0};
Expand Down
7 changes: 6 additions & 1 deletion src/templates/my_outputs.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@ <H5 style="margin:5px">Payment id: {{payment_id}}</H5>
{{/has_payment_id}}

{{#has_payment_id8}}
<H5 style="margin:5px">Payment id (encrypted): {{payment_id8}}</H5>
{{^decrypted_payment_id8}}
<H5 style="margin:5px">Payment id (encrypted): {{payment_id8}}</H5>
{{/decrypted_payment_id8}}
{{#decrypted_payment_id8}}
<H5 style="margin:5px">Payment id (decrypted): {{decrypted_payment_id8}}</H5>
{{/decrypted_payment_id8}}
{{/has_payment_id8}}


Expand Down

0 comments on commit d83b918

Please sign in to comment.