openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
20 lines (19 loc) • 791 B
JavaScript
import { canonicalizeBase64 } from "openclaw/plugin-sdk/realtime-voice-provider";
//#region extensions/google/base64.ts
/**
* Convert a ProtoJSON URL-safe Base64 payload to the standard alphabet without
* validating the payload. Returns undefined when the input mixes alphabets, so
* callers can reject it before the shared strict validator runs once.
*/
function toStandardGoogleProviderBase64(e) {
const t = e.includes("+") || e.includes("/");
const n = e.includes("-") || e.includes("_");
if (t && n) return;
return n ? e.replace(/[-_]/g, (e) => e === "-" ? "+" : "/") : e;
}
function canonicalizeGoogleProviderBase64(e) {
const t = toStandardGoogleProviderBase64(e);
return t === void 0 ? void 0 : canonicalizeBase64(t);
}
//#endregion
export { canonicalizeGoogleProviderBase64 };