Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add better react and react-native compatibility #284

Merged
merged 9 commits into from
Mar 26, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 12 additions & 0 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,18 @@ if (typeof Promise === "undefined") {
require("es6-promise").polyfill();
}

if (typeof Buffer === "undefined") {
(global || window).Buffer = require("buffer").Buffer;
}

if (typeof process === "undefined") {
(global || window).process = require("process");
}

if (!process.version) {
process.version = "";
}

var JWS = require("./jws");

module.exports = {
Expand Down
11 changes: 10 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,23 @@
"test": "gulp test:nodejs"
},
"browser": {
"crypto": false
"crypto": false,
"zlib": "browserify-zlib"
},
"react-native": {
"crypto": false,
"zlib": "react-zlib-js"
},
"dependencies": {
"base64url": "^3.0.1",
"browserify-zlib": "^0.2.0",
"buffer": "^5.5.0",
"es6-promise": "^4.2.8",
"lodash": "^4.17.15",
"long": "^4.0.0",
"node-forge": "^0.8.5",
"process": "^0.11.10",
"react-zlib-js": "^1.0.4",
"uuid": "^3.3.3"
},
"devDependencies": {
Expand Down