request => @coolaj86/urequest

This commit is contained in:
AJ ONeal 2018-06-19 01:28:03 -06:00
parent 16cbe77dff
commit f7d1c5615e
2 changed files with 8 additions and 11 deletions

14
node.js
View File

@ -140,7 +140,7 @@ ACME._registerAccount = function (me, options) {
, kid: options.externalAccount.id , kid: options.externalAccount.id
, url: me._directoryUrls.newAccount , url: me._directoryUrls.newAccount
} }
, new Buffer(JSON.stringify(jwk)) , Buffer.from(JSON.stringify(jwk))
); );
} }
var payload = JSON.stringify(body); var payload = JSON.stringify(body);
@ -152,7 +152,7 @@ ACME._registerAccount = function (me, options) {
, url: me._directoryUrls.newAccount , url: me._directoryUrls.newAccount
, jwk: jwk , jwk: jwk
} }
, new Buffer(payload) , Buffer.from(payload)
); );
delete jws.header; delete jws.header;
@ -288,7 +288,7 @@ ACME._postChallenge = function (me, options, identifier, ch) {
options.accountKeypair options.accountKeypair
, undefined , undefined
, { nonce: me._nonce, alg: 'RS256', url: ch.url, kid: me._kid } , { nonce: me._nonce, alg: 'RS256', url: ch.url, kid: me._kid }
, new Buffer(JSON.stringify({ "status": "deactivated" })) , Buffer.from(JSON.stringify({ "status": "deactivated" }))
); );
me._nonce = null; me._nonce = null;
return me._request({ return me._request({
@ -367,7 +367,7 @@ ACME._postChallenge = function (me, options, identifier, ch) {
options.accountKeypair options.accountKeypair
, undefined , undefined
, { nonce: me._nonce, alg: 'RS256', url: ch.url, kid: me._kid } , { nonce: me._nonce, alg: 'RS256', url: ch.url, kid: me._kid }
, new Buffer(JSON.stringify({ })) , Buffer.from(JSON.stringify({ }))
); );
me._nonce = null; me._nonce = null;
return me._request({ return me._request({
@ -439,7 +439,7 @@ ACME._finalizeOrder = function (me, options, validatedDomains) {
options.accountKeypair options.accountKeypair
, undefined , undefined
, { nonce: me._nonce, alg: 'RS256', url: me._finalize, kid: me._kid } , { nonce: me._nonce, alg: 'RS256', url: me._finalize, kid: me._kid }
, new Buffer(payload) , Buffer.from(payload)
); );
if (me.debug) console.debug('finalize:', me._finalize); if (me.debug) console.debug('finalize:', me._finalize);
@ -544,7 +544,7 @@ ACME._getCertificate = function (me, options) {
options.accountKeypair options.accountKeypair
, undefined , undefined
, { nonce: me._nonce, alg: 'RS256', url: me._directoryUrls.newOrder, kid: me._kid } , { nonce: me._nonce, alg: 'RS256', url: me._directoryUrls.newOrder, kid: me._kid }
, new Buffer(payload) , Buffer.from(payload)
); );
if (me.debug) console.debug('\n[DEBUG] newOrder\n'); if (me.debug) console.debug('\n[DEBUG] newOrder\n');
@ -627,7 +627,7 @@ ACME.create = function create(me) {
// me.debug = true; // me.debug = true;
me.challengePrefixes = ACME.challengePrefixes; me.challengePrefixes = ACME.challengePrefixes;
me.RSA = me.RSA || require('rsa-compat').RSA; me.RSA = me.RSA || require('rsa-compat').RSA;
me.request = me.request || require('request'); me.request = me.request || require('@coolaj86/urequest');
me._dig = function (query) { me._dig = function (query) {
// TODO use digd.js // TODO use digd.js
return new Promise(function (resolve, reject) { return new Promise(function (resolve, reject) {

View File

@ -39,10 +39,7 @@
"author": "AJ ONeal <coolaj86@gmail.com> (https://coolaj86.com/)", "author": "AJ ONeal <coolaj86@gmail.com> (https://coolaj86.com/)",
"license": "(MIT OR Apache-2.0)", "license": "(MIT OR Apache-2.0)",
"dependencies": { "dependencies": {
"request": "^2.85.0", "@coolaj86/urequest": "^1.1.1",
"rsa-compat": "^1.3.0" "rsa-compat": "^1.3.0"
},
"optionalDependencies": {
"bluebird": "^3.5.1"
} }
} }