Created
September 23, 2024 11:49
-
-
Save chientrm/2b99fbd91caae8c0e8874be4c32af26d to your computer and use it in GitHub Desktop.
Decrypt Payload
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { PUBLIC_SPKI } from '$env/static/public'; | |
import { audience, issuer } from '$lib/constants'; | |
import { importSPKI, jwtVerify } from 'jose'; | |
const forPublicKey = importSPKI(PUBLIC_SPKI, 'RS512'); | |
export const verify = async <T>(jwt: string) => | |
jwtVerify(jwt, await forPublicKey, { issuer, audience }).then((result) => result.payload as T); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment