Wrapper around hypercore that supports encryption
Branch: master
Clone or download
Pull request Compare This branch is even with fsteff:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.



Wrapper around hypercore that supports encryption
Warning: this is experimental, there certainly are bugs and everything is subject to change!

hypercore-encrypted is derived from hypercore and if a list of keys is provided it encrypts all data appended to the feed and decrypts on read access. For encryption AES in CTR mode is used. For the IV (counter) the position/offset is used.
It supports multiple keys to enable sharing an feed up to a certain version, while newer entries remain encrypted.


Install it using npm:

npm i hypercore-encrypted
const ram = require('random-access-memory')
const CryptoLib = require('../libs/CryptoLib')
const cryptoLib = CryptoLib.getInstance() // handles all encryption keys

// if you do not want to use encryption, add the option noEncryption: true
var feed = hypercore(ram(), null)

// to add a new encryption key (one is created by default)

// then use it as if it was a normal hypercore...

// TODO: more API spec

What is it for?

I am currently writing a proposal for a bigger project called DatFS, which would heaviliy depend on the encrpytion.
Also, I believe many p2p apps could use encrypted dats. I would really like to see this or a similar feature being integrated into the official dat codebase.

Any feedback is welcome! I still have much to learn, so don't hesitate to tell me what you think about my work.