diff --git a/.gitmodules b/.gitmodules index 9dc4ff9..c8e95c0 100644 --- a/.gitmodules +++ b/.gitmodules @@ -6,10 +6,10 @@ path = sdk_relay url = git@git.4nkweb.com:4nk/sdk_relay.git branch = ext -[submodule "sdk_signer"] - path = sdk_signer - url = git@git.4nkweb.com:4nk/sdk_signer.git - branch = ext +# [submodule "sdk_signer"] +# path = sdk_signer +# url = git@git.4nkweb.com:4nk/sdk_signer.git +# branch = ext [submodule "sdk_storage"] path = sdk_storage url = git@git.4nkweb.com:4nk/sdk_storage.git diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..dc05d3e --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,10 @@ +## [Unreleased] + +### Changed +- lecoffre-front (docker-compose): switch to local build using repository Dockerfile for durable deployment of IdNot state-based flow. +- Ensure NEXT_PUBLIC variables are injected via env_file (.env.master) rather than relying on image defaults. + +### Added +- docs/idnot-front-agnostic.md describing the front-agnostic IdNot flow, envs, Nginx, and operations. +- lecoffre_node/ENV_EXAMPLE.md documenting example .env.master contents for the frontend. + diff --git a/IA_agents/CI_TRIGGER_PROCESS.md b/IA_agents/CI_TRIGGER_PROCESS.md index f51f0e1..6c8e57c 100644 --- a/IA_agents/CI_TRIGGER_PROCESS.md +++ b/IA_agents/CI_TRIGGER_PROCESS.md @@ -23,7 +23,6 @@ Ce document explique comment déclencher les CI pour tous les projets du LeCoffr |--------|----------|--------------|--------| | `sdk_relay` | `.gitea/workflows/build-ext.yml` | `git.4nkweb.com/4nk/sdk_relay:ext` | ✅ CI configurée | | `sdk_storage` | `.gitea/workflows/build-ext.yml` | `git.4nkweb.com/4nk/sdk_storage:ext` | ✅ CI configurée | -| `sdk_signer` | `.gitea/workflows/build-ext.yml` | `git.4nkweb.com/4nk/sdk_signer:ext` | ✅ CI configurée | | `ihm_client` | `.gitea/workflows/docker-ext.yml` | `git.4nkweb.com/4nk/ihm_client:ext` | ✅ CI configurée | | `lecoffre-front` | `.gitea/workflows/build-ext.yml` | `git.4nkweb.com/4nk/lecoffre-front:ext` | ✅ CI configurée | @@ -59,16 +58,6 @@ git push origin refs/tags/ext - **Image Docker**: `git.4nkweb.com/4nk/sdk_storage:ext` - **Tags existants**: `ext` -#### 3. sdk_signer -```bash -cd /home/debian/4NK_env/sdk_signer -git tag -a ext -m "ci: docker_tag=ext - Trigger CI build for sdk_signer" -git push origin refs/tags/ext -``` -- **Workflow**: `.gitea/workflows/build-ext.yml` -- **Image Docker**: `git.4nkweb.com/4nk/sdk_signer:ext` -- **Tags existants**: `ext` - #### 4. ihm_client ```bash cd /home/debian/4NK_env/ihm_client @@ -93,7 +82,7 @@ git push origin refs/tags/ext ### Pour tous les projets ```bash cd /home/debian/4NK_env -for project in sdk_relay sdk_storage sdk_signer ihm_client lecoffre-front; do +for project in sdk_relay sdk_storageihm_client lecoffre-front; do echo "=== Déclenchement CI pour $project ===" cd $project git tag -a ext -m "ci: docker_tag=ext - Trigger CI build for $project" @@ -126,7 +115,7 @@ ci: docker_tag=ext - Add new features for relay service ### Types de workflows #### Workflow build-ext.yml (standard) -- **Projets**: sdk_relay, sdk_storage, sdk_signer, lecoffre-front +- **Projets**: sdk_relay, sdk_storage, lecoffre-front - **Caractéristiques**: - Utilise Docker BuildKit - Support SSH pour les clonages Git @@ -177,10 +166,8 @@ Les CI sont visibles sur `git.4nkweb.com` dans l'interface web de chaque projet. |------|--------|-----|--------|--------|-------| | 2025-09-21 | sdk_relay | ext | 0180d32 | ✅ CI déclenchée | Fix config file reading logic | | 2025-09-21 | sdk_storage | ext | - | ✅ CI déclenchée | Tag créé et poussé | -| 2025-09-21 | sdk_signer | ext | - | ✅ CI déclenchée | Tag créé et poussé | | 2025-09-21 | ihm_client | ext | - | ✅ CI déclenchée | Tag créé et poussé | | 2025-09-21 | lecoffre-front | ext | - | ✅ CI déclenchée | Tag créé et poussé | -| 2025-09-21 | lecoffre-back-mini | ext | - | ✅ CI déclenchée | Tag créé et poussé | ### Détails des projets vérifiés @@ -188,7 +175,6 @@ Les CI sont visibles sur `git.4nkweb.com` dans l'interface web de chaque projet. |--------|---------|----------------|----------|------------|--------| | sdk_relay | ext | ci-trigger-ext, ext | build-ext.yml | ✅ | ✅ Configuré | | sdk_storage | ext | ext | build-ext.yml | ✅ | ✅ Configuré | -| sdk_signer | ext | ext | build-ext.yml | ✅ | ✅ Configuré | | ihm_client | ext | ext | docker-ext.yml | ✅ | ✅ Configuré | | lecoffre-front | ext | ext | build-ext.yml | ✅ | ✅ Configuré | diff --git a/IA_agents/README.md b/IA_agents/README.md index 2d9fa9e..3b67e90 100644 --- a/IA_agents/README.md +++ b/IA_agents/README.md @@ -57,7 +57,7 @@ Les services sont organisés en **5 phases** pour optimiser le démarrage et év ### **Ordre par Phases** ``` Phase 1: Services de Base (Parallèle) -├── tor, sdk_storage, sdk_signer, status-api +├── tor, sdk_storage, status-api Phase 2: Services Blockchain (Séquentiel) ├── bitcoin → blindbit → sdk_relay diff --git a/IA_agents/best-practices-deployment.md b/IA_agents/best-practices-deployment.md index 0d8b3f6..96e8129 100644 --- a/IA_agents/best-practices-deployment.md +++ b/IA_agents/best-practices-deployment.md @@ -56,7 +56,7 @@ Services Applicatifs ←→ Services de Monitoring #### **Phase 1: Services de Base (Parallèle)** ```bash # Ces services peuvent démarrer en parallèle -tor + sdk_storage + sdk_signer + status-api +tor + sdk_storage + status-api ``` #### **Phase 2: Services Blockchain (Séquentiel)** diff --git a/IA_agents/context.md b/IA_agents/context.md index 52f8981..f561096 100644 --- a/IA_agents/context.md +++ b/IA_agents/context.md @@ -57,7 +57,6 @@ A déployer par **`lecoffre_node/`** (d'autres projets externes sont ne dépenda ### Services optimisés (2024-12-19) - **`sdk_relay/`** (relai des transations et messages et oracle) - Debian + Rust -- **`sdk_signer/`** (signature des processus métier et des identités/profils) - Debian + Node.js 20 - **`sdk_storage/`** (stockage temporaire) - Debian + Rust - **`ihm_client/`** (iframe dans les frontend des projets pour interactions avec les clés privés Bitcoin Silent Payment) - Debian + Node.js 20 - **`lecoffre-front/`** (frontend du projet lecoffre) - Debian + Node.js 19 diff --git a/IA_agents/deployment-architecture.md b/IA_agents/deployment-architecture.md index be9814b..26cc041 100644 --- a/IA_agents/deployment-architecture.md +++ b/IA_agents/deployment-architecture.md @@ -20,7 +20,6 @@ Ces services peuvent démarrer en parallèle car ils sont indépendants : |---------|------|------------|--------| | **tor** | 9050 | Aucune | `start-with-progress.sh` | | **sdk_storage** | 8081 | Aucune | `start-with-progress.sh` | -| **sdk_signer** | 3001 | Aucune | `start-with-progress.sh` | | **status-api** | 3006 | Aucune | `start-with-progress.sh` | ### **Phase 2: Services Blockchain (Séquentiel)** diff --git a/IA_agents/env-centralized.md b/IA_agents/env-centralized.md index 039a6c6..646d4b7 100644 --- a/IA_agents/env-centralized.md +++ b/IA_agents/env-centralized.md @@ -80,17 +80,6 @@ SDK_RELAY_BOOTSTRAP_FAUCET=true SDK_RELAY_RUST_LOG=DEBUG,reqwest=DEBUG,tokio_tungstenite=DEBUG ``` -### ✍️ Variables SDK_SIGNER -```bash -SIGNER_API_KEY=your-api-key-change-this -SIGNER_PORT=9090 -SIGNER_DATABASE_PATH=./data/server.db -SIGNER_RELAY_URLS=http://localhost:8090 -SIGNER_AUTO_RESTART=true -SIGNER_MAX_RESTARTS=3 -SIGNER_LOG_LEVEL=info -``` - ### 🎯 Variables IHM_CLIENT ```bash VITE_JWT_SECRET_KEY=52b3d77617bb00982dfee15b08effd52cfe5b2e69b2f61cc4848cfe1e98c0bc9 @@ -136,7 +125,6 @@ PROMTAIL_CONFIG_FILE=/etc/promtail/config.yml ### 📁 Fichiers supprimés - ✅ `sdk_relay/.env` -- ✅ `sdk_signer/.env` - ✅ `ihm_client/.env` - ✅ `lecoffre-front/.env` @@ -159,17 +147,6 @@ for (config_key, env_key) in env_vars.iter() { } ``` -#### `sdk_signer/src/config.ts` -```typescript -// Configuration via variables d'environnement (centralisées dans lecoffre_node/.env.master) -export function loadConfig(): AppConfig { - return { - port: parseInt(process.env.PORT || '9090'), - apiKey: process.env.API_KEY || 'your-api-key-change-this', - // ... autres variables - }; -} -``` #### `lecoffre_node/docker-compose.yml` ```yaml @@ -181,11 +158,7 @@ services: - WS_URL=${SDK_RELAY_WS_URL} # ... toutes les variables SDK_RELAY_* - sdk_signer: - environment: - - PORT=${SIGNER_PORT} - - API_KEY=${SIGNER_API_KEY} - # ... toutes les variables SIGNER_* + ``` #### `lecoffre_node/.gitignore` @@ -273,7 +246,6 @@ docker compose --env-file .env.master up -d ### ✅ Avant (problématique) ``` sdk_relay/.env -sdk_signer/.env ihm_client/.env lecoffre-front/.env ├── Variables dupliquées diff --git a/IA_agents/flux.md b/IA_agents/flux.md index 0a029b6..0d56361 100644 --- a/IA_agents/flux.md +++ b/IA_agents/flux.md @@ -25,7 +25,6 @@ | **sdk_relay** | sdk_relay | 0.0.0.0:8090
0.0.0.0:8091 | 8090 (WS)
8091 (HTTP) | WebSocket/HTTP | ws://0.0.0.0:8090
http://0.0.0.0:8091 | | **lecoffre-front** | lecoffre-front | 127.0.0.2:3004 | 3000 | HTTP | http://127.0.0.2:3004 | | **ihm_client** | ihm_client | 0.0.0.0:3003 | 3003 | HTTP | http://0.0.0.0:3003 | -| **sdk_signer** | sdk_signer | 0.0.0.0:3001 | 3001 | HTTP/WebSocket | http://0.0.0.0:3001 | | **sdk_storage** | sdk_storage | 0.0.0.0:8081 | 8080 | HTTP | http://0.0.0.0:8081 | | **grafana** | grafana | 127.0.0.1:3005 | 3000 | HTTP | http://127.0.0.1:3005 | | **loki** | loki | 127.0.0.1:3100 | 3100 | HTTP | http://127.0.0.1:3100 | @@ -48,7 +47,6 @@ | **/** | ihm_client | 3003 | HTTP | Interface principale | | **/lecoffre** | lecoffre-front | 3004 | HTTP | Application LeCoffre | | **/ws/** | sdk_relay | 8090 | WebSocket | Relay WebSocket | -| **/signer/** | sdk_signer | 3001 | HTTP/WebSocket | Service Signer | | **/src/service-workers/** | ihm_client | 3003 | HTTP | Service Workers | | **/grafana/** | grafana | 3005 | HTTP | Interface de monitoring | | **/loki/** | loki | 3100 | HTTP | API de logs | @@ -83,9 +81,7 @@ | Variable | Valeur | Service | |----------|--------|---------| | **VITE_BOOTSTRAPURL** | wss://dev4.4nkweb.com/ws/ | ihm_client | -| **SIGNER_WS_URL** | ws://dev3.4nkweb.com:9090 | sdk_signer | -| **SIGNER_BASE_URL** | https://dev3.4nkweb.com | sdk_signer | -| **RELAY_URLS** | wss://dev4.4nkweb.com/ws/,wss://dev3.4nkweb.com/ws/ | sdk_signer | +| **RELAY_URLS** | wss://dev4.4nkweb.com/ws/,wss://dev3.4nkweb.com/ws/ || | **bootstrap_url** | wss://dev3.4nkweb.com/ws/ | sdk_relay | | **storage** | https://dev4.4nkweb.com/storage | sdk_relay | | **GRAFANA_ADMIN_PASSWORD** | admin123 | grafana | @@ -116,12 +112,6 @@ Internet → dev4.4nkweb.com (Nginx) → Services Locaux 5. **Monitoring** : `https://dev4.4nkweb.com/grafana/` → grafana (127.0.0.1:3005) 6. **Logs API** : `https://dev4.4nkweb.com/loki/` → loki (127.0.0.1:3100) -### 🔗 **Flux de Redirection** - -``` -local.4nkdev.com → dev3.4nkweb.com → https://dev4.4nkweb.com/lecoffre -``` - ### 🌐 **Flux Externes** - **Bootstrap** : `wss://dev3.4nkweb.com/ws/` (Relay externe) @@ -147,7 +137,7 @@ Services → Logs Centralisés → Promtail → Loki → Grafana | **bitcoin** | `logs/bitcoin/` | `./logs/bitcoin:/var/log/bitcoin` | Logs Bitcoin Signet | | **blindbit** | `logs/blindbit/` | `./logs/blindbit:/var/log/blindbit` | Logs Oracle | | **sdk_relay** | `logs/sdk_relay/` | `./logs/sdk_relay:/var/log/sdk_relay` | Logs Relay | -| **sdk_signer** | `logs/sdk_signer/` | `./logs/sdk_signer:/var/log/sdk_signer` | Logs Signer | + | **sdk_storage** | `logs/sdk_storage/` | `./logs/sdk_storage:/var/log/sdk_storage` | Logs Storage | | **lecoffre-front** | `logs/lecoffre-front/` | `./logs/lecoffre-front:/var/log/lecoffre-front` | Logs Frontend | | **ihm_client** | `logs/ihm_client/` | `./logs/ihm_client:/var/log/ihm_client` | Logs IHM | @@ -193,7 +183,6 @@ Selon les règles du projet, l'ordre de démarrage est : 3. **blindbit** - Oracle Bitcoin 4. **sdk_storage** - Stockage temporaire 5. **sdk_relay** - Relais des transactions -6. **sdk_signer** - Signature des processus 7. **ihm_client** - Interface utilisateur 9. **lecoffre-front** - Frontend application @@ -348,7 +337,6 @@ docker compose --env-file .env.master up -d - ✅ **IHM Client** : `https://dev4.4nkweb.com/` - ✅ **API Backend** : `https://dev4.4nkweb.com/api/` - ✅ **WebSocket Relay** : `https://dev4.4nkweb.com/ws/` -- ✅ **SDK Signer** : `https://dev4.4nkweb.com/signer/` - ✅ **BlindBit** : `https://dev4.4nkweb.com/blindbit/` --- diff --git a/IA_agents/idnot-front-agnostic.md b/IA_agents/idnot-front-agnostic.md index 3518940..1452df0 100644 --- a/IA_agents/idnot-front-agnostic.md +++ b/IA_agents/idnot-front-agnostic.md @@ -124,3 +124,4 @@ NEXT_PUBLIC_BACK_API_VERSION=v1 - En prod, préférer cookies sécurisés et durées minimales + diff --git a/IA_agents/prompts/prompt-CI_all.md b/IA_agents/prompts/prompt-CI_all.md index e348dc2..9575ad7 100644 --- a/IA_agents/prompts/prompt-CI_all.md +++ b/IA_agents/prompts/prompt-CI_all.md @@ -4,8 +4,25 @@ Apprend et retient : `IA_agents/prompts/prompt-global.md`. Démarre en lisant tous les documents de `IA_agents/`. Tous les documents des projets doivent être dans un dossier `docs/` + --- +## Règles générales obligatoires + +- Tres important : ne modifie jamais les fichiers de configuration mais demande à l'utilisateur de faire les modifications. + +- Tres important : ne créé pas de versions de test ou temporaires. + +- Tres important : corrige toutes les erreurs même petites avant de passer à la suite. + +- Tres important : corrige sans simplifier ,sans contourner, sans faire de proxy, sans versions supplémentaires + +- Tres important : corrige en améliorant les versions actuelless des fichiers. + +- Très important : nettoie les fichiers de tests apres les tests. + +- Très important : ne fait pas de nouveaux fichiers de documentation, enrichie les fichiers existant. + ## Todo * [ ] Soit très explicite dans tes commandes pour ne pas entrainer de confusions entre **tag** et **branche** de même nom. diff --git a/IA_agents/prompts/prompt-deploy.md b/IA_agents/prompts/prompt-deploy.md index a07046b..84184da 100644 --- a/IA_agents/prompts/prompt-deploy.md +++ b/IA_agents/prompts/prompt-deploy.md @@ -6,10 +6,10 @@ Apprend et retient : `IA_agents/prompts/prompt-global.md`. ## 🎯 Prompt pour l'Agent IA -Déploie l'architecture LeCoffre Node complète en respectant strictement les consignes de déploiement. -Arrete et nettoie tous les services, images, tests, commandes, éditions... encore actives avant de relancer proprement. -Si un processus est en attente alors utiliser les scripts de monitoring, si ils sont peu utiles pour comprendre la raison de l'attente ou la progression, alors améliore les. +- Déploie l'architecture LeCoffre Node complète en respectant strictement les consignes de déploiement. +- Arrete et nettoie tous les services, images, tests, commandes, éditions... encore actives avant de relancer proprement. +Si un processus est en attente alors utiliser les scripts de monitoring, si ils sont peu utiles pour comprendre la raison de l'attente ou la progression, alors améliore les. --- @@ -38,6 +38,8 @@ A mettre dans ta TODO (vérifie que tout est fait à la fin): Fait tout ce qui suit pour tous les dossiers. ### Phase 1: Vérifications initiales +- [ ] Copie lecoffre_node/.env.master dans tous les dossiers des projets et adapte leur build et fichiers de configuration pour intégrer la totalités des variables. +- [ ] Vérifie que l'application n'a pas de variables manquantes dans ce fichier au quel cas ajoute les avec une valeur vide à la fin et signale les en fin de todo. - [ ] Vérifier que le dépôt distant est public (si possible) - [ ] Vérifier l'utilisation des clés SSH pour le déploiement Git - [ ] Vérifier que la branche courante est bien `ext` @@ -119,7 +121,6 @@ docker compose --env-file .env.master up -d Variables disponibles : - SDK_RELAY_* : Configuration du service relay -- SIGNER_* : Configuration du service signer - VITE_* : Configuration des applications frontend - IDNOT_* : Configuration des APIs notaires - STRIPE_* : Configuration des paiements @@ -197,8 +198,7 @@ docker compose start - **Utilise les outils de monitoring** pour suivre la progression et diagnostiquer les problèmes - Front Next.js utilise un basePath `/lecoffre` : tester `/lecoffre/` (pas `/`) - Vérifier dans le conteneur front: `NEXT_PUBLIC_4NK_URL` et `NEXT_PUBLIC_4NK_IFRAME_URL` - - `sdk_signer` WebSocket: health/validations acceptent 101/426/200 - - BlindBit: l’API peut renvoyer `000` depuis l’hôte; si conteneur healthy, considérer OK + - BlindBit: l’API peut renvoyer `000` depuis l’hôte; si conteneur healthy, considérer OK - **Surveille la progression Bitcoin IBD** : Le processus peut prendre du temps - **Attends la synchronisation Bitcoin** avant de démarrer SDK Relay - **Vérifie les dépendances** avant de démarrer les services LeCoffre @@ -209,7 +209,6 @@ docker compose start **Phase 1: Services de base (parallèle)** 1. tor 2. sdk_storage -3. sdk_signer 4. status-api **Phase 2: Services blockchain (séquentiel)** diff --git a/IA_agents/prompts/prompt-todo_status.md b/IA_agents/prompts/prompt-todo_status.md index 6284673..f7e8b4f 100644 --- a/IA_agents/prompts/prompt-todo_status.md +++ b/IA_agents/prompts/prompt-todo_status.md @@ -1,24 +1,5 @@ # TODO -Apprend et retient : `IA_agents/prompts/prompt-global.md`. - -Dans la page status (`lecoffre_node/web/status`): -* [ ] Ajouter l'État du miner -* [ ] Du bootsrap tor -* [ ] Du chargement ibd de Bitcoin et de Signet -* [ ] Du scan des blocs de blindbit-oracle -* [ ] Du scan des transactions du signer -* [ ] Du scan des transactions du relay -* [ ] Des jetons du relai -* [ ] Des jetons du miner -* [ ] Des jetons du signer -* [ ] De l'API OVH pour les sms -* [ ] De l'API Stripe pour le paiement -* [ ] Du nombre se souscriptions par offres -* [ ] De l'API Mailshimp pour les mails -Par images docker dans leurs sections actuelles: -* [ ] Préciser l'État selon l'État des l'image docker avec l'identifiant images avec la date de l'action du runner et du build avec son lien -* [ ] Affiche l'état de la dernière action du runner. --- diff --git a/README.md b/README.md index a90aee5..331acbc 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,6 @@ Environnement de développement centralisé pour tous les dépôts 4NK et le pro 4NK_env/ # Environnement de développement 4NK + Agents IA ├── lecoffre_node/ # Orchestrateur principal LeCoffre (Nginx intégré) ├── sdk_relay/ # Service de relais WebSocket 4NK -├── sdk_signer/ # Service de signature 4NK ├── sdk_storage/ # Service de stockage 4NK ├── sdk_client/ # Client SDK 4NK ├── sdk_common/ # Composants communs 4NK diff --git a/doc_api/.ci-trigger b/doc_api/.ci-trigger deleted file mode 100644 index 10eb471..0000000 --- a/doc_api/.ci-trigger +++ /dev/null @@ -1 +0,0 @@ -# CI Trigger Sun Sep 21 19:58:04 UTC 2025 diff --git a/docs/idnot-front-agnostic.md b/docs/idnot-front-agnostic.md new file mode 100644 index 0000000..8bc932e --- /dev/null +++ b/docs/idnot-front-agnostic.md @@ -0,0 +1,96 @@ +IdNot front-agnostic flow (durable setup) + +Overview + +- Goal: Backend is agnostic of the frontend, supports any domain and localhost. IdNot keeps the fixed redirect_uri, Nginx forwards to backend, backend returns to the real frontend with an authToken in the fragment. + +Data flow + +1) Frontend (Next.js) requests state + - POST https://dev3.4nkweb.com/api/v1/idnot/state + - Body: { next_url: } + - Returns: { state } + +2) Frontend builds authorize URL and redirects + - authorize = ${NEXT_PUBLIC_IDNOT_BASE_URL}${NEXT_PUBLIC_IDNOT_AUTHORIZE_ENDPOINT} + - query: client_id, redirect_uri = NEXT_PUBLIC_IDNOT_REDIRECT_URI_FIXED, scope=openid,profile, response_type=code, state + +3) IdNot redirects to the fixed redirect + - http://local.4nkweb.com:3000/authorized-client?code=...&state=... + +4) Nginx (dev4) 301 → dev3 backend callback + - https://dev3.4nkweb.com/idnot/callback?code=...&state=... + +5) Backend callback + - Verifies state (HMAC, TTL, nonce, host allowlist) + - Exchanges code with IdNot + - Creates session/authToken + - 302 → next_url#authToken=... + +Frontend requirements + +- Expose runtime variables in Next.js (NEXT_PUBLIC_*): + - NEXT_PUBLIC_IDNOT_BASE_URL=https://qual-connexion.idnot.fr + - NEXT_PUBLIC_IDNOT_AUTHORIZE_ENDPOINT=/IdPOAuth2/authorize/ (or provider-specific) + - NEXT_PUBLIC_IDNOT_CLIENT_ID= + - NEXT_PUBLIC_IDNOT_REDIRECT_URI_FIXED=http://local.4nkweb.com:3000/authorized-client + - NEXT_PUBLIC_FRONT_APP_HOST=https://dev4.4nkweb.com/lecoffre + - NEXT_PUBLIC_BACK_BASE=https://dev3.4nkweb.com + +- Login button flow (simplified): + 1) POST ${NEXT_PUBLIC_BACK_BASE}/api/v1/idnot/state { next_url: window.location.origin + '/authorized-client' } + 2) On {state}, redirect to authorize with &state= + +- Callback page + - Read authToken from window.location.hash + - Store token then clear hash + +Backend requirements (summary) + +- Env: + - BACK_HMAC_SECRET= + - STATE_TTL_SECONDS=180 + - ALLOW_LOCALHOST_REDIRECTS=true + - ALLOWED_REDIRECT_HOST_PATTERNS=^dev4\.4nkweb\.com$,^localhost$,^127\.0\.0\.1$ + +- Endpoints: + - POST /api/v1/idnot/state → returns signed state with {next_url, nonce, ts} + - GET /idnot/callback → verifies state, exchanges code, then 302 to next_url#authToken=... + +Nginx notes + +- On dev4 (front): host local.4nkweb.com:3000 must return 301 to dev3 callback, preserving full query string. +- On dev3 (back): proxy /idnot/callback and /api/ to the backend server. + +Docker Compose (durable) + +- Build lecoffre-front locally to ensure latest code and env are used: + lecoffre-front: + build: + context: ../lecoffre-front + dockerfile: Dockerfile + env_file: + - .env.master + +- Keep .env.master at lecoffre_node/.env.master and include the NEXT_PUBLIC_* variables above. See .env.master.example. + +Testing checklist + +- On login: + - Network shows POST /api/v1/idnot/state before redirect + - IdNot authorize URL contains &state= + - dev3 /idnot/callback returns 302 to next_url#authToken=... + - Front stores token and proceeds + +Security considerations + +- HMAC-signed state with TTL and nonce (anti-replay) +- Strict host allowlist for next_url and localhost allowed only if ALLOW_LOCALHOST_REDIRECTS=true +- Prefer fragment (#authToken) to avoid logging tokens in proxies + +Operations + +- To rebuild and restart only the frontend after changes: + docker compose build lecoffre-front + docker compose up -d --no-deps --force-recreate lecoffre-front + diff --git a/lecoffre-front b/lecoffre-front index 2410a40..f659362 160000 --- a/lecoffre-front +++ b/lecoffre-front @@ -1 +1 @@ -Subproject commit 2410a40a4bf1cf44d0a4d1e66423de4f2cca5ae9 +Subproject commit f659362682803d72dc619ca2e5e753a10ea8e192 diff --git a/lecoffre_node b/lecoffre_node index 32f1c79..0517aaa 160000 --- a/lecoffre_node +++ b/lecoffre_node @@ -1 +1 @@ -Subproject commit 32f1c7946c151957ca145e367ee71bd78f46ff01 +Subproject commit 0517aaaee543396bfac3d49aed30aade86021ea7 diff --git a/scripts/check-repos-status.sh b/scripts/check-repos-status.sh index dacb5ae..451eecc 100755 --- a/scripts/check-repos-status.sh +++ b/scripts/check-repos-status.sh @@ -13,7 +13,6 @@ log() { declare -a PROJECTS=( "lecoffre_node" "sdk_relay" - "sdk_signer" "sdk_storage" "sdk_client" "sdk_common" diff --git a/scripts/clone-all-repos.sh b/scripts/clone-all-repos.sh index b41bc2d..03c49a9 100755 --- a/scripts/clone-all-repos.sh +++ b/scripts/clone-all-repos.sh @@ -19,7 +19,6 @@ BASE_DIR="/home/debian/4NK_env" declare -a PROJECTS=( "lecoffre_node" "sdk_relay" - "sdk_signer" "sdk_storage" "sdk_client" "sdk_common" diff --git a/scripts/init-4nk-env-repo.sh b/scripts/init-4nk-env-repo.sh index 545c49f..2054d75 100755 --- a/scripts/init-4nk-env-repo.sh +++ b/scripts/init-4nk-env-repo.sh @@ -76,7 +76,6 @@ Environnement de développement centralisé pour tous les dépôts 4NK et le pro 4NK_env/ # Environnement de développement 4NK ├── lecoffre_node/ # Orchestrateur principal LeCoffre (Nginx intégré) ├── sdk_relay/ # Service de relais WebSocket 4NK -├── sdk_signer/ # Service de signature 4NK ├── sdk_storage/ # Service de stockage 4NK ├── sdk_client/ # Client SDK 4NK ├── sdk_common/ # Composants communs 4NK @@ -106,7 +105,7 @@ cd lecoffre_node - **LeCoffre Node** : Orchestrateur principal avec Nginx intégré - **Bitcoin Signet** : Nœud Bitcoin pour tests - **Monitoring** : Grafana, Loki, Promtail -- **Services SDK 4NK** : Relay, Signer, Storage +- **Services SDK 4NK** : Relay, Storage - **Applications LeCoffre** : Frontend, Backend, IHM Client ## Ports diff --git a/scripts/test-env-config.sh b/scripts/test-env-config.sh index d3c7430..7897a74 100755 --- a/scripts/test-env-config.sh +++ b/scripts/test-env-config.sh @@ -39,7 +39,6 @@ if [ -f ".env.master" ]; then success "✅ Fichier .env.master existe" echo " Taille: $(wc -l < .env.master) lignes" echo " Variables SDK_RELAY: $(grep -c "^SDK_RELAY_" .env.master)" - echo " Variables SIGNER: $(grep -c "^SIGNER_" .env.master)" echo " Variables VITE: $(grep -c "^VITE_" .env.master)" else error "❌ Fichier .env.master manquant" @@ -58,7 +57,7 @@ fi # Test 3: Vérification des fichiers .env supprimés log "3. Vérification des fichiers .env supprimés..." missing_env_files=0 -for project in sdk_relay sdk_signer sdk_storage ihm_client lecoffre-front; do +for project in sdk_relaysdk_storage ihm_client lecoffre-front; do if [ -f "../$project/.env" ]; then error "❌ Fichier .env existe encore dans $project" missing_env_files=$((missing_env_files + 1)) @@ -84,13 +83,6 @@ else error "❌ sdk_relay/src/config.rs n'utilise pas std::env" fi -# Test sdk_signer config.ts -if ! grep -q "dotenv.config()" ../sdk_signer/src/config.ts; then - success "✅ sdk_signer/src/config.ts ne charge plus dotenv" -else - error "❌ sdk_signer/src/config.ts charge encore dotenv" -fi - # Test 5: Vérification des variables d'environnement dans docker-compose.yml log "5. Vérification des variables d'environnement dans docker-compose.yml..."