import * as base64url from "./base64url"; /** * Decode an authenticator's base64url-encoded clientDataJSON to JSON */ export function decodeClientDataJSON(data: string): ClientDataJSON { const toString = base64url.toString(data); const clientData: ClientDataJSON = JSON.parse(toString); return clientData; } export type ClientDataJSON = { type: string; challenge: string; origin: string; crossOrigin?: boolean; tokenBinding?: { id?: string; status: 'present' | 'supported' | 'not-supported'; }; };