From f8a216574afd09cbbe2cb402fad64b39c7d42933 Mon Sep 17 00:00:00 2001 From: kira924age Date: Thu, 21 Dec 2023 21:17:53 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=90=9B=20update=20decodePayload?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/index.ts b/src/index.ts index 5f9371d..3ab92b4 100644 --- a/src/index.ts +++ b/src/index.ts @@ -199,8 +199,8 @@ async function importKey(key: string | JsonWebKey, algorithm: SubtleCryptoImport function decodePayload(raw: string): T | undefined { try { const binaryString = atob(raw) - const encodedString = encodeURIComponent(binaryString).replace(/%([0-9A-F]{2})/g, (match, p1) => { - return String.fromCharCode('0x' + p1); + const encodedString = encodeURIComponent(binaryString).replace(/%([0-9A-F]{2})/g, (_match, p1) => { + return String.fromCharCode(parseInt(p1, 16)); }); return JSON.parse(decodeURIComponent(encodedString));