From ebba0c8ce83580112e4faa3a6ea331ba005f1e08 Mon Sep 17 00:00:00 2001 From: Fabrice Coutadeur Date: Thu, 8 Oct 2026 12:00:17 +0200 Subject: [PATCH] =?UTF-8?q?Correction=20:=20cr=C3=A9ation=20d'arbre=20impo?= =?UTF-8?q?ssible=20en=20HTTP=20simple?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit crypto.randomUUID n'est exposé par le navigateur qu'en contexte sécurisé (HTTPS ou localhost). Servie en HTTP simple, l'app plantait dans generateSecurePassword à l'étape de création de l'arbre. Repli sur crypto.getRandomValues, disponible partout, qui produit le même UUID v4 sans tirets. Signed-off-by: Fabrice Coutadeur --- frontend/src/App.jsx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/frontend/src/App.jsx b/frontend/src/App.jsx index 34bdb03..6d1fb8c 100644 --- a/frontend/src/App.jsx +++ b/frontend/src/App.jsx @@ -107,7 +107,15 @@ function normalizeSlug(value) { } function generateSecurePassword() { - return crypto.randomUUID().replace(/-/g, '') + if (typeof crypto.randomUUID === 'function') { + return crypto.randomUUID().replace(/-/g, '') + } + // crypto.randomUUID n'est exposé qu'en contexte sécurisé (HTTPS ou localhost) : + // sur du HTTP simple, getRandomValues reste disponible et donne le même UUID v4. + const bytes = crypto.getRandomValues(new Uint8Array(16)) + bytes[6] = (bytes[6] & 0x0f) | 0x40 + bytes[8] = (bytes[8] & 0x3f) | 0x80 + return Array.from(bytes, (byte) => byte.toString(16).padStart(2, '0')).join('') } function getAccountSelfPersonStorageKey(userEmail, treeId) {