Skip to content

Commit

Permalink
Split index.js for node and browser
Browse files Browse the repository at this point in the history
  • Loading branch information
fanatid committed Jan 23, 2016
1 parent 787a011 commit 4a6e15d
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 18 deletions.
3 changes: 3 additions & 0 deletions browser.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
'use strict';

module.exports = require('./lib/bitauth-browserify');
16 changes: 5 additions & 11 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
'use strict';

var bitauth;
if (process.browser) {
bitauth = require('./lib/bitauth-browserify');
} else {
bitauth = require('./lib/bitauth-node');

// add node-specific encrypt/decrypt
bitauth.encrypt = require('./lib/encrypt');
bitauth.decrypt = require('./lib/decrypt');
bitauth.middleware = require('./lib/middleware/bitauth');
}
var bitauth = require('./lib/bitauth-node');
// add node-specific encrypt/decrypt
bitauth.encrypt = require('./lib/encrypt');
bitauth.decrypt = require('./lib/decrypt');
bitauth.middleware = require('./lib/middleware/bitauth');

module.exports = bitauth;
25 changes: 18 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
{
"name": "bitauth",
"version": "0.3.2",
"description": "Passwordless authentication using Bitcoin cryptography",
"license": "MIT",
"author": {
"name": "Patrick Nagurny",
"email": "patrick@bitpay.com"
},
"repository": {
"type": "git",
"url": "https://github.com/bitpay/bitauth.git"
},
"contributors": [
{
"name": "Eric Martindale",
Expand All @@ -23,12 +21,23 @@
"email": "braydon@bitpay.com"
}
],
"files": [
"lib",
"browser.js",
"index.js",
"LICENSE",
"package.json",
"README.md"
],
"main": "index.js",
"repository": {
"type": "git",
"url": "https://github.com/bitpay/bitauth.git"
},
"scripts": {
"make-dist": "gulp browser",
"test": "gulp test"
},
"main": "index.js",
"version": "0.3.2",
"dependencies": {
"bs58": "^2.0.0",
"elliptic": "=1.0.0",
Expand All @@ -54,5 +63,7 @@
"run-sequence": "^1.0.2",
"uglify-js": "~2.4.14"
},
"license": "MIT"
"browser": {
"index.js": "browser.js"
}
}

0 comments on commit 4a6e15d

Please sign in to comment.