From df6b77daf5b97c6de91a3d571d972466ffad6fdc Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Fri, 3 Aug 2018 15:05:30 -0600 Subject: [PATCH] v1.2.4: lighten the load --- oauth3.node.js | 12 ++++++++++-- package.json | 8 +++++--- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/oauth3.node.js b/oauth3.node.js index 155bd57..3f59a31 100644 --- a/oauth3.node.js +++ b/oauth3.node.js @@ -1,13 +1,21 @@ 'use strict'; +var PromiseA; +try { + PromiseA = require('bluebird'); +} catch(e) { + PromiseA = global.Promise; +} +var promisify = PromiseA.promisify || require('util').promisify; + //var OAUTH3 = require('./oauth3.core.js').OAUTH3; var OAUTH3 = require('./oauth3.issuer.js').OAUTH3; // used for OAUTH3.urls.resourcePasswordOwner // used for OAUTH3.authn.loginMeta // used for OAUTH3.authn.otp // used for OAUTH3.authn.resourcePasswordOwner -var PromiseA = require('bluebird'); -var requestAsync = PromiseA.promisify(require('request')); + +var requestAsync = promisify(require('@coolaj86/urequest')); var crypto = require('crypto'); OAUTH3.crypto = OAUTH3.crypto || {}; diff --git a/package.json b/package.json index b7352c7..eef2467 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "oauth3.js", - "version": "1.2.3", + "version": "1.2.4", "description": "The world's smallest, fastest, and most secure OAuth3 (and OAuth2) JavaScript implementation.", "main": "oauth3.node.js", "scripts": { @@ -32,9 +32,8 @@ "sign" ], "dependencies": { - "bluebird": "^3.5.0", + "@coolaj86/urequest": "^1.3.6", "elliptic": "^6.4.0", - "request": "^2.81.0", "terminal-forms.js": "git+https://git.oauth3.org/OAuth3/terminal-forms.js.git#v1" }, "devDependencies": { @@ -49,6 +48,9 @@ "pbkdf2": "^3.0.9", "vinyl-source-stream": "^1.1.0" }, + "trulyOptionalDependencies": { + "bluebird": "^3.5.0" + }, "author": "AJ ONeal (https://coolaj86.com/)", "license": "(MIT OR Apache-2.0)" }