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 nonces = ram() // or any `random-access-storage` compliant object
const onwrite = hook(nonces, sharedSecret)
const replicate = require('hypercore-replicate')
const hypercore = require('hypercore')
const crypto = require('hypercore-crypto')
const hook = require('hypercore-xsalsa20-onwrite-hook')
const ram = require('random-access-memory')
const key = crypto.randomBytes(32)
const { publicKey, secretKey } = crypto.keyPair()
const nonces = ram()
const feed = hypercore(ram, publicKey, {
secretKey,
onwrite: hook(nonces, key)
})
const copy = hypercore(ram, publicKey, {
onwrite: hook(nonces, key)
})
feed.append(Buffer.from('hello'), (err) => {
feed.head(console.log) // ciphertext
})
replicate(feed, copy, (err) => {
copy.head(console.log) // plaintext
})
const onwrite = hook(nonceStorage, sharedKey)
Creates a onwrite()
hook for a Hypercore feed that uses the
xsalsa20 cipher to encipher or decipher blocks in a Hypercore feed.
Blocks that are written to a Hypercore feed are encrypted detached
from the nonce used for encryption. Nonces are written to a user
supplied "nonce storage" which can be reused for deciphering blocks
appended to a Hypercore feed.
This function preserves block sizes but requires an external storage
for nonces (nonceStorage
). Users should provide a random-access-storage
compliant instance or a factory function that returns one.
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.