Why was this created?
I needed a way to encrypt and decrypt messages using Hive posting keys in Electron apps, however the methods provided by hive-js are not supported in those environments due to the usage of libraries that are only available in Node JS and browsers natively.
npm i hivecrypt
Then import it as a module with
const hivecrypt = require('hivecrypt').
Include in HTML:
The Hivecrypt methods will be accessible through
Encrypt a memo
let encrypted = hivecrypt.encode('5Jprivatekey1','STMpublickey2','#messageToEncrypt') console.log(encrypted)
Decrypt a memo
let decrypted = hivecrypt.decode('5privatekey','#encryptedMessage') console.log(decrypted)
Generate a random WIF-encoded private key
let randomWif = hivecrypt.randomWif() console.log(randomWif) // 5JBBPcSkrsvmAmvmex9aC4NNGvZsU87eePzpbFpD9PZRtgGoBKh