Research
Security News
Threat Actor Exposes Playbook for Exploiting npm to Build Blockchain-Powered Botnets
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
lockit-couchdb-adapter
Advanced tools
CouchDB adapter for Lockit.
npm install lockit-couchdb-adapter
var adapter = require('lockit-couchdb-adapter');
The adapter automatically saves the necessary views to your CouchDB.
You only need the connection string in your config.js
.
exports.db = 'http://127.0.0.1:5984/';
or (long format with custom per-user-db prefix)
exports.db = {
url: 'http://127.0.0.1:5984/',
prefix: 'custom/' // default is 'lockit/'
}
adapter.save(name, email, pass, callback)
name
: String - i.e. 'john'email
: String - i.e. 'john@email.com'pass
: String - i.e. 'password123'callback
: Function - callback(err, user)
where user
is the new user now in our database.The user
object has the following properties
_id
: unique id from CouchDB_rev
: revision from CouchDBpassword_scheme
: pbkdf2iterations
: pbkdf2 iterationsname
: name chosen during sign upemail
: email that was provided at the beginningroles
: Array with roles a user has, default is ['user']
type
: document type for views, default is 'user'signupToken
: unique token sent to user's email for email verificationsignupTimestamp
: Date object to remember when the user signed upsignupTokenExpires
: Date object usually 24h ahead of signupTimestamp
failedLoginAttempts
: save failed login attempts during login process, default is 0
derived_key
: password hash generated by pbkdf2salt
: salt generated by crypto.randomBytes()
adapter.save('john', 'john@email.com', 'secret', function(err, user) {
if (err) console.log(err);
console.log(user);
// {
// _id: '8c7cd00c55a25ceb279a8e893d011b3e',
// _rev: '1-530a4cd8e67d51daf74e059899c39cd5',
// password_scheme: 'pbkdf2',
// iterations: 10,
// name: 'john',
// email: 'john@email.com',
// roles: [ 'user' ],
// type: 'user',
// signupToken: 'fed26ce9-2628-405a-b9fa-285d4a66f4c3',
// signupTimestamp: '2013-09-21T10:10:50.357Z',
// signupTokenExpires: '2014-01-15T15:27:29.020Z',
// failedLoginAttempts: 0,
// derived_key: '0a2b1714d6017e7efdc1154ee34c805dea29c06a',
// salt: '3a213c87b6a33c70fec767acea697994'
// }
});
adapter.find(match, query, callback)
match
: String - one of the following: 'name', 'email' or 'signupToken'query
: String - corresponds to match
, i.e. 'john@email.com'callback
: Function - callback(err, user)
adapter.find('name', 'john', function(err, user) {
if (err) console.log(err);
console.log(user);
// {
// _id: '8c7cd00c55a25ceb279a8e893d011b3e',
// _rev: '1-530a4cd8e67d51daf74e059899c39cd5',
// password_scheme: 'pbkdf2',
// iterations: 10,
// name: 'john',
// email: 'john@email.com',
// roles: [ 'user' ],
// type: 'user',
// signupToken: 'fed26ce9-2628-405a-b9fa-285d4a66f4c3',
// signupTimestamp: '2013-09-21T10:10:50.357Z',
// signupTokenExpires: '2014-01-15T15:27:29.020Z',
// failedLoginAttempts: 0,
// derived_key: '0a2b1714d6017e7efdc1154ee34c805dea29c06a',
// salt: '3a213c87b6a33c70fec767acea697994'
// }
});
adapter.update(user, callback)
user
: Object - must have _id
and _rev
propertiescallback
: Function - callback(err, user)
- user
is the updated user object// get a user from db first
adapter.find('name', 'john', function(err, user) {
if (err) console.log(err);
// add some new properties to our existing user
user.newKey = 'and some value';
user.hasBeenUpdated = true;
// save updated user to db
adapter.update(user, function(err, user) {
if (err) console.log(err);
// ...
});
});
adapter.remove(name, callback)
name
: Stringcallback
: Function - callback(err, res)
- res
is true
if everything went fineadapter.remove('john', function(err, res) {
if (err) console.log(err);
console.log(res);
// true
});
grunt
Copyright (C) 2013 [Mirco Zeiss](mailto: mirco.zeiss@gmail.com)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
0.5.1 / 2015-07-03
nano
FAQs
couchdb adapter for lockit
We found that lockit-couchdb-adapter demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
Security News
NVD’s backlog surpasses 20,000 CVEs as analysis slows and NIST announces new system updates to address ongoing delays.
Security News
Research
A malicious npm package disguised as a WhatsApp client is exploiting authentication flows with a remote kill switch to exfiltrate data and destroy files.