- Remplacement de DocuSeal par solution souveraine Odentas Sign - Système d'authentification OTP pour signataires (bcryptjs + JWT) - 8 routes API: send-otp, verify-otp, sign, pdf-url, positions, status, webhook, signers - Interface moderne avec canvas de signature et animations (framer-motion, confetti) - Système de templates pour auto-détection des positions de signature (CDDU, RG, avenants) - PDF viewer avec @react-pdf-viewer (compatible Next.js) - Stockage S3: source/, signatures/, evidence/, signed/, certs/ - Tables Supabase: sign_requests, signers, sign_positions, sign_events, sign_assets - Evidence bundle automatique (JSON metadata + timestamps) - Templates emails: OTP et completion - Scripts Lambda prêts: pades-sign (KMS seal) et tsaStamp (RFC3161) - Mode test détecté automatiquement (emails whitelist) - Tests complets avec PDF CDDU réel (2 signataires)
139 lines
5.4 KiB
Bash
Executable file
139 lines
5.4 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
# Script pour tester l'interface de signature Odentas Sign
|
|
# Génère une demande et affiche les URLs pour tester dans le navigateur
|
|
|
|
set -e
|
|
|
|
BASE_URL="http://localhost:3000"
|
|
API_URL="$BASE_URL/api/odentas-sign"
|
|
|
|
echo "═══════════════════════════════════════════════════════"
|
|
echo " 🎨 Test Interface Signature Odentas Sign"
|
|
echo "═══════════════════════════════════════════════════════"
|
|
echo ""
|
|
|
|
# Check if test-odentas-sign-info.json exists
|
|
if [ ! -f "test-odentas-sign-info.json" ]; then
|
|
echo "❌ Fichier test-odentas-sign-info.json introuvable"
|
|
echo ""
|
|
echo "Veuillez d'abord exécuter:"
|
|
echo " node test-odentas-sign.js"
|
|
echo ""
|
|
exit 1
|
|
fi
|
|
|
|
# Extract request ID and signer IDs
|
|
REQUEST_ID=$(jq -r '.requestId' test-odentas-sign-info.json)
|
|
EMPLOYEUR_ID=$(jq -r '.signers[] | select(.role == "Employeur") | .id' test-odentas-sign-info.json)
|
|
SALARIE_ID=$(jq -r '.signers[] | select(.role == "Salarié") | .id' test-odentas-sign-info.json)
|
|
EMPLOYEUR_EMAIL=$(jq -r '.signers[] | select(.role == "Employeur") | .email' test-odentas-sign-info.json)
|
|
SALARIE_EMAIL=$(jq -r '.signers[] | select(.role == "Salarié") | .email' test-odentas-sign-info.json)
|
|
|
|
echo "📋 Informations de la demande:"
|
|
echo " Request ID: $REQUEST_ID"
|
|
echo " Employeur ID: $EMPLOYEUR_ID ($EMPLOYEUR_EMAIL)"
|
|
echo " Salarié ID: $SALARIE_ID ($SALARIE_EMAIL)"
|
|
echo ""
|
|
|
|
# Generate URLs
|
|
EMPLOYEUR_URL="$BASE_URL/signer/$REQUEST_ID/$EMPLOYEUR_ID"
|
|
SALARIE_URL="$BASE_URL/signer/$REQUEST_ID/$SALARIE_ID"
|
|
|
|
echo "═══════════════════════════════════════════════════════"
|
|
echo " 🔗 URLs de Signature"
|
|
echo "═══════════════════════════════════════════════════════"
|
|
echo ""
|
|
echo "👔 Employeur:"
|
|
echo " $EMPLOYEUR_URL"
|
|
echo ""
|
|
echo "👤 Salarié:"
|
|
echo " $SALARIE_URL"
|
|
echo ""
|
|
|
|
# Interactive menu
|
|
echo "═══════════════════════════════════════════════════════"
|
|
echo " 📱 Actions Disponibles"
|
|
echo "═══════════════════════════════════════════════════════"
|
|
echo ""
|
|
echo "1. Ouvrir l'interface Employeur dans le navigateur"
|
|
echo "2. Ouvrir l'interface Salarié dans le navigateur"
|
|
echo "3. Afficher l'OTP de l'Employeur (mode test)"
|
|
echo "4. Afficher l'OTP du Salarié (mode test)"
|
|
echo "5. Vérifier le statut de la demande"
|
|
echo "6. Quitter"
|
|
echo ""
|
|
|
|
while true; do
|
|
read -p "Choisissez une action (1-6): " choice
|
|
|
|
case $choice in
|
|
1)
|
|
echo ""
|
|
echo "🌐 Ouverture de l'interface Employeur..."
|
|
open "$EMPLOYEUR_URL" 2>/dev/null || xdg-open "$EMPLOYEUR_URL" 2>/dev/null || echo "URL: $EMPLOYEUR_URL"
|
|
echo ""
|
|
;;
|
|
2)
|
|
echo ""
|
|
echo "🌐 Ouverture de l'interface Salarié..."
|
|
open "$SALARIE_URL" 2>/dev/null || xdg-open "$SALARIE_URL" 2>/dev/null || echo "URL: $SALARIE_URL"
|
|
echo ""
|
|
;;
|
|
3)
|
|
echo ""
|
|
echo "📧 Envoi de l'OTP à l'Employeur..."
|
|
RESPONSE=$(curl -s -X POST "$API_URL/signers/$EMPLOYEUR_ID/send-otp" \
|
|
-H "Content-Type: application/json")
|
|
|
|
echo "$RESPONSE" | jq -r '.message // .error'
|
|
|
|
# In test mode, OTP will be in server logs
|
|
echo ""
|
|
echo "💡 En mode test, l'OTP s'affiche dans les logs du serveur Next.js"
|
|
echo " Cherchez le message avec des étoiles ⭐"
|
|
echo ""
|
|
;;
|
|
4)
|
|
echo ""
|
|
echo "📧 Envoi de l'OTP au Salarié..."
|
|
RESPONSE=$(curl -s -X POST "$API_URL/signers/$SALARIE_ID/send-otp" \
|
|
-H "Content-Type: application/json")
|
|
|
|
echo "$RESPONSE" | jq -r '.message // .error'
|
|
|
|
echo ""
|
|
echo "💡 En mode test, l'OTP s'affiche dans les logs du serveur Next.js"
|
|
echo " Cherchez le message avec des étoiles ⭐"
|
|
echo ""
|
|
;;
|
|
5)
|
|
echo ""
|
|
echo "📊 Statut de la demande..."
|
|
|
|
echo "Employeur:"
|
|
EMPLOYEUR_STATUS=$(curl -s "$API_URL/signers/$EMPLOYEUR_ID/status")
|
|
echo "$EMPLOYEUR_STATUS" | jq '.signer | {name, role, has_signed, signed_at}'
|
|
|
|
echo ""
|
|
echo "Salarié:"
|
|
SALARIE_STATUS=$(curl -s "$API_URL/signers/$SALARIE_ID/status")
|
|
echo "$SALARIE_STATUS" | jq '.signer | {name, role, has_signed, signed_at}'
|
|
|
|
echo ""
|
|
echo "Progression:"
|
|
echo "$EMPLOYEUR_STATUS" | jq '.request.progress'
|
|
echo ""
|
|
;;
|
|
6)
|
|
echo ""
|
|
echo "👋 Au revoir!"
|
|
exit 0
|
|
;;
|
|
*)
|
|
echo ""
|
|
echo "❌ Choix invalide. Veuillez entrer un nombre entre 1 et 6."
|
|
echo ""
|
|
;;
|
|
esac
|
|
done
|