cronos
cronos copied to clipboard
Problem: no e2e encrypted messaging support
add commands for users to generate a separate keypair for asymmetric encryption, the pubkey is published to on-chain state for encryption, private key is saved in local keyring for decryption.
Libraries/Tools
We need something that can be used programmatically in golang.
- age seems to be a well-maintained library and tool for asymmetric encryption.
New Commands
cronosd gen-encryption-key [name]This command will generate a new key for age encryption, the private key is saved in the keyring, and the public key is outputted.cronosd set-encryption-key [pub-key] --from user-addressThe tx should be signed by the user, and the encryption key is stored associated with the user address.cronosd encrypt [recipients] [message]This command will load the associated encryption keys for one or many recipients, and encrypt the message to all of them.
User Flow
-
User generates a new keypair locally using
age-keygen:$ age-keygen -o privatekey.txt Public key: [PUBLIC KEY] -
User can publish a
[PUBLIC KEY]to chain:$ cronosd set-encryption-key [PUBLIC KEY] -
User save the private key in the keyring:
$ cronosd keyring-add-raw "encryptionkey" "$(cat privatekey.txt)" -
Third party then can encrypt private messages to multiple users:
$ cronosd encrypt [recipients] [MESSAGE]The encrypted message can be published anywhere, depending on the application.
Tracking
- [x] #1407 basic e2ee module structure
- [x] #1413
- [x] #1411
- [x] #1409
- [ ] #1415