// i actually love this export const b64encode = (obj: object): string => { return Buffer.from(JSON.stringify(obj)).toString("base64url"); } export const b64decode = (str: string): T => { try { return JSON.parse(Buffer.from(str, "base64url").toString()); } catch { throw new Error("invalid base64-encoded object string: " + str); } }