Wrapper around hypercore that supports encryption
Switch branches/tags
Nothing to show
Clone or download
Cannot retrieve the latest commit at this time.
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
libs
tests
.gitignore
LICENSE
README.md
index.js
package.json

README.md

hypercore-encrypted

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.

Usage

Install it using npm:

npm i hypercore-encrypted
const ram = require('random-access-memory')
const CryptoBook = require('./libs/CryptoBook.js') // relative to index.js

// if you do not want to use encryption, add the option noEncryption: true
var feed = hypercore(() => { return ram() }, null, {
    encryptionKeyBook: new CryptoBook()
})

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

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

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.