diff --git a/.gitignore b/.gitignore index 2ba16e7..94e1492 100644 --- a/.gitignore +++ b/.gitignore @@ -107,4 +107,8 @@ out/ .env.master confs sdk-client/.env -storage/dev/nginx \ No newline at end of file +storage/dev/nginx +confs/bitcoin/bitcoin.conf +sdk-client/dist +sdk-client/node_modules +storage/dev/nginx/route_status_redirect.conf \ No newline at end of file diff --git a/docs/api-specification-openapi.yaml b/docs/api-specification-openapi.yaml index c7128eb..2a724a5 100644 --- a/docs/api-specification-openapi.yaml +++ b/docs/api-specification-openapi.yaml @@ -3,7 +3,7 @@ info: title: 4NK Vault API Secure description: | API HTTPS sécurisée avec authentification par clés utilisateur et chiffrement quantique résistant. - + ## Sécurité - **HTTPS obligatoire** sur le port 6666 - **Authentification par ID utilisateur** (header `X-User-ID`) @@ -11,15 +11,15 @@ info: - **Rotation automatique des clés** (toutes les heures) - **Chiffrement quantique résistant** (ChaCha20-Poly1305) - **Variables d'environnement** résolues automatiquement - + ## Domaine - **URL de base** : `https://vault.4nkweb.com:6666` - **Protocole** : HTTPS uniquement - **Port** : 6666 - + ## Authentification Tous les endpoints nécessitent l'en-tête `X-User-ID` avec un ID utilisateur valide. - + ## Variables d'environnement Les fichiers servis ont leurs variables d'environnement (`$VAR` et `${VAR}`) résolues automatiquement avant chiffrement. version: 2.0.0 @@ -218,11 +218,11 @@ paths: Sert un fichier depuis le stockage sécurisé avec authentification utilisateur. Le fichier est chiffré avec ChaCha20-Poly1305 et ses variables d'environnement sont résolues automatiquement avant chiffrement. - + ## Variables d'environnement Les variables `$VAR` et `${VAR}` dans le fichier sont automatiquement résolues à partir du fichier `.env` principal de l'environnement. - + ## Chiffrement - **Algorithme** : ChaCha20-Poly1305 (quantum-résistant) - **Nonce** : 12 bytes aléatoires par fichier @@ -256,12 +256,12 @@ paths: format: binary description: | Fichier chiffré au format ChaCha20-Poly1305. - + Structure du payload : - Nonce (12 bytes) - Métadonnées (JSON chiffré) - Contenu du fichier (chiffré) - + Les variables d'environnement sont résolues avant chiffrement. headers: X-Next-Key: @@ -291,12 +291,12 @@ components: name: X-User-ID description: | ID utilisateur pour l'authentification. - + ## Validation - **Longueur** : 3-128 caractères - **Caractères autorisés** : `a-zA-Z0-9_-` - **Exemple** : `demo_user_001` - + ## Sécurité - Une clé de chiffrement unique est générée par utilisateur/environnement - Les clés sont stockées de manière sécurisée dans `storage//_keys/` diff --git a/docs/api-specification.md b/docs/api-specification.md index 4946faf..662da38 100644 --- a/docs/api-specification.md +++ b/docs/api-specification.md @@ -352,5 +352,5 @@ grep "X-Next-Key" headers.txt --- -**Dernière mise à jour** : 2024-01-XX +**Dernière mise à jour** : 2024-01-XX **Version API** : 2.0.0 \ No newline at end of file diff --git a/docs/environment-variables.md b/docs/environment-variables.md index abfd09b..be0cbf7 100644 --- a/docs/environment-variables.md +++ b/docs/environment-variables.md @@ -61,16 +61,16 @@ variables = load_env_file(env_file) def resolve_variable(var_name, visited=None): if var_name in visited: # Protection contre les boucles return f"${var_name}" - + visited.add(var_name) value = variables[var_name] - + # Résolution des sous-variables for match in find_variables(value): resolved = resolve_variable(match, visited.copy()) value = value.replace(f"${{{match}}}", resolved) value = value.replace(f"${match}", resolved) - + return value ``` @@ -82,14 +82,14 @@ def process_content(content): for var_name in re.findall(pattern1, content): resolved_value = resolve_variable(var_name) content = content.replace(f"${{{var_name}}}", resolved_value) - + # Pattern pour $VARIABLE pattern2 = r'\$([A-Za-z_][A-Za-z0-9_]*)' for var_name in re.findall(pattern2, content): if f"${{{var_name}}}" not in content: # Éviter les doublons resolved_value = resolve_variable(var_name) content = content.replace(f"${var_name}", resolved_value) - + return content ``` @@ -151,7 +151,7 @@ class SecureVaultAPI: def __init__(self): # Processeurs d'environnement par environnement self.env_processors = {} - + def _get_env_processor(self, env: str) -> EnvProcessor: if env not in self.env_processors: env_file = STORAGE_ROOT / env / '.env' @@ -165,16 +165,16 @@ class SecureVaultAPI: def serve_file(env: str, file_path: str): # Lecture du fichier file_content = self._read_file(env, file_path) - + # Traitement des variables d'environnement env_processor = self._get_env_processor(env) processed_content = env_processor.process_content(file_content) - + # Chiffrement du contenu traité encrypted_content, next_key = self._encrypt_with_user_key_and_next( processed_content, user_id, env ) - + return encrypted_content ``` diff --git a/sdk-client/README.md b/sdk-client/README.md index 1efa35a..3389614 100644 --- a/sdk-client/README.md +++ b/sdk-client/README.md @@ -260,7 +260,7 @@ class VaultCrypto { static generateKey(): string static hashToKey(password: string): string static validateKey(key: string): boolean - + // Déchiffrement ChaCha20-Poly1305 static decrypt(encryptedData: string, key: string): string }