symbol / mobile-wallet

Symbol Mobile Wallet
Apache License 2.0
8 stars 14 forks source link

[Android] Recipient can not see decrypted message #283

Open postoronnii opened 2 years ago

postoronnii commented 2 years ago

WTR:

  1. Send transaction with encrypted message from account A to B
  2. Try to decrypt this message from account B

Result: Blank field

image

cryptoBeliever commented 2 years ago

This issue is on current market application.

How to reproduce

Precondition:

Account X that doesn't have any outgoing transaction (public key not known to network) but has at least one incoming. Account Y that has outgoing transaction(s).

Steps:

  1. Init transaction from Y to X with the encrypted message.

Result: Recipient is not able read message.

Why This Happens

It happens because we are not able fetch public key of recipient to correctly encrypt message. In situation when account has incoming transactions but not outgoing API returns key contains 64 zeros. In such situation it should be also consider as unknown. Example: https://201-joey-dual.symboltest.net:3001/accounts/TDDWJ33SDOMDLPTINAJE2Q6VTY2IVJCUWEXIP4Q

{ "account": { "version": 1, "address": "98C764EF721B9835BE6868124D43D59E348AA454B12E87F2", "addressHeight": "62145", "publicKey": "0000000000000000000000000000000000000000000000000000000000000000", "publicKeyHeight": "0", "accountType": 0, "supplementalPublicKeys": {}, "activityBuckets": [], "mosaics": [ { "id": "3A8416DB2D53B6C8", "amount": "1000000" } ], "importance": "0", "importanceHeight": "0" }, "id": "61CF2EA5D1CB6A4DD7BE3A4A" }

Proposed Improvement

Not allow to send encrypted message if public key of recipient is unknown. Same as in desktop wallet. Current comparasion should be fixed: https://github.com/symbol/mobile-wallet/blob/dev/src/screens/Send.js#L305 and should also not allow if public key is only zeros. Desktop wallet checks that: https://github.com/symbol/desktop-wallet/blob/3e3f46f184e4700e52fd4b5520b91dcdd6e3f510/src/views/forms/FormTransferTransaction/FormTransferTransactionTs.ts#L568

postoronnii commented 2 years ago

@cryptoBeliever it's already implemented, I can not reproduce it this way.

cryptoBeliever commented 2 years ago

@NikolaiB edited the description a bit. Account X needs to have at least one incoming tx (but no outgoing).