From fa7411bac8f130999ee94fef97f6c07a19bccc55 Mon Sep 17 00:00:00 2001 From: Jason Dreyzehner Date: Wed, 30 Apr 2014 06:42:25 -0700 Subject: [PATCH 1/4] Initial commit --- .gitignore | 25 +++++++++++++++++++++++++ LICENSE | 21 +++++++++++++++++++++ README.md | 2 ++ 3 files changed, 48 insertions(+) create mode 100644 .gitignore create mode 100644 LICENSE create mode 100644 README.md diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..da23d0d --- /dev/null +++ b/.gitignore @@ -0,0 +1,25 @@ +# Logs +logs +*.log + +# Runtime data +pids +*.pid +*.seed + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage + +# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# Compiled binary addons (http://nodejs.org/api/addons.html) +build/Release + +# Dependency directory +# Deployed apps should consider commenting this line out: +# see https://npmjs.org/doc/faq.html#Should-I-check-my-node_modules-folder-into-git +node_modules diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..c6bc4e8 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014 BitPay + +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. \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..feb4a4e --- /dev/null +++ b/README.md @@ -0,0 +1,2 @@ +bitauth +======= From c7a6fd2a1be89a714f65d74f96e671ca6d5ed7db Mon Sep 17 00:00:00 2001 From: Jason Dreyzehner Date: Wed, 30 Apr 2014 10:17:08 -0400 Subject: [PATCH 2/4] init package.json --- package.json | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 package.json diff --git a/package.json b/package.json new file mode 100644 index 0000000..b6f81f4 --- /dev/null +++ b/package.json @@ -0,0 +1,25 @@ +{ + "name": "bitauth", + "version": "0.0.1", + "author": "Satoshi Nakamoto ", + "description": "The secure authentication framework, built on Bitcore.", + "contributors": [ + { + "name": "Patrick Nagurny", + "email": "patrick@bitpay.com" + } + ], + "keywords": [ + "bitcoin", + "SIN", + "System Identification Number", + "token" + ], + "dependencies" : { + "bitcore" : ">0.1.0" + }, + "license": "MIT", + "engines": { + "node": ">=0.10" + } +} \ No newline at end of file From aff3ed9c4431f3db8c495d6bf0ef5894326b8dd8 Mon Sep 17 00:00:00 2001 From: Eric Martindale Date: Sun, 29 Jun 2014 18:01:41 -0400 Subject: [PATCH 3/4] Expose middleware in library. --- index.js | 2 +- package.json | 6 +++++- test/bitauth.js | 10 ++++++++++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 14c9f38..ac8a71e 100644 --- a/index.js +++ b/index.js @@ -4,6 +4,6 @@ var bitauth = require('./lib/bitauth'); // add node-specific encrypt/decrypt bitauth.encrypt = require('./lib/encrypt'); bitauth.decrypt = require('./lib/decrypt'); - +bitauth.middleware = require('./lib/middleware/bitauth'); module.exports = bitauth; diff --git a/package.json b/package.json index 9609408..fd0df9a 100644 --- a/package.json +++ b/package.json @@ -6,6 +6,10 @@ "email": "patrick@bitpay.com" }, "contributors": [ + { + "name": "Eric Martindale", + "email": "eric@ericmartindale.com" + }, { "name": "Gordon Hall", "email": "gordon@bitpay.com" @@ -13,7 +17,7 @@ ], "scripts": { "make-dist": "sh scripts/make-dist.sh", - "test": "node_modules/.bin/mocha test/* --reporter spec", + "test": "mocha test/* --reporter spec", "postinstall": "npm run make-dist" }, "main": "index.js", diff --git a/test/bitauth.js b/test/bitauth.js index e2d2b12..94b7185 100644 --- a/test/bitauth.js +++ b/test/bitauth.js @@ -79,4 +79,14 @@ describe('bitauth', function() { }); + describe('#middleware', function() { + + it('should expose an express middleware', function(done) { + bitauth.middleware( {} , {} , function() { + done(); + }); + }); + + }); + }); From 91e5e4800964d1455fb11ea7a2dd77f4c20f52da Mon Sep 17 00:00:00 2001 From: Eric Martindale Date: Sun, 29 Jun 2014 18:05:31 -0400 Subject: [PATCH 4/4] Add documentation. --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index 574cbc3..1e5c171 100644 --- a/README.md +++ b/README.md @@ -178,3 +178,10 @@ for(k in keys) { } ``` + +## Middleware +BitAuth exposes a connect middleware for use in connect or ExpressJS applications. Use: +``` +var bitauth = require('bitauth'); +app.use( bitauth.middleware ); +```