Currently the parity json api allow to encrypt arbitrary data with arbitrary public key.
https://github.com/paritytech/parity/wiki/JSONRPC-parity-module#parity_encryptmessage
This is useful but in most case dapp only have access to the ethereum address.
It would be nice to either
We could actually provide both option
Unless I'm mistaken, un-hashing the public address is not possible. However, exposing an API which allows to use a Parity account to encrypt a message to, should certainly work.
It's should also be possible for accounts that have sent at least one transaction, we can recover the public key from the signature.
I will close this issue, cause I think that we'll never implement it. There are few technical/design difficulties which makes this rpc method not possible to implement or useless.
address -> public entries there, but it's just unnecessary bloat and with the current size of the state, it's not racionalThank @debris for commenting. the reasoning make sense.
I'd like to mention that the original use case that lead me to post the issue in the first place was about encrypting the user own data for later use, hence would not require the database overhead and the solution you mention in 1 and 2 could be used.
So could we reconsider this issue on that ground or maybe create a new one that explicit focus on the ability for a user to encrypt data for later use without requiring authentication?
Think of a dapp that decrypt data on launch (asking user permission), then as the user use the dapp, the dapp continously encrypt the changes without requiring permission (so the user can quit the app at any time). Then upon reloading the dapp, the user can decrypt (asking permission again) and start use the dapp with the perviously saved data.
We could either have a modified version parity_encryptMessage that will give an error when asking to encrypt data for an account it has no private key
Alternatively and probably better, we could have a method getPublicKey that would return the user public key.
Regarding the need to ask permission for when the account nonce is zero (no transaction have yet revealed the account's public key to the world) I would argue that permission should not be required at all as it is implicit that account used in the context of dapp will generate transaction at some point and thus are inherently hot wallet.
Most helpful comment
Unless I'm mistaken, un-hashing the public address is not possible. However, exposing an API which allows to use a Parity account to encrypt a message to, should certainly work.