From 58c8db4ea923571b56ae2407479cba18d34daae8 Mon Sep 17 00:00:00 2001 From: sneak Date: Wed, 13 May 2026 18:01:18 -0700 Subject: [PATCH] Update public exports and README for Client class Exports Client, all lower-level modules, and all types from src/index.ts. Replaces Phase 7 (on-disk session persistence) with the Client class phase: session lives in the object, consumer handles persistence via toJSON/fromJSON. --- README.md | 15 ++++++++++----- src/index.ts | 22 ++++++++++++++++++++++ 2 files changed, 32 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 61b267a..49cc839 100644 --- a/README.md +++ b/README.md @@ -649,12 +649,17 @@ Phase 6: download - [x] Live integration test: logs in, decrypts collections and files, downloads a real JPEG from the dev account and verifies it on disk -Phase 7: session persistence +Phase 7: Client class -- [ ] `SessionStore` writing an encrypted session blob with a key from the OS - keychain (`keytar`) or a `0600` keyfile fallback -- [ ] `Client.fromSavedSession()` and `Client.saveSession()` -- [ ] `quack logout` deletes the session and the keychain entry +- [x] `Client.login({ email, password, totp?, emailOTP? })` performs the full + SRP handshake, key unwrap, returns a ready Client +- [x] `Client.fromJSON(snapshot)` restores from a serialized snapshot +- [x] `client.toJSON()` produces a `ClientSnapshot` the consumer can persist +- [x] `client.whoami()`, `client.logout()` +- [x] `client.listCollections()` with decryption +- [x] `client.listFiles(collectionID, collectionKey)` with pagination +- [x] `client.downloadFile(file, outPath?)` and `client.downloadThumbnail()` +- [x] Literate test/client/usage.test.ts tutorial covering the entire API Phase 8: CLI diff --git a/src/index.ts b/src/index.ts index 073f505..17c8f57 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,9 +1,31 @@ export const VERSION = "0.0.0"; +export { Client, type LoginOptions, type ClientSnapshot } from "./client.js"; +export { ApiClient, ApiError, type ApiClientOptions } from "./api/client.js"; export { unwrapAuth, type UnwrapResult } from "./auth/unwrap.js"; +export { + beginLogin, + submitTOTP, + requestEmailOTP, + submitEmailOTP, +} from "./auth/login.js"; +export { decryptCollection, decryptFile } from "./model/index.js"; +export { downloadFile, downloadThumbnail } from "./download/index.js"; export type { AuthorizationResponse, KeyAttributes, LoginChallenge, SRPAttributes, } from "./auth/types.js"; +export type { + Collection, + CollectionType, + EnteFile, + FileBlob, + FileMetadata, + FileType, + Microseconds, + RawCollection, + RawEnteFile, +} from "./model/types.js"; +export type { DownloadResult } from "./download/index.js";