vip audio card

This commit is contained in:
legop3
2026-04-28 14:33:39 -04:00
parent 4dc930f64b
commit 7e13d44458
12 changed files with 249 additions and 232 deletions
@@ -0,0 +1,21 @@
// Base64 and auth helpers for upload and WHIP requests.
export function bytesToBase64(bytes) {
let binary = '';
const chunkSize = 0x8000;
for (let i = 0; i < bytes.length; i += chunkSize) {
const chunk = bytes.subarray(i, i + chunkSize);
binary += String.fromCharCode(...chunk);
}
return btoa(binary);
}
function encodeBase64(value) {
if (typeof btoa === 'function') return btoa(value);
return '';
}
export function buildAuthHeader(token) {
if (!token) return {};
const encoded = encodeBase64(`${token}:${token}`);
return encoded ? { Authorization: `Basic ${encoded}` } : {};
}