Relay pairing offer v2 (E2EE) + host connections

This commit is contained in:
Mohamed Boudra
2026-02-04 22:53:00 +07:00
parent 9ce4ad9758
commit 0218729316
59 changed files with 2022 additions and 1547 deletions
@@ -2,11 +2,11 @@ import { test, expect } from './fixtures';
test('connects via relay when direct endpoints fail', async ({ page }) => {
const relayPort = process.env.E2E_RELAY_PORT;
const sessionId = process.env.E2E_RELAY_SESSION_ID;
const serverId = process.env.E2E_SERVER_ID;
const daemonPublicKeyB64 = process.env.E2E_RELAY_DAEMON_PUBLIC_KEY;
if (!relayPort || !sessionId || !daemonPublicKeyB64) {
if (!relayPort || !serverId || !daemonPublicKeyB64) {
throw new Error(
'E2E_RELAY_PORT, E2E_RELAY_SESSION_ID, or E2E_RELAY_DAEMON_PUBLIC_KEY is not set (expected from globalSetup).'
'E2E_RELAY_PORT, E2E_SERVER_ID, or E2E_RELAY_DAEMON_PUBLIC_KEY is not set (expected from globalSetup).'
);
}
@@ -14,12 +14,13 @@ test('connects via relay when direct endpoints fail', async ({ page }) => {
const relayEndpoint = `127.0.0.1:${relayPort}`;
const host = {
id: 'relay-only-daemon',
serverId,
label: 'relay-daemon',
endpoints: [relayEndpoint],
daemonPublicKeyB64,
relay: { endpoint: relayEndpoint, sessionId },
metadata: null,
connections: [
{ id: 'direct:127.0.0.1:9', type: 'direct', endpoint: '127.0.0.1:9' },
{ id: `relay:${relayEndpoint}`, type: 'relay', relayEndpoint, daemonPublicKeyB64 },
],
preferredConnectionId: 'direct:127.0.0.1:9',
createdAt: nowIso,
updatedAt: nowIso,
};
@@ -35,6 +36,6 @@ test('connects via relay when direct endpoints fail', async ({ page }) => {
await page.reload();
// Should eventually connect through the relay candidate URL.
await expect(page.getByText(relayEndpoint, { exact: true })).toBeVisible();
await expect(page.getByText('Connected via relay', { exact: true }).first()).toBeVisible({ timeout: 20000 });
await expect(page.getByText('Online', { exact: true }).first()).toBeVisible({ timeout: 20000 });
});