Skip to content

Repository files navigation

OrbitDB Simple Encryption

Matrixnpm (scoped)node-current (scoped)

A simple password encryption module that encrypts data using AES-GCM PBKDF2.

NOTE This encryption module is not audited in any way for security and is intended for demonstration purposes only.

Install

This project uses npm and nodejs.

npm i @orbitdb/simple-encryption

Usage

To implement encryption within your database, create an encryption object and pass it to OrbitDB's open function:

import{createOrbitDB}from'@orbitdb/core'import{SimpleEncryption}from'@orbitdb/simple-encryption'// Instantiate encryption for either data, replication or both.constreplication=awaitSimpleEncryption({password: 'hello'})constdata=awaitSimpleEncryption({password: 'world'})constencryption={ data, replication }// Set up OrbitDB. See https://github.com/orbitdb/orbitdb/blob/main/docs/GETTING_STARTED.md for more information if you are unfamiliar with OrbitDB.constdb=awaitorbitdb.open('db-encrypted',{ encryption })

When replicating a database, initiate the same encryption configuration and pass it to open:

import{createOrbitDB}from'@orbitdb/core'import{SimpleEncryption}from'@orbitdb/simple-encryption'// Instantiate encryption for either data, replication or both.constreplication=awaitSimpleEncryption({password: 'hello'})constdata=awaitSimpleEncryption({password: 'world'})constencryption={ data, replication }constdbAddress='0x0'// the address of the remote database. // Set up OrbitDB. See https://github.com/orbitdb/orbitdb/blob/main/docs/GETTING_STARTED.md for more information if you are unfamiliar with OrbitDB.constdb=awaitorbitdb.open(dbAddress,{ encryption })

Contributing

Take a look at our organization-wide Contributing Guide. You'll find most of your questions answered there. Some questions may be answered in the FAQ, as well.

If you want to code but don't know where to start, check out the issues labelled "help wanted".

License

MIT OrbitDB Community

About

A simple password encryption module that encrypts data using AES-GCM PBKDF2.

Resources

Code of conduct

Contributing

Stars

6 stars

Watchers

3 watching

Forks

Releases

Packages

Used by

Contributors

Languages