commit
73ca83b520
|
@ -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.
|
|
@ -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 );
|
||||
```
|
||||
|
|
2
index.js
2
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;
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -79,4 +79,14 @@ describe('bitauth', function() {
|
|||
|
||||
});
|
||||
|
||||
describe('#middleware', function() {
|
||||
|
||||
it('should expose an express middleware', function(done) {
|
||||
bitauth.middleware( {} , {} , function() {
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue