diff --git a/src/utils.ts b/src/utils.ts index a32485c..127fa3f 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -1,4 +1,5 @@ import { JsonValue } from '$std/json/common.ts' +import { decodeBase64 } from "@std/encoding/base64" export type JsonCompatible = JsonValue | { toJSON(): JsonValue } | unknown @@ -77,3 +78,8 @@ function getCookie(name: string): string | undefined { const cookies = Object.fromEntries(cookiesEntries) return cookies[name] } + +export function base64ToString(base64: string): string { + const bytes = decodeBase64(base64) + return new TextDecoder().decode(bytes) +} \ No newline at end of file