From 3bab5857dd749428036f74fdec4024fbe1797553 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Mon, 1 Aug 2016 20:07:54 -0400 Subject: [PATCH] backwards compat --- lib/get-certificate.js | 12 ++++++++++-- lib/register-new-account.js | 6 +++++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/lib/get-certificate.js b/lib/get-certificate.js index 4fdd22a..a73500a 100644 --- a/lib/get-certificate.js +++ b/lib/get-certificate.js @@ -358,10 +358,18 @@ module.exports.create = function (deps) { return handleErr(new Error("options.newCertUrl must be the new certificate url")); } if (!options.accountKeypair) { - return handleErr(new Error("options.accountKeypair must be an object with `privateKeyPem` and/or `privateKeyJwk`")); + if (!options.accountPrivateKeyPem) { + return handleErr(new Error("options.accountKeypair must be an object with `privateKeyPem` and/or `privateKeyJwk`")); + } + console.warn("'accountPrivateKeyPem' is deprecated. Use options.accountKeypair.privateKeyPem instead."); + options.accountKeypair = RSA.import({ privateKeyPem: options.accountPrivateKeyPem }); } if (!options.domainKeypair) { - return handleErr(new Error("options.domainKeypair must be an object with `privateKeyPem` and/or `privateKeyJwk`")); + if (!options.domainPrivateKeyPem) { + return handleErr(new Error("options.domainKeypair must be an object with `privateKeyPem` and/or `privateKeyJwk`")); + } + console.warn("'domainPrivateKeyPem' is deprecated. Use options.domainKeypair.privateKeyPem instead."); + options.domainKeypair = RSA.import({ privateKeyPem: options.domainPrivateKeyPem }); } if (!options.setChallenge) { return handleErr(new Error("options.setChallenge must be function(hostname, challengeKey, tokenValue, done) {}")); diff --git a/lib/register-new-account.js b/lib/register-new-account.js index 9c6a5a7..7972582 100644 --- a/lib/register-new-account.js +++ b/lib/register-new-account.js @@ -104,7 +104,11 @@ module.exports.create = function (deps) { var state = {}; if (!options.accountKeypair) { - return handleErr(new Error("options.accountKeypair must be an object with `privateKeyPem` and/or `privateKeyJwk`")); + if (!options.accountPrivateKeyPem) { + return handleErr(new Error("options.accountKeypair must be an object with `privateKeyPem` and/or `privateKeyJwk`")); + } + console.warn("'accountPrivateKeyPem' is deprecated. Use options.accountKeypair.privateKeyPem instead."); + options.accountKeypair = RSA.import({ privateKeyPem: options.accountPrivateKeyPem }); } if (!options.agreeToTerms) { cb(new Error("options.agreeToTerms must be function (tosUrl, fn => (err, true))"));