From 61d1147f4ae62e99386326ab0448401e068a7493 Mon Sep 17 00:00:00 2001 From: Maxim Ivanitskiy Date: Thu, 13 Jul 2023 14:30:32 -0700 Subject: [PATCH] fix: client.updateAccountKey now accepts only CryptoKey --- src/client.ts | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/src/client.ts b/src/client.ts index 52256c3..06cbb0d 100644 --- a/src/client.ts +++ b/src/client.ts @@ -417,7 +417,7 @@ export class AcmeClient { * * https://tools.ietf.org/html/rfc8555#section-7.3.5 * - * @param {CryptoKey|buffer|string} newAccountKey New account private key + * @param {CryptoKey} newAccountKey New account private key * @param {object} [data] Additional request data * @returns {Promise} Account * @@ -428,23 +428,15 @@ export class AcmeClient { * ``` */ async updateAccountKey( - newAccountKey: CryptoKey | string | Buffer, + newAccountKey: CryptoKey, data: Record = {} ): Promise> { - // FIXME: if string | Buffer then handle reading from PEM - - if (Buffer.isBuffer(newAccountKey) || typeof newAccountKey === 'string') { - newAccountKey = Buffer.from(newAccountKey) - } - const accountUrl = this.api.getAccountUrl() - const newCryptoKey = '' // TODO FIX THIS - /* Create new HTTP and API clients using new key */ const newHttpClient = new HttpClient( this.opts.directoryUrl, - newCryptoKey, + newAccountKey, accountUrl ) @@ -776,7 +768,7 @@ export class AcmeClient { async getCertificate( order: Record, _preferredChain: string | null = null // TODO delete? - ): Promise { + ): Promise { if (!validStates.includes(order.status as string)) { order = await this.waitForValidStatus(order) } @@ -887,7 +879,7 @@ export class AcmeClient { * }); * ``` */ - auto(opts: ClientAutoOptions): Promise { + auto(opts: ClientAutoOptions): Promise { return auto(this, opts) } @@ -907,12 +899,12 @@ export class AcmeClient { * * @param {AcmeClient} client ACME client * @param {ClientAutoOptions} userOpts Options - * @returns {Promise} Certificate + * @returns {Promise} Certificate */ async function auto( client: AcmeClient, userOpts: ClientAutoOptions -): Promise { +): Promise { const opts = { ...autoDefaultOpts, ...userOpts } const log = new Logger('auto', client.minLevel) const accountPayload: Record = {