<?php
namespace Kanzu\StoreVoiceAI;

// Prevent direct file access.
if ( ! defined( 'ABSPATH' ) ) {
    exit;
}

class Utils
{

    public function encrypt_api_key($api_key)
    {
        $encryption_key = wp_salt('auth');
        return base64_encode(openssl_encrypt($api_key, 'AES-256-CBC', $encryption_key, 0, substr($encryption_key, 0, 16)));
    }

    public function decrypt_api_key($encrypted_key)
    {
        $encryption_key = wp_salt('auth');
        return openssl_decrypt(base64_decode($encrypted_key), 'AES-256-CBC', $encryption_key, 0, substr($encryption_key, 0, 16));
    }

}
