
Product
Introducing Custom Tabs for Org Alerts
Create and share saved alert views with custom tabs on the org alerts page, making it easier for teams to return to consistent, named filter sets.
hypercore-encryption
Advanced tools
Dyanmic Hypercore encryption provider
const HypercoreEncryption = require('hypercore-encryption')
async function get (id) {
// get key info corresponding to id...
return {
version, // encryption scheme
padding, // padding byte length
key // block key
}
}
const encryption = new HypercoreEncryption(blindingKey, get, {
preopen: Promise.resolve(1) // optionally pass for initial id
})
const core = new Hypercore(storage, { encryption })
await core.ready()
await core.append('encrypt with key 1')
await encryption.load(99)
await core.append('encrypt with key 99')
const enc = new HypercoreEncryption(blindingKey, getBlockKey, { promise })Instantiate a new encryption provider. Optionally pass a preopen promise that resolves to a key id to be loaded initially.
Provide a hook with the signature:
function getBlockKey (id) {
return {
version, // encryption scheme
padding, // padding byte length
key // block key
}
}
Note: in compat mode, the key info returned at 0 should always be version 0.
await enc.ready()Wait for initial key to load if provided.
enc.paddingThe number of padding bytes used by the current scheme.
enc.seekableBoolean on whether the current scheme allows for seeks.
enc.idThe currently loaded key id.
enc.versionThe version of the currently loaded scheme.
await enc.load(id)Load the key under id and set to be the current encryption info.
await enc.encrypt(index, block, fork)Encrypt a block in place.
await enc.decrypt(index, block)Decrypt a block in place.
HypercoreEncryption.isHypercoreEncryption(enc)Returns a boolean on whether enc is a valid encryption provider.
const blockKey = HypercoreEncryption.getBlockKey(hypercoreKey, encryptionKey)Helper to generate namespaced block keys.
const legacy = HypercoreEncryption.createLegacyProvider(blockKey)Create an encryption provider compatible with Hypercore's legacy encryption scheme.
Apache-2.0
FAQs
Block encryption provider for hypercore
The npm package hypercore-encryption receives a total of 7 weekly downloads. As such, hypercore-encryption popularity was classified as not popular.
We found that hypercore-encryption demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Create and share saved alert views with custom tabs on the org alerts page, making it easier for teams to return to consistent, named filter sets.

Product
Socket’s Rust and Cargo support is now generally available, providing dependency analysis and supply chain visibility for Rust projects.

Security News
Chrome 144 introduces the Temporal API, a modern approach to date and time handling designed to fix long-standing issues with JavaScript’s Date object.