/*
 * Copyright (c) 2022-2022.
 * Author Peter Placzek (tada5hi)
 * For the full copyright and license information,
 * view the LICENSE file that was distributed with this source code.
 */

import crypto from 'crypto';
import {createNanoID} from "../../../utils";

export function generateInvitationCode() {
    const random : Buffer = crypto.randomBytes(64);

    const hash = crypto.createHash('sha512');
    hash.update(random);
    hash.update(Buffer.from(createNanoID()));

    return hash.digest('hex');
}

