npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@le-space/orbitdb-simple-encryption

v0.0.2

Published

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

Readme

OrbitDB Simple Encryption

Matrix npm (scoped) node-current (scoped)

Fork of @orbitdb/simple-encryption that adds experimental encrypted-database detection via isDatabaseEncrypted.
This fork is intended as a temporary workaround and may be removed once orbitdb/simple-encryption#1 is merged or a better upstream solution is available.

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 @le-space/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 '@le-space/orbitdb-simple-encryption'


// Instantiate encryption for either data, replication or both.
const replication = await SimpleEncryption({ password: 'hello' })
const data = await SimpleEncryption({ password: 'world' })

const encryption = { 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.
const db = await orbitdb.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 '@le-space/orbitdb-simple-encryption' 


// Instantiate encryption for either data, replication or both.
const replication = await SimpleEncryption({ password: 'hello' })
const data = await SimpleEncryption({ password: 'world' })

const encryption = { data, replication }

const dbAddress = '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.
const db = await orbitdb.open(dbAddress, { encryption })

Detecting Encrypted Databases

The isDatabaseEncrypted() function helps detect if a database is encrypted when it has been opened without any encryption options. It currently detects encryption in two main ways:

  • Data-only encryption: db.all() succeeds, entries exist, but their value fields are undefined (while hash is present).
  • Replication and/or data encryption: db.all() throws a TypeError such as Cannot read properties of undefined (reading 'value') because OrbitDB cannot decrypt the underlying log entries.
import SimpleEncryption, { isDatabaseEncrypted } from '@le-space/orbitdb-simple-encryption'

// Try opening database without encryption
const db = await orbitdb.open(address, {})

// Check if it's encrypted
const isEncrypted = await isDatabaseEncrypted(db)

if (isEncrypted) {
  // Application-specific flow: ask user for password / config
  const password = await promptForPassword()

  // Depending on how the DB was created, you may need:
  // - data encryption only
  // - replication encryption only
  // - or both
  const replication = await SimpleEncryption({ password })
  const data = await SimpleEncryption({ password })

  await db.close()

  // Example: open with both replication and data encryption
  const encryptedDb = await orbitdb.open(address, {
    encryption: { replication, data }
  })
}

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