"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.randomString = exports.generateRoomId = exports.decodePassphrase = exports.encodePassphrase = void 0;
function encodePassphrase(passphrase) {
    return encodeURIComponent(passphrase);
}
exports.encodePassphrase = encodePassphrase;
function decodePassphrase(base64String) {
    return decodeURIComponent(base64String);
}
exports.decodePassphrase = decodePassphrase;
function generateRoomId() {
    return `${randomString(4)}-${randomString(4)}`;
}
exports.generateRoomId = generateRoomId;
function randomString(length) {
    let result = '';
    const characters = 'abcdefghijklmnopqrstuvwxyz0123456789';
    const charactersLength = characters.length;
    for (let i = 0; i < length; i++) {
        result += characters.charAt(Math.floor(Math.random() * charactersLength));
    }
    return result;
}
exports.randomString = randomString;
