Hivecrypt: JavaScript module for Blurt memo encrypt/decrypt on wide range of environments

in encryption •  4 years ago 

Hivecrypt thumbnail.png

Are you getting the following error message when trying to encrypt or decrypt a Blurt memo in ElectronJS or React Native using blurtjs? Perhaps looking for something that works for your framework that you're using when building your cutting-edge Blurt DApp?

Screenshot 20201122 at 12.04.23 PM.png

Introducing Hivecrypt, a module that you can import into a wide range of JavaScript environments, including desktop and mobile app frameworks like ElectronJS, that wouldn't otherwise work with existing libraries.

Adapted from this pull request on dhive that was never merged into master (plus the major help from this file), Hivecrypt was built on Crypto-JS that works on virtually any latest JavaScript environments, unlike the implementation on blurtjs and the pull request mentioned above, that uses the crypto NodeJS module that only works on certain environments.

How to use?

Hivecrypt can be installed from npm with the following command:

npm i hivecrypt

It can also be imported into the browser by including the following script tag in your HTML file, where Hivecrypt will be available through window.hivecrypt:

<script src="https://unpkg.com/hivecrypt/bin/hivecrypt.min.js"></script>

Once installed, it may be used for encrypting and decrypting memos just like how it is done with blurtjs, but works in more environments.

const hivecrypt = require('hivecrypt') // CommonJS

let encrypted = hivecrypt.encode('privatekey1','publickey2','#somesecretmessage')
let decrypted = hivecrypt.decode('privatekey2',encrypted)

console.log(encrypted,decrypted)

It might not be built with optimizing for the smallest package size in mind, but at least it is something that is usable for devs. And yes, it was originally written for Hive but works for any 3 character public key prefixes.

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE BLURT!
Sort Order:  
  ·  3 years ago  ·  

Hey…. Great to see you here on Blurt. Thanks for all the help on Dtube. Loving it over there too. I should have been posting my videos there for years. Better late than never eh

  ·  3 years ago  ·  

Vote for our Witness
@tracy55

We have a TRC20, VKRW we are supporting with the income
https://blultwallet.com/~witnesses