Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
@adorsys/encrypt-down
Advanced tools
An abstract-leveldown implementation that wraps another store to encrypt values.
npm install @adorsys/encrypt-down
Without any options encrypt-down
can be used but nothing is encrypted.
const memdown = require('memdown')
const encryptdown = require('@adorsys/encrypt-down')
const levleup = require('levelup')
const db = levelup(encryptdown(memdown()))
db.put('key', { awesome: true }, function (err) {
db.get('key', function (err, value) {
console.log(value) // { awesome: true }
})
})
Can we specify the encryption that shall be used? Yes!
const memdown = require('memdown')
const encryptdown = require('@adorsys/encrypt-down')
const levleup = require('levelup')
// WARNING: do not use this codec in production it is NOT ENCRYPTING
const codec = {
encrypt: value => Promise.resolve(value),
decrypt: value => Promise.resolve(value)
}
const db = levelup(encryptdown(memdown(), { codec }))
db.put('key', { awesome: true }, function (err) {
db.get('key', function (err, value) {
console.log(value) // { awesome: true }
})
})
Is there an example that actually encrypts the values? Yes!
We can use an existing encryption library like jwe-codec
.
const memdown = require('memdown')
const encryptdown = require('@adorsys/encrypt-down')
const levleup = require('levelup')
const jwe = require('@adorsys/jwe-codec')
const key = {
kty: 'oct',
alg: 'A256GCM',
use: 'enc',
k: '123456789abcdefghijklmnopqrstuvwxyz12345678'
}
jwe(key).then(function(codec) {
const db = levelup(encryptdown(memdown(), { codec }))
db.put('key', { awesome: true }, function (err) {
db.get('key', function (err, value) {
console.log(value) // { awesome: true }
})
})
})
const db = require('@adorsys/encrypt-down')(db[, options])
db
must be an abstract-leveldown
compliant storeoptions
:
codec
:
encrypt
: function returning promise of encrypted valuedecrypt
: function returning promise of decrypted valueencrypt
and decrypt
both default to identity function when not explicitly specified.
Made with :heart: by radzom and all these wonderful contributors (emoji key):
Vincent Weevers :speech_balloon: |
---|
This project follows the all-contributors specification. Contributions of any kind are welcome!
FAQs
Encryption layer for level-db
The npm package @adorsys/encrypt-down receives a total of 66 weekly downloads. As such, @adorsys/encrypt-down popularity was classified as not popular.
We found that @adorsys/encrypt-down 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’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.