Relay pairing offer v2 (E2EE) + host connections
This commit is contained in:
@@ -5,7 +5,14 @@ export function arrayBufferToBase64(buffer: ArrayBuffer): string {
|
||||
}
|
||||
|
||||
export function base64ToArrayBuffer(base64: string): ArrayBuffer {
|
||||
const bytes = toByteArray(base64);
|
||||
const normalized = (() => {
|
||||
const trimmed = base64.trim();
|
||||
const standard = trimmed.replace(/-/g, "+").replace(/_/g, "/");
|
||||
const padLen = (4 - (standard.length % 4)) % 4;
|
||||
return standard + "=".repeat(padLen);
|
||||
})();
|
||||
|
||||
const bytes = toByteArray(normalized);
|
||||
const out = new Uint8Array(bytes.byteLength);
|
||||
out.set(bytes);
|
||||
return out.buffer;
|
||||
|
||||
Reference in New Issue
Block a user