1
0

add algorithm none

This commit is contained in:
2025-05-29 01:26:59 +02:00
parent 06c5605bf2
commit 1b4c93adb2
4 changed files with 37 additions and 28 deletions

View File

@@ -84,13 +84,9 @@ export async function importKey(key: string | JsonWebKeyWithKid, algorithm: Subt
return importTextSecret(key, algorithm, keyUsages)
}
export function decodePayload<T = any>(raw: string): T | undefined {
try {
const bytes = Array.from(atob(raw), char => char.charCodeAt(0));
const decodedString = new TextDecoder("utf-8").decode(new Uint8Array(bytes));
export function decodePayload<T = any>(raw: string): T {
const bytes = Array.from(atob(raw), char => char.charCodeAt(0));
const decodedString = new TextDecoder("utf-8").decode(new Uint8Array(bytes));
return JSON.parse(decodedString);
} catch {
return
}
return JSON.parse(decodedString);
}