oidc-spa
Version:
Openidconnect client for Single Page Applications
15 lines • 454 B
JavaScript
import { decodeJwt } from "./decodeJwt";
import { assert } from "../vendor/frontend/tsafe";
// Return undefined if token provided wasn't a JWT or if it hasn't an exp claim number
export function readExpirationTimeInJwt(token) {
let exp;
try {
exp = decodeJwt(token).exp;
assert(typeof exp === "number");
}
catch {
return undefined;
}
return exp * 1000;
}
//# sourceMappingURL=readExpirationTimeInJwt.js.map