clean up
This commit is contained in:
@@ -200,7 +200,7 @@ async function importKey(key: string | JsonWebKey, algorithm: SubtleCryptoImport
|
|||||||
|
|
||||||
function decodePayload<T = any>(raw: string): T | undefined {
|
function decodePayload<T = any>(raw: string): T | undefined {
|
||||||
try {
|
try {
|
||||||
return JSON.parse(atob(raw))
|
return JSON.parse(atob(raw))
|
||||||
} catch {
|
} catch {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -280,9 +280,9 @@ export async function verify(token: string, secret: string | JsonWebKey, options
|
|||||||
if (!algorithm)
|
if (!algorithm)
|
||||||
throw new Error('algorithm not found')
|
throw new Error('algorithm not found')
|
||||||
|
|
||||||
try {
|
const { payload } = decode(token)
|
||||||
const { payload } = decode(token)
|
|
||||||
|
|
||||||
|
try {
|
||||||
if (!payload)
|
if (!payload)
|
||||||
throw new Error('PARSE_ERROR')
|
throw new Error('PARSE_ERROR')
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user