download
raw
719 Bytes
import { compactVerify } from '../jws/compact/verify.js';
import jwtPayload from '../lib/jwt_claims_set.js';
import { JWTInvalid } from '../util/errors.js';
export async function jwtVerify(jwt, key, options) {
const verified = await compactVerify(jwt, key, options);
if (verified.protectedHeader.crit?.includes('b64') && verified.protectedHeader.b64 === false) {
throw new JWTInvalid('JWTs MUST NOT use unencoded payload');
}
const payload = jwtPayload(verified.protectedHeader, verified.payload, options);
const result = { payload, protectedHeader: verified.protectedHeader };
if (typeof key === 'function') {
return { ...result, key: verified.key };
}
return result;
}

Xet Storage Details

Size:
719 Bytes
·
Xet hash:
fd11fd0e8f31e40a1ba4abf57f705afa4ad916148d0cc3499a01f922096d926b

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.