/zmsg

Send encrypted messages and decrypt them without sharing keys. Built using the Handshake blockchain.

Primary LanguageJavaScript

zooko-msg

Encrypt and decrypt messages using AES with a common ECDH key generated using keys associated with Handshake names.

Learn more by joining the Handshake Discord Community

I noticed that there wasn't an encrypt/decrypt function natively provided in Handshake, so I built this using concepts introduced earlier in the Bitcoin space. The benefit of this implementation is that it is complete because of Handshake names. Zooko's Triangle is solved with Handshake making crypto better than ever!

1

2

3

4

How it works

Basically, your private key is used in conjunction with the recipient's public key to generate a common key. This common key must not be shared. Instead, you can simply share the ciphertext and the initialization vector (IV). The system uses hsencrypt under the hood which handles the ECDH, AES and keyfinding operations.

Also go on chain

You can also use zmsg-broadcast which is the same as zmsg, except it will put your message on chain. Then, someone can use zmsgpull to pull messages, and then zmsgread to read them.

The benefit of this is that you can encrypt messages and send them. The world will know you encrypted a message and sent it, but it will not know to whom it was for or what it said.

Of course, opponents might have issue with using a chain for this purpose, but I feel the benefits outweight the cons.

Installation Instructions

  1. Clone
git clone https://github.com/publiusfederalist/zooko-msg
  1. Get the npms
cd zooko-msg
npm install hsd hs-client readline stream hsencrypt consoleinout
  1. Setup your hsd keys folder
echo "someapikey" > keys/node
echo "somewalletkey" > keys/wallet

You can get these with hsd. Make sure hsd has all the index-tx, index-address and other options enabled.

  1. Run commands!

Commands

Encryption

zmsg <yourname> <theirname> "<msg>"

Decryption

zmsg <theirname> <yourname> <encrypted> <iv>

Blockchain

You can also use zmsg-broadcast which will actually write this to the blockchain.

Copyright

Copyright (c) 2022 Publius Federalist

All Rights Reserved

MIT LICENSED.