/** * Protocol types — mirrors the server's protocol/spec.ts for use in the extension. */ export const PROTOCOL_VERSION = "2.0.0"; export const MAX_STORED_COOKIES_PER_DEVICE = 10_000; export const PAIRING_CODE_LENGTH = 6; export const PAIRING_TTL_MS = 5 * 60 * 1000; export const NONCE_BYTES = 24; export const PING_INTERVAL_MS = 30_000; export const PONG_TIMEOUT_MS = 10_000; export const POLL_INTERVAL_MS = 5_000; export const MESSAGE_TYPES = { COOKIE_SYNC: "cookie_sync", COOKIE_DELETE: "cookie_delete", ACK: "ack", PING: "ping", PONG: "pong", ERROR: "error", } as const; export type MessageType = (typeof MESSAGE_TYPES)[keyof typeof MESSAGE_TYPES]; export interface Envelope { type: MessageType; from: string; to: string; nonce: string; payload: string; timestamp: string; sig: string; } export interface CookieEntry { domain: string; name: string; value: string; path: string; secure: boolean; httpOnly: boolean; sameSite: "strict" | "lax" | "none"; expiresAt: string | null; } export interface CookieSyncPayload { action: "set" | "delete"; cookies: CookieEntry[]; lamportTs: number; } export interface EncryptedCookieBlob { id: string; deviceId: string; domain: string; cookieName: string; path: string; nonce: string; ciphertext: string; lamportTs: number; updatedAt: string; } export interface DeviceRegisterRequest { deviceId: string; name: string; platform: string; encPub: string; } export interface DeviceInfo { deviceId: string; name: string; platform: string; encPub: string; token: string; createdAt: string; } export interface PairingResult { peerDeviceId: string; peerX25519PubKey: string; }