• Not Exported

    Retrieves or generates encryption key

    Returns Buffer

    Buffer containing 256-bit encryption key

    function getEncryptionKey(): Buffer {
    const keyPath = getEncryptionKeyPath();

    if (fs.existsSync(keyPath)) {
    return fs.readFileSync(keyPath);
    }

    // Generate new encryption key
    const key = crypto.randomBytes(32); // 256 bits
    fs.writeFileSync(keyPath, key);
    saveLog("Generated new encryption key for token storage", "DEBUG");

    return key;
    }