
Product
Rust Support in Socket Is Now Generally Available
Socket’s Rust and Cargo support is now generally available, providing dependency analysis and supply chain visibility for Rust projects.
hypercore-encryption
Advanced tools
Dyanmic Hypercore encryption provider
const HypercoreEncryption = require('hypercore-encryption')
const encryption = new HypercoreEncryption({
blindingKey,
getBlockKey (id, contexxt) {
// get key info corresponding to id and context...
return {
version, // encryption scheme
padding, // padding byte length
key // block key
}
}
})
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, getBlindingKey })Instantiate a new encryption provider. Optionally pass a preopen promise that resolves to a key id to be loaded initially.
Provide a hooks with the signature:
function getBlockKey (id, context) {
// context provides information about the core, eg:
// context.key
// context.manifest
// id id is passed as -1, the module expects the key to be updated
return {
version, // encryption scheme
padding, // padding byte length
key // block key
}
}
function getBlockKey (context) {
return blindingKey // 32 byte blinding key
}
const padding = enc.padding(context)The number of padding bytes.
enc.seekableBoolean on whether the current scheme allows for seeks.
enc.versionThe version of the currently loaded scheme.
await enc.load(id, context)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.
const blockKey = HypercoreEncryption.getBlockKey(hypercoreKey, encryptionKey)Helper to generate namespaced block keys.
Apache-2.0
FAQs
Block encryption provider for hypercore
The npm package hypercore-encryption receives a total of 11 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
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.

Research
Five coordinated Chrome extensions enable session hijacking and block security controls across enterprise HR and ERP platforms.