~ev/dexbox

72339f46cc6d5dce7056166cf2bcb34f8c007c8d — Ev Bogue 3 years ago e1e8008
send message to yourself if no publickey is provided
2 files changed, 14 insertions(+), 4 deletions(-)

M README.md
M dexbox.js
M README.md => README.md +7 -1
@@ 20,7 20,6 @@ To encrypt a message you need to write your message into the command line:
```
node dexbox <publickey> 'Hello World!'
```

If you don't already have a keypair, `dexbox` will generate you an `ed25519curve` keypair and save it to disk as `keypair`.

example:


@@ 28,6 27,13 @@ example:
node dexbox 'aW83Fju6D89MZJdZrOb39++9br5S+TYKPXjg2SSEhXE=' 'Hello World!'
```

To send a photo to yourself just leave out the public key:

```
node dexbox 'Hello World!'
```


If you've done everything right, dexbox will encrypt the message to the recp you've specified and then save the file as a hex encoded hash in a folder called boxes. It'll also console.log the boxed message.

### protocol

M dexbox.js => dexbox.js +7 -3
@@ 12,9 12,13 @@ var dex = require('./crypto.js')

var keys = dex.keys()

var recp = nacl.util.decodeBase64(process.argv[2])

var message = nacl.util.decodeUTF8(process.argv[3])
if (!process.argv[3]) {
  var recp = keys.publicKey
  var message = nacl.util.decodeUTF8(process.argv[2])
} else {
  var recp = nacl.util.decodeBase64(process.argv[2])
  var message = nacl.util.decodeUTF8(process.argv[3])
}

var nonce = nacl.randomBytes(nacl.box.nonceLength)