🚀 Socket Launch Week 🚀 Day 2: Introducing Repository Labels and Security Policies.Learn More
Socket
Sign inDemoInstall
Socket

accountdown-token

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

accountdown-token - npm Package Compare versions

Comparing version

to
0.1.2

LICENSE

4

index.js
/*!
* accountdown-token <https://github.com/doowb/accountdown-token>
*
* Copyright (c) 2015 Brian Woodward, contributors.
* Licensed under the MIT license.
* Copyright (c) 2015, Brian Woodward.
* Licensed under the MIT License.
*/

@@ -7,0 +7,0 @@

{
"name": "accountdown-token",
"description": "Token authentication for accountdown",
"version": "0.1.1",
"version": "0.1.2",
"homepage": "https://github.com/doowb/accountdown-token",

@@ -19,3 +19,3 @@ "author": {

"type": "MIT",
"url": "https://github.com/doowb/accountdown-token/blob/master/LICENSE-MIT"
"url": "https://github.com/doowb/accountdown-token/blob/master/LICENSE"
},

@@ -31,10 +31,7 @@ "files": [

"scripts": {
"test": "mocha -R spec"
"test": "mocha"
},
"devDependencies": {
"mocha": "*",
"should": "*"
},
"keywords": [],
"dependencies": {
"should": "*",
"accountdown": "^4.0.0",

@@ -41,0 +38,0 @@ "level": "^0.18.0",

@@ -5,13 +5,14 @@ # accountdown-token [![NPM version](https://badge.fury.io/js/accountdown-token.svg)](http://badge.fury.io/js/accountdown-token)

## Install
## Install with [npm](npmjs.org)
Install with [npm](https://www.npmjs.com/)
```bash
npm i accountdown-token --save
```sh
$ npm i accountdown-token --save
```
## Run tests
## Running tests
```bash
npm test
Install dev dependencies:
```sh
$ npm i -d && npm test
```

@@ -33,10 +34,16 @@

users.create('doowb', { login: { username: 'doowb', token 'foobarbaz' }, value: { name: 'Brian' }}, function (err) {
var username = 'doowb';
var opts = {
login: { token: { username: username, token: 'foobarbaz' } },
value: { name: 'Brian' }
};
users.create(username, opts, function (err) {
if (err) return console.log('Error creating user', err);
users.verify('token', { username: 'doowb', token: 'foobarbaz' }, function (err, ok, id) {
users.verify('token', opts.login.token, function (err, ok, id) {
if (err) return console.log('Error', err);
if (ok === false) return console.log('Invalid token for ' + id);
console.log('Valid token for ' + id);
}):
});
});

@@ -46,2 +53,3 @@ ```

## API
### [.verify](index.js#L47)

@@ -51,5 +59,9 @@

* `creds` **{Object}**: Credentials object containing a `username` and `token` to validate.
* `cb` **{Function}**: Callback that takes `err, ok, id`
**Params**
* `creds` **{Object}**: Credentials object containing a `username` and `token` to validate.
* `cb` **{Function}**: Callback that takes `err, ok, id`
**Example**
```js

@@ -67,6 +79,10 @@ login.verify({ username: 'doowb', token: 'XXXXXXXXXXXX' }, function (err, ok, id) {

* `id` **{String}**: Identifier of the account being created.
* `creds` **{Object}**: Credentials object used for creating the token.
* `returns` **{Array}**: Array of rows to be added to the [accountdown] database
**Params**
* `id` **{String}**: Identifier of the account being created.
* `creds` **{Object}**: Credentials object used for creating the token.
* `returns` **{Array}**: Array of rows to be added to the [accountdown](https://github.com/substack/accountdown)database
**Example**
```js

@@ -76,4 +92,11 @@ login.create('doowb', { username: 'doowb' });

## Related projects
* [accountdown](https://github.com/substack/accountdown): persistent accounts backed to leveldb
* [level](https://github.com/Level/level): Fast & simple storage - a Node.js-style LevelDB wrapper (a convenience package bundling LevelUP &… [more](https://github.com/Level/level)
* [levelup](https://github.com/level/levelup): Fast & simple storage - a Node.js-style LevelDB wrapper
* [leveldown](https://github.com/level/leveldown): A Node.js LevelDB binding, primary backend for LevelUP
## Contributing
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/doowb/accountdown-token/issues)

@@ -84,14 +107,13 @@

**Brian Woodward**
+ [github/doowb](https://github.com/doowb)
+ [twitter/doowb](http://twitter.com/doowb)
+ [twitter/doowb](http://twitter.com/doowb)
## License
Copyright (c) 2015 Brian Woodward
Released under the MIT license
Copyright © 2015 Brian Woodward
Released under the MIT license.
***
_This file was generated by [verb](https://github.com/assemble/verb) on February 03, 2015._
[accountdown]: https://github.com/substack/accountdown
_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on July 23, 2015._