Public
Back
Version 2
10/9/2024
import {
throwError,
ValueIsNonEmptyString,
expectNonEmptyString
} from 'npm:javascript-interface-library'
import jws from "https://esm.sh/jws"
import { blob } from "https://esm.town/v/std/blob"
export default async function vtu_JWTisValid (JWT:string):void {
expectNonEmptyString('JWT',JWT)
const publicKey = await blob.getJSON('vtu_publicJWTKey')
if (! ValueIsNonEmptyString(publicKey)) throwError(
'MissingKeyPair: missing or invalid blob entry "vtu_publicJWTKey"'
)
if (! jws.verify(JWT,'ES384',publicKey)) throwError(
'InvalidJWT: JWT validation failed'
)
}
Updated: October 9, 2024