From 8ba8fea1d12c460c223f8bc51bbffd6cabaf2639 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 23 Oct 2025 00:06:38 +0000 Subject: [PATCH 1/2] Initial plan From fb9840d5cf074f8e37aa25e4f209d8e78386cc9b Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 23 Oct 2025 00:11:12 +0000 Subject: [PATCH 2/2] Fix TypeScript type errors in CI Co-authored-by: kentcdodds <1500684+kentcdodds@users.noreply.github.com> --- index.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index 145097a..e597cda 100644 --- a/index.js +++ b/index.js @@ -26,7 +26,7 @@ const DEFAULT_PERIOD = 30 * Generates a HMAC-based One Time Password (HOTP) using the provided secret and * configuration options. * - * @param {ArrayBuffer} secret - The secret used to generate the HOTP. + * @param {BufferSource} secret - The secret used to generate the HOTP. * @param {Object} options - The configuration options for the HOTP. * @param {number} [options.counter=0] - The counter value to use for the HOTP. * Defaults to 0. @@ -104,7 +104,7 @@ async function generateHOTP( * configuration options. * * @param {string} otp - The OTP to verify. - * @param {ArrayBuffer} secret - The secret used to generate the HOTP. + * @param {BufferSource} secret - The secret used to generate the HOTP. * @param {Object} options - The configuration options for the HOTP. * @param {number} [options.counter=0] - The counter value to use for the HOTP. * Defaults to 0. @@ -256,7 +256,7 @@ export async function verifyTOTP({ return null } - return verifyHOTP(otp, new Uint8Array(decodedSecret), { + return verifyHOTP(otp, decodedSecret, { counter: getCounter(period), digits, window, @@ -269,7 +269,7 @@ export async function verifyTOTP({ * Converts a number to a byte array. * * @param {number} num The number to convert to a byte array. - * @returns {Uint8Array} The byte array representation of the number. + * @returns {Uint8Array} The byte array representation of the number. */ function intToBytes(num) { const arr = new Uint8Array(8)