From d83b9188b755960f9d2458706cd34485505fc7b7 Mon Sep 17 00:00:00 2001 From: moneroexamples Date: Tue, 11 Jul 2017 07:59:52 +0800 Subject: [PATCH] add decrypting payments id8 obtained when using integrated address --- src/page.h | 13 ++++++++++++- src/templates/my_outputs.html | 7 ++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/page.h b/src/page.h index ffcb70c..b0bbe65 100644 --- a/src/page.h +++ b/src/page.h @@ -1745,7 +1745,6 @@ namespace xmreg << e.what() << endl; } - // get block cointaining this tx block blk; @@ -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} }; @@ -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}; diff --git a/src/templates/my_outputs.html b/src/templates/my_outputs.html index 69040a1..ac02d5f 100644 --- a/src/templates/my_outputs.html +++ b/src/templates/my_outputs.html @@ -10,7 +10,12 @@ {{/has_payment_id}} {{#has_payment_id8}} -
Payment id (encrypted): {{payment_id8}}
+ {{^decrypted_payment_id8}} +
Payment id (encrypted): {{payment_id8}}
+ {{/decrypted_payment_id8}} + {{#decrypted_payment_id8}} +
Payment id (decrypted): {{decrypted_payment_id8}}
+ {{/decrypted_payment_id8}} {{/has_payment_id8}}