import { getClaims } from './getClaims' ; import { Jwt } from './Jwt' ; const notBeforeKey = 'nbf' ; export function getNotBefore ( jwt ) { const claims = getClaims ( jwt ) ; if ( notBeforeKey in claims && typeof claims [ notBeforeKey ] === 'number' ) { const seconds = claims [ notBeforeKey ] as number ; const milliseconds = seconds * 1000 ; return new Date ( milliseconds ) ; } return new Date ( ) ; }