salty-nacl
v1.0.2
Published
'A tweetnacl encryption that you would understand. It allows you to pass passphrase in generating secret key, public key. The keys are presented in a human readable form'
Downloads
14
Maintainers
Readme
Salty-NaCl
Salty-NaCl is NaCl encryption/ decryption implementation that you can understand.
Install
$ npm install salty-nacl
Usage
const salty = require('salty-nacl');
#### Generating KeyPair with Passphrase
sender = salty.generateKeyPair("Africa is the land of my birth")
receiver = salty.generateKeyPair("Love is all you need")
badguy = salty.generateKeyPair("I want to break this")
//=> { publicKey,
// secretKey
// }
#### Generating Random Nonce
nonce = salty.getRandomNonce()
#### Encrypt Message
message= "Africa Unite"
encryptedMessage=salty.encrypt(message,nonce,receiver.publicKey,sender.secretKey)
#### Decrypt Message
decryptMessage = salty.decrypt(encryptedMessage,nonce,sender.publicKey,receiver.secretKey)
//=> "Africa Unite"
decryptMessage = salty.decrypt(encryptedMessage,nonce,sender.publicKey,badguy.secretKey)
//=> null
Related
TweetNaCl
License
MIT © Andrews Agyemang Opoku