Hey is a decentralized and permissionless social media app built with Lens Protocol 馃尶
at main 19 lines 401 B view raw
1import type { JwtPayload } from "@hey/types/jwt"; 2 3const decoded = (str: string): string => 4 atob(str.replace(/-/g, "+").replace(/_/g, "/")); 5 6const parseJwt = (token: string): JwtPayload => { 7 try { 8 return JSON.parse(decoded(token.split(".")[1])) as JwtPayload; 9 } catch { 10 return { 11 act: { sub: "" }, 12 exp: 0, 13 sid: "", 14 sub: "" 15 }; 16 } 17}; 18 19export default parseJwt;