import type { ServerAPI } from '@signalk/server-api'; import type { IRouter } from 'express'; import type { DeviceAnchor } from './approval'; import type { PendingUnlink, RemoteLink } from './remotelink'; import type { UplinkStatus } from './uplink'; export type RemoteState = RemoteLink; export type PairScreen = { state: 'idle'; } | { state: 'showing_code'; userCode: string; expiresAt: string; } | { state: 'awaiting_approval'; userCode: string; email: string | null; expiresAt: string; device?: { kid: string; fingerprint: string; }; } | { state: 'paired'; boatId: string; email: string | null; pairedAt: string; uplink?: UplinkStatus; } | { state: 'expired'; } | { state: 'error'; message: string; }; export type PairStatus = PairScreen & { security_off?: boolean; pairing_locked?: boolean; revoke_pending?: boolean; }; export declare function securityOff(app: ServerAPI, req: unknown): boolean; export declare function writeLocked(app: ServerAPI, req: unknown, acceptOpenNetwork: boolean): boolean; export declare const WRITE_LOCKED_MESSAGE = "Signal K security is off, so Siparu will not pair, unpair or edit the log. Add an admin user in Signal K, or accept the open-network risk in the plugin settings."; interface Deps { app: ServerAPI; relayUrl: string; acceptOpenNetwork: () => boolean; boatName: () => string; uplinkStatus: () => UplinkStatus | null; vesselUrn: () => string; getRemote: () => RemoteState | undefined; saveRemote: (r: RemoteState | undefined) => Promise; getPendingUnlinks: () => PendingUnlink[]; addPendingUnlink: (p: PendingUnlink) => Promise; saveAnchor: (boatId: string, pairedAt: string, anchor: DeviceAnchor) => Promise; } export declare class RelayRefused extends Error { readonly status: number; readonly code: string | null; constructor(status: number, code: string | null, message: string); } export declare function maskEmail(email: string | null): string | null; export declare function registerPairRoutes(router: IRouter, deps: Deps): void; export declare function retryPendingUnlinks(relayUrl: string, getPending: () => PendingUnlink[], clear: (boatToken: string) => Promise, log: (msg: string) => void): Promise; export declare function __resetPairingState(): void; export {};