import { JustDropApi, type RoomFileMeta, type RoomState } from "./api.js"; import { type CryptoKey } from "./crypto.js"; export type SendPhase = "encrypting" | "uploading" | "finalizing"; export declare class DropSession { readonly api: JustDropApi; readonly roomCode: string; readonly role: "sender" | "receiver"; private readonly keyPair; readonly expiresAt: number | null; private readonly clientId?; private heartbeat; private otherPublicKey; private constructor(); static createAsSender(api: JustDropApi, timerMinutes: number): Promise; static joinAsReceiver(api: JustDropApi, roomCode: string): Promise; private startHeartbeat; /** * Fetches (and caches) the other party's RSA public key, retrying while they * may still be completing their join handshake. */ fetchPeerPublicKey(attempts?: number, delayMs?: number): Promise; watch(onUpdate: (state: RoomState | null) => void, signal: AbortSignal): Promise; /** Encrypts and uploads one file. Requires the peer's public key (they must have joined). */ sendFile(file: { name: string; mime?: string; data: Uint8Array; }, onPhase?: (phase: SendPhase) => void): Promise; /** Downloads and decrypts one file that is in "ready" state. */ downloadFile(fileId: string): Promise<{ name: string; mime: string; data: Uint8Array; meta: RoomFileMeta; }>; /** Stops heartbeats and flags this side as departed. Does not delete the room. */ leave(): Promise; /** Deletes the room and its files server-side. */ closeRoom(): Promise; }