Connection and messages are now correct and fluently pass between client and server.

This commit is contained in:
Josako
2024-05-23 12:11:23 +02:00
parent 54e2297399
commit 06333bf8de
5 changed files with 82 additions and 32 deletions

View File

@@ -6,6 +6,7 @@ import random
import time
from flask import Flask
import os
import ast
def generate_api_key(prefix="EveAI-Chat"):
@@ -72,6 +73,8 @@ class JosKMSClient(kms_v1.KeyManagementServiceClient):
def decrypt_api_key(self, encrypted_data):
"""Decrypts the API key using the specified key version."""
if isinstance(encrypted_data, str):
encrypted_data = ast.literal_eval(encrypted_data)
key_version = encrypted_data['key_version']
key_name = self.key_name
encrypted_dek = b64decode(encrypted_data['encrypted_dek'].encode('utf-8'))