Hivecrypt: JavaScript module for Steem memo encrypt/decrypt on wide range of environments by techcoderx

View this thread on steempeak.com
· @techcoderx · (edited)
$0.10
Hivecrypt: JavaScript module for Steem memo encrypt/decrypt on wide range of environments
<center>![Hivecrypt thumbnail.png](https://ipfs.io/ipfs/QmZ44f49mDr746uqisE11de6WXa3ojka4oecYTsvTo6BNb)</center>

Are you getting the following error message when trying to encrypt or decrypt a Steem memo in ElectronJS or React Native using [steem-js](https://github.com/steemit/steem-js)? Perhaps looking for something that works for your framework that you're using when building your cutting-edge Steem DApp?

<center>![Screenshot 20201122 at 12.04.23 PM.png](https://files.peakd.com/file/peakd-hive/techcoderx/kpahmLHh-Screenshot202020-11-2220at2012.04.2320PM.png)</center>

Introducing [Hivecrypt](https://github.com/techcoderx/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](https://peakd.com/hive-139531/@tngflx/contribution-to-dhive-added-memo-encryption-and-decrypt-feature) on [dhive](https://gitlab.syncad.com/hive/dhive) that was never merged into `master` (plus the major help from this [file](https://github.com/mahdiyari/hive-tx-js/blob/master/helpers/crypto.js)), Hivecrypt was built on [Crypto-JS](https://github.com/brix/crypto-js) that works on virtually any latest JavaScript environments, unlike the implementation on [steem-js](https://github.com/steemit/steem-js) and the pull request mentioned above, that uses the [crypto](https://nodejs.org/api/crypto.html) 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 [steem-js](https://github.com/steemit/steem-js), 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.
👍  , , , , , , , , , , , , , , , , , , , , ,
properties (23)
post_id88,514,474
authortechcoderx
permlinkhivecrypt-javascript-module-for-steem-memo-encrypt-decrypt-on-wide-range-of-environments
categoryencryption
json_metadata{"app":"steempeak\/2020.07.1","format":"markdown","tags":["encryption","decryption","dev","memo","nodejs","javascript","hivecrypt","crypto","hive"],"users":["tngflx"],"links":["https:\/\/github.com\/steemit\/steem-js","https:\/\/github.com\/techcoderx\/hivecrypt","https:\/\/peakd.com\/hive-139531\/@tngflx\/contribution-to-dhive-added-memo-encryption-and-decrypt-feature","https:\/\/gitlab.syncad.com\/hive\/dhive","https:\/\/github.com\/mahdiyari\/hive-tx-js\/blob\/master\/helpers\/crypto.js","https:\/\/github.com\/brix\/crypto-js","https:\/\/github.com\/steemit\/steem-js","https:\/\/nodejs.org\/api\/crypto.html","https:\/\/github.com\/steemit\/steem-js"],"image":["https:\/\/ipfs.io\/ipfs\/QmZ44f49mDr746uqisE11de6WXa3ojka4oecYTsvTo6BNb","https:\/\/files.peakd.com\/file\/peakd-hive\/techcoderx\/kpahmLHh-Screenshot202020-11-2220at2012.04.2320PM.png"]}
created2020-11-22 13:30:09
last_update2020-11-22 13:30:42
depth0
children0
net_rshares457,571,508,423
last_payout2020-11-29 13:30:09
cashout_time1969-12-31 23:59:59
total_payout_value0.048 SBD
curator_payout_value0.047 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length2,514
author_reputation27,683,578,118,267
root_title" Hivecrypt: JavaScript module for Steem memo encrypt/decrypt on wide range of environments"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
author_curate_reward""
vote details (22)