refactor: centralize base64 encoding

This commit is contained in:
William Valentin
2025-09-23 11:27:32 -07:00
parent e3a924c0c6
commit de237fd997
4 changed files with 14 additions and 10 deletions

7
utils/base64.ts Normal file
View File

@@ -0,0 +1,7 @@
export const encodeBase64 = (value: string): string => {
if (typeof btoa !== 'undefined') {
return btoa(value);
}
return Buffer.from(value, 'utf-8').toString('base64');
};