Free, Open Source, Self-Hosted WhatsApp API Gateway
TypeScript apibotgatewayself-hostedwhatsappwhatsapp-apiwhatsapp-automationwhatsapp-botwhatsapp-gatewaywhatsapp-gateway-apiwhatsapp-webwhatsapp-web-api
fix(dashboard): show the verify token when an instance is created
Yudhi Armyndharisa1d46a7b8a09
diff --git a/dashboard/src/components/PluginInstances.test.ts b/dashboard/src/components/PluginInstances.test.tsindex c2901926f..67ea00a50 100644--- a/dashboard/src/components/PluginInstances.test.ts+++ b/dashboard/src/components/PluginInstances.test.ts@@ -26,6 +26,15 @@ const BOUND = {ingressUrls: [],};+// The create response is the one place the plaintext secret and an auto-generated verify token appear.+const MINTED = {+ ...BOUND,+ instanceId: 'acct2',+ sessionScope: null,+ secret: 'plain-signing-secret-0123',+ verifyToken: 'auto-verify-token-4567',+};+const calls: { method: string; path: string; body?: unknown }[] = [];function installFetchStub(): void {@@ -36,6 +45,7 @@ function installFetchStub(): void {calls.push({ method, path, body: typeof init?.body === 'string' ? JSON.parse(init.body) : undefined });if (method === 'GET' && path === BASE) return Promise.resolve(jsonResponse([BOUND]));if (method === 'PATCH' && path === `${BASE}/acct1`) return Promise.resolve(jsonResponse(BOUND));+ if (method === 'POST' && path === BASE) return Promise.resolve(jsonResponse(MINTED, 201));return Promise.resolve(jsonResponse({ message: `unstubbed ${method} ${path}` }, 404));}) as typeof fetch;}@@ -90,3 +100,17 @@ test('clearing a bound session scope saves the instance for all sessions', asyncassert.equal((patch.body as { sessionScope?: unknown }).sessionScope, null);});});++test('the created view shows an auto-generated verify token with a copy button', async () => {+ const { screen, fireEvent, within } = rtl;+ renderInstances();++ fireEvent.click(await screen.findByRole('button', { name: 'Create instance' }));+ fireEvent.change(screen.getByLabelText('Instance ID'), { target: { value: 'acct2' } });+ fireEvent.click(screen.getByRole('button', { name: 'Create' }));++ const dialog = await screen.findByRole('dialog', { name: 'Instance created' });+ const token = within(dialog).getByText('auto-verify-token-4567');+ assert.ok(token.closest('.pi-secret')?.querySelector('button'), 'no copy button next to the verify token');+ within(dialog).getByText('Verify token');+});diff --git a/dashboard/src/components/PluginInstances.tsx b/dashboard/src/components/PluginInstances.tsxindex 6a8c647d5..2e33f0fea 100644--- a/dashboard/src/components/PluginInstances.tsx+++ b/dashboard/src/components/PluginInstances.tsx@@ -304,6 +304,18 @@ export function PluginInstances({ pluginId }: { pluginId: string }) {{copied === 'secret' ? <Check size={16} /> : <Copy size={16} />}</button></div>+ {/* Revealed only here; later reads mask it, so an auto-generated token is lost if not shown. */}+ {minted.verifyToken && (+ <>+ <label>{t('plugins.instances.created.verifyToken')}</label>+ <div className="pi-secret">+ <code>{minted.verifyToken}</code>+ <button className="btn-primary" onClick={() => void copy(minted.verifyToken!, 'verifyToken')}>+ {copied === 'verifyToken' ? <Check size={16} /> : <Copy size={16} />}+ </button>+ </div>+ </>+ )}<label>{t('plugins.instances.created.ingressUrls')}</label>{minted.ingressUrls.map(u => (<div key={u.route} className="pi-secret">diff --git a/dashboard/src/i18n/locales/ar.json b/dashboard/src/i18n/locales/ar.jsonindex 3abff01d4..cef017b72 100644--- a/dashboard/src/i18n/locales/ar.json+++ b/dashboard/src/i18n/locales/ar.json@@ -1056,7 +1056,8 @@"title": "تم إنشاء المثيل","hint": "انسخ المفتاح السري الآن — لن يُعرض مرة أخرى.","secret": "مفتاح التوقيع السري",- "ingressUrls": "عنوان (عناوين) الدخول"+ "ingressUrls": "عنوان (عناوين) الدخول",+ "verifyToken": "رمز التحقق"},"regenerate": {"title": "إعادة إنشاء المفتاح السري",diff --git a/dashboard/src/i18n/locales/de.json b/dashboard/src/i18n/locales/de.jsonindex a9431a26d..c4e0900f5 100644--- a/dashboard/src/i18n/locales/de.json+++ b/dashboard/src/i18n/locales/de.json@@ -1039,7 +1039,8 @@"title": "Instanz erstellt","hint": "Kopiere das Geheimnis jetzt — es wird nur einmal angezeigt.","secret": "Signaturgeheimnis",- "ingressUrls": "Ingress-URL(s)"+ "ingressUrls": "Ingress-URL(s)",+ "verifyToken": "Verifizierungstoken"},"regenerate": {"title": "Geheimnis neu erstellen",diff --git a/dashboard/src/i18n/locales/en.json b/dashboard/src/i18n/locales/en.jsonindex 3ff33a058..8dd582aad 100644--- a/dashboard/src/i18n/locales/en.json+++ b/dashboard/src/i18n/locales/en.json@@ -1038,7 +1038,8 @@"title": "Instance created","hint": "Copy the secret now — it is shown only once.","secret": "Signing secret",- "ingressUrls": "Ingress URL(s)"+ "ingressUrls": "Ingress URL(s)",+ "verifyToken": "Verify token"},"regenerate": {"title": "Regenerate secret",diff --git a/dashboard/src/i18n/locales/es.json b/dashboard/src/i18n/locales/es.jsonindex 031db37bb..1657f463c 100644--- a/dashboard/src/i18n/locales/es.json+++ b/dashboard/src/i18n/locales/es.json@@ -1043,7 +1043,8 @@"title": "Instancia creada","hint": "Copia el secreto ahora — solo se muestra una vez.","secret": "Secreto de firma",- "ingressUrls": "URL(s) de entrada"+ "ingressUrls": "URL(s) de entrada",+ "verifyToken": "Token de verificación"},"regenerate": {"title": "Regenerar secreto",diff --git a/dashboard/src/i18n/locales/fr.json b/dashboard/src/i18n/locales/fr.jsonindex e870ba634..352b56f67 100644--- a/dashboard/src/i18n/locales/fr.json+++ b/dashboard/src/i18n/locales/fr.json@@ -1043,7 +1043,8 @@"title": "Instance créée","hint": "Copiez le secret maintenant — il ne sera affiché qu'une seule fois.","secret": "Secret de signature",- "ingressUrls": "URL(s) d'entrée"+ "ingressUrls": "URL(s) d'entrée",+ "verifyToken": "Jeton de vérification"},"regenerate": {"title": "Régénérer le secret",diff --git a/dashboard/src/i18n/locales/he.json b/dashboard/src/i18n/locales/he.jsonindex 5e840f1ca..7b0d26d5d 100644--- a/dashboard/src/i18n/locales/he.json+++ b/dashboard/src/i18n/locales/he.json@@ -1048,7 +1048,8 @@"title": "המופע נוצר","hint": "העתיקו את הסוד כעת — הוא מוצג רק פעם אחת.","secret": "מפתח חתימה סודי",- "ingressUrls": "כתובת/כתובות URL לקליטה"+ "ingressUrls": "כתובת/כתובות URL לקליטה",+ "verifyToken": "טוקן אימות"},"regenerate": {"title": "יצירת סוד מחדש",diff --git a/dashboard/src/i18n/locales/hi.json b/dashboard/src/i18n/locales/hi.jsonindex 3b302c782..c7cfa3a1b 100644--- a/dashboard/src/i18n/locales/hi.json+++ b/dashboard/src/i18n/locales/hi.json@@ -1038,7 +1038,8 @@"title": "इंस्टेंस बनाया गया","hint": "सीक्रेट अभी कॉपी करें — यह केवल एक बार दिखाया जाता है।","secret": "साइनिंग सीक्रेट",- "ingressUrls": "इनग्रेस URL"+ "ingressUrls": "इनग्रेस URL",+ "verifyToken": "सत्यापन टोकन"},"regenerate": {"title": "सीक्रेट पुन: उत्पन्न करें",diff --git a/dashboard/src/i18n/locales/it.json b/dashboard/src/i18n/locales/it.jsonindex 7129ca650..fd3dc911e 100644--- a/dashboard/src/i18n/locales/it.json+++ b/dashboard/src/i18n/locales/it.json@@ -1043,7 +1043,8 @@"title": "Istanza creata","hint": "Copia subito il segreto — viene mostrato solo una volta.","secret": "Segreto di firma",- "ingressUrls": "URL di ingresso"+ "ingressUrls": "URL di ingresso",+ "verifyToken": "Token di verifica"},"regenerate": {"title": "Rigenera segreto",diff --git a/dashboard/src/i18n/locales/ko.json b/dashboard/src/i18n/locales/ko.jsonindex 786288b09..1a0208d18 100644--- a/dashboard/src/i18n/locales/ko.json+++ b/dashboard/src/i18n/locales/ko.json@@ -1039,7 +1039,8 @@"title": "인스턴스 생성 완료","hint": "지금 시크릿을 복사해 두세요 — 한 번만 표시됩니다.","secret": "서명 시크릿",- "ingressUrls": "인그레스 URL"+ "ingressUrls": "인그레스 URL",+ "verifyToken": "인증 토큰"},"regenerate": {"title": "시크릿 재생성",diff --git a/dashboard/src/i18n/locales/pt-BR.json b/dashboard/src/i18n/locales/pt-BR.jsonindex 4bf86fc22..cde168c2e 100644--- a/dashboard/src/i18n/locales/pt-BR.json+++ b/dashboard/src/i18n/locales/pt-BR.json@@ -1043,7 +1043,8 @@"title": "Instância criada","hint": "Copie o segredo agora — ele é exibido apenas uma vez.","secret": "Segredo de assinatura",- "ingressUrls": "URL(s) de entrada"+ "ingressUrls": "URL(s) de entrada",+ "verifyToken": "Token de verificação"},"regenerate": {"title": "Regenerar segredo",diff --git a/dashboard/src/i18n/locales/te.json b/dashboard/src/i18n/locales/te.jsonindex e82ddaae3..cdccaae36 100644--- a/dashboard/src/i18n/locales/te.json+++ b/dashboard/src/i18n/locales/te.json@@ -1039,7 +1039,8 @@"title": "ఇన్స్టాన్స్ సృష్టించబడింది","hint": "సీక్రెట్ను ఇప్పుడే కాపీ చేయండి — ఇది ఒక్కసారి మాత్రమే చూపబడుతుంది.","secret": "సైనింగ్ సీక్రెట్",- "ingressUrls": "ఇన్గ్రెస్ URL(లు)"+ "ingressUrls": "ఇన్గ్రెస్ URL(లు)",+ "verifyToken": "వెరిఫై టోకెన్"},"regenerate": {"title": "సీక్రెట్ను రీజెనరేట్ చేయండి",diff --git a/dashboard/src/i18n/locales/tr.json b/dashboard/src/i18n/locales/tr.jsonindex ebecd8f0e..4df969720 100644--- a/dashboard/src/i18n/locales/tr.json+++ b/dashboard/src/i18n/locales/tr.json@@ -1039,7 +1039,8 @@"title": "Örnek oluşturuldu","hint": "Gizli anahtarı şimdi kopyalayın — yalnızca bir kez gösterilir.","secret": "İmzalama gizli anahtarı",- "ingressUrls": "Giriş URL'leri"+ "ingressUrls": "Giriş URL'leri",+ "verifyToken": "Doğrulama belirteci"},"regenerate": {"title": "Gizli anahtarı yeniden oluştur",diff --git a/dashboard/src/i18n/locales/zh-CN.json b/dashboard/src/i18n/locales/zh-CN.jsonindex 62f780cce..d3453cd46 100644--- a/dashboard/src/i18n/locales/zh-CN.json+++ b/dashboard/src/i18n/locales/zh-CN.json@@ -1039,7 +1039,8 @@"title": "实例已创建","hint": "请立即复制密钥——它只会显示一次。","secret": "签名密钥",- "ingressUrls": "接入 URL"+ "ingressUrls": "接入 URL",+ "verifyToken": "验证令牌"},"regenerate": {"title": "重新生成密钥",diff --git a/dashboard/src/i18n/locales/zh-HK.json b/dashboard/src/i18n/locales/zh-HK.jsonindex f865bbbee..90b001927 100644--- a/dashboard/src/i18n/locales/zh-HK.json+++ b/dashboard/src/i18n/locales/zh-HK.json@@ -1039,7 +1039,8 @@"title": "執行個體已建立","hint": "請立即複製密鑰——只會顯示一次。","secret": "簽署密鑰",- "ingressUrls": "連入 URL"+ "ingressUrls": "連入 URL",+ "verifyToken": "驗證權杖"},"regenerate": {"title": "重新產生密鑰",