UNPKG

onfido-sdk-ui

Version:

JavaScript SDK view layer for Onfido identity verification

13 lines (10 loc) 327 B
import { currentSeconds } from './index' const parseJwt = (token) => { const base64Url = token.split('.')[1] const base64 = base64Url.replace('-', '+').replace('_', '/') return JSON.parse(atob(base64)) } export const jwtExpired = (token) => { const expTime = parseJwt(token).exp return currentSeconds() > expTime }