import { Card } from '#/components/atoms/card.jsx'; import { Copyable } from '#/components/molecules/copyable.jsx'; import { JsonView } from '#/components/molecules/json-view.jsx'; import { until } from '#/lib/format.js'; import { decodeJwt } from '#/lib/jwt.js'; /** * One token, read rather than shown as a string. The signature is left off: * these are all ES256 over a key the receiving server resolves, so the bytes * say nothing a reader can check by eye. */ export function TokenView({ title, description, jwt, host, children }) { const decoded = decodeJwt(jwt); const expiresAt = decoded?.payload.exp ? decoded.payload.exp * 1000 : null; return (

{title}

{description && (

{description}

)}
{host && (
From {host}
)} {expiresAt && (
Expires {until(expiresAt)}
)} {children} {decoded ? (
) : (

That token is not a readable JWT.

)} {`${jwt.slice(0, 48)}…`}
); }