import { session } from 'electron'; /** * Pose le cookie de session dans la partition du renderer, sans écran de login : login * server-to-server depuis la session Electron cible (le Set-Cookie atterrit dans son jar), avec le * token frais reçu au handshake. Le token ne transite jamais par le renderer. */ export async function seedSessionCookie(partition: string, url: string, token: string): Promise { const ses = session.fromPartition(partition); const res = await ses.fetch(`${url}/api/v1/auth/login`, { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ token }), }); if (!res.ok) throw new Error(`daemon login failed (HTTP ${res.status})`); }