Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
hypercore-xsalsa20-onwrite-hook
Advanced tools
A write hook to decrypt data using a XSalsa20 cipher into a hypercore storage when replicating from peers
A write hook to decrypt data using a XSalsa20 cipher into a hypercore storage when replicating from peers.
$ npm install hypercore-xsalsa20-onwrite-hook
const hook = require('hypercore-xsalsa20-onwrite-hook')
const feed = hypercore(storage, key, {
onwrite: hook({
nonce: storageNonce,
key: sharedStorageKey
})
})
const { keyPair } = require('hypercore-crypto')
const replicate = require('hypercore-replicate')
const hypercore = require('hypercore')
const xsalsa20 = require('xsalsa20-encoding')
const crypto = require('crypto')
const hook = require('hypercore-xsalsa20-onwrite-hook')
const ram = require('random-access-memory')
const key = crypto.randomBytes(32)
const nonce = crypto.randomBytes(32)
const onwrite = hook({ nonce, key })
const { publicKey, secretKey } = keyPair()
const valueEncoding = xsalsa20(nonce, key)
const feed = hypercore(ram, publicKey, { secretKey, valueEncoding })
feed.ready(() => {
const copy = hypercore(ram, publicKey, { onwrite })
const other = hypercore(ram, publicKey, { valueEncoding })
feed.append('hello')
replicate(feed, copy.replicate({ live: true }), other.replicate({ live: true }), {
userData: Buffer.from([0xfa, 0xce]),
live: true
})
copy.update(() => {
copy.head((err, buf) => {
console.log('%s', buf) // 'hello'
})
})
other.update(() => {
other.head((err, buf) => {
console.log('%s', buf) // 'hello'
})
})
})
hook = require('hypercore-xsalsa20-onwrite-hook')(opts)
where opts
can be:
{
nonce: [Buffer], // An optional 24 byte nonce. If not given, the hypercore's public key is used
key: Buffer, // A required shared 32 byte shared secret key
}
MIT
FAQs
A write hook to decrypt data using a XSalsa20 cipher into a hypercore storage when replicating from peers
The npm package hypercore-xsalsa20-onwrite-hook receives a total of 0 weekly downloads. As such, hypercore-xsalsa20-onwrite-hook popularity was classified as not popular.
We found that hypercore-xsalsa20-onwrite-hook demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 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.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.