mirror of
https://github.com/Shik3i/KoalaSync.git
synced 2026-07-26 12:08:15 +00:00
12 lines
369 B
JavaScript
12 lines
369 B
JavaScript
export function buildChatRelayPayload(ciphertext) {
|
|
return { ciphertext };
|
|
}
|
|
|
|
export function encodeSocketEvent(event, data, forbiddenSecret = '') {
|
|
const payload = JSON.stringify([event, data]);
|
|
if (forbiddenSecret && payload.includes(forbiddenSecret)) {
|
|
throw new Error('Refusing to send chat secret to relay');
|
|
}
|
|
return `42${payload}`;
|
|
}
|