@telecrypt-io/storage 0.5.27 → 0.5.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -4,6 +4,10 @@
4
4
 
5
5
  End-to-end encrypted file storage and sharing, built on Matrix.
6
6
 
7
+ The current public TeleCrypt architecture, responsibilities, and product limits are authoritative at
8
+ [telecrypt.io/llms.txt](https://telecrypt.io/llms.txt). This README documents this SDK's package API
9
+ and development workflow.
10
+
7
11
  Files are encrypted on the client before upload. The server stores only opaque ciphertext and
8
12
  never holds the decryption keys. Shared vaults let multiple people add and read files, and a
9
13
  Recovery Key restores your files on a new device — even if you lose the original.
@@ -15,7 +19,7 @@ is maintained in its own repository.
15
19
  ## Install
16
20
 
17
21
  ```bash
18
- npm install @telecrypt-io/storage@0.5.10
22
+ npm install @telecrypt-io/storage@0.5.28
19
23
  ```
20
24
 
21
25
  This gives you the `TeleCryptIOStorage` library and its browser-safe `core` API.
@@ -35,8 +39,8 @@ const vault = await core.createVault(storage, "Photos");
35
39
  await core.uploadFile(storage, vault.id, "cat.jpg", bytes, "image/jpeg");
36
40
  ```
37
41
 
38
- The recommended constructors configure the Matrix client with the SDK's bounded, manual-redirect
39
- transport and finite request deadline. The public `new TeleCryptIOStorage(client)` constructor is
42
+ The recommended constructors configure the Matrix client with the SDK's manual-redirect transport
43
+ and finite request deadline. The public `new TeleCryptIOStorage(client)` constructor is
40
44
  an advanced escape hatch: it does not rewrite matrix-js-sdk internals. Callers using it must build
41
45
  the client through matrix-js-sdk's supported `createClient` options (`fetchFn` and
42
46
  `localTimeoutMs`) and remain responsible for the safety of other Matrix SDK requests. SDK methods
@@ -51,7 +55,7 @@ provides no server-side room-creation idempotency key.
51
55
 
52
56
  The SDK owns the browser authorization-code PKCE context in `sessionStorage` and provides device-code,
53
57
  discovery, dynamic registration, identity confirmation, and refresh helpers. OAuth metadata, token
54
- scopes, Matrix user/device identities, redirects, and response bodies are validated and bounded before
58
+ scopes, Matrix user/device identities, redirects, and complete response bodies are validated before
55
59
  they are returned. Network-bound helpers accept `AbortSignal` where cancellation is meaningful; token
56
60
  refresh uses a public client and persists the resulting token pair through the caller's callback.
57
61
 
@@ -107,13 +111,23 @@ Synapse without that extension cannot provide the SDK deletion contract.
107
111
 
108
112
  ```bash
109
113
  npm ci --ignore-scripts --no-fund --no-audit
114
+ npm run test:unit # unit-only checks; does not start Podman
110
115
  npm run synapse:up # disposable local Synapse/MAS fixture
111
- npm test
112
- npm run synapse:down
113
- # For a complete reset, use ./throwaway_synapse/down.sh --wipe.
116
+ npm test # full SDK suite, including fixture-backed functional tests
114
117
  ```
115
118
 
116
- Tests run against a real local Synapse/MAS fixture in Podman, never against a production server.
119
+ The full suite uses the real local Synapse/MAS/Postgres fixture in Podman at `localhost:8008`, never
120
+ a production server. This is the shared fixture for the SDK, CLI, and Web functional/e2e suites;
121
+ start it from this checkout and reuse it for the sibling repositories. Unit tests may use mocks for
122
+ isolated boundaries, but they do not replace the real-stack checks.
123
+
124
+ If setup or tests fail, preserve the fixture and its diagnostics; do not run
125
+ `npm run synapse:down` before the private Harness investigation is complete. The fixture scripts do
126
+ not provide that workflow; follow the [Harness operator workflow](https://github.com/TeleCrypt-io/Harness/blob/main/docs/release.md#required-stage-first-sequence)
127
+ for the canonical ordering and stopping boundary.
128
+
129
+ After a successful run, use `npm run synapse:down` for scoped teardown. Use
130
+ `./throwaway_synapse/down.sh --wipe` only when a complete fixture reset is explicitly required.
117
131
 
118
132
  See [RELEASING.md](./RELEASING.md) for the guarded npm release procedure.
119
133
 
@@ -1,4 +1,4 @@
1
- import { MatrixClient } from "matrix-js-sdk";
1
+ import { MatrixClient, MatrixEvent } from "matrix-js-sdk";
2
2
  import type { CryptoCallbacks } from "matrix-js-sdk/lib/crypto-api/index.js";
3
3
  import type { TokenRefreshFunction } from "matrix-js-sdk/lib/http-api/index.js";
4
4
  import type { RecoveryStatus } from "./core/types.js";
@@ -36,9 +36,7 @@ export interface FileBranch {
36
36
  info: Record<string, unknown>;
37
37
  httpUrl: string;
38
38
  }>;
39
- getFileEvent(): Promise<{
40
- getContent: () => Record<string, unknown>;
41
- }>;
39
+ getFileEvent(): Promise<Pick<MatrixEvent, "getContent" | "getTs" | "isDecryptionFailure">>;
42
40
  getVersionHistory(): Promise<FileBranch[]>;
43
41
  createNewVersion(name: string, encryptedContents: ArrayBuffer | Uint8Array, info: Record<string, unknown>, additionalContent?: Record<string, unknown>): Promise<{
44
42
  event_id: string;
@@ -132,6 +130,12 @@ export interface MatrixRequestOptions {
132
130
  /** Internal Matrix SDK spelling used by `authedRequest`. */
133
131
  abortSignal?: AbortSignal;
134
132
  }
133
+ export interface FileEventMetadata {
134
+ mimetype: string | null;
135
+ size: number | null;
136
+ }
137
+ /** Reads the event-owned metadata shared by details and download operations. */
138
+ export declare function readFileEventMetadata(content: unknown): FileEventMetadata;
135
139
  /**
136
140
  * Serializes all tree mutations for one MatrixClient. A single queue is
137
141
  * intentional: separate per-room locks can deadlock when a parent mutation
@@ -285,12 +289,6 @@ export declare class TeleCryptIOStorage {
285
289
  role: string;
286
290
  membership: string;
287
291
  }[]>;
288
- /**
289
- * Returns the homeserver's complete joined-room inventory. Local sync room
290
- * lists can be truncated by initialSyncLimit and are not an authoritative
291
- * basis for deletion safety.
292
- */
293
- listJoinedRoomIds(options?: MatrixRequestOptions): Promise<string[]>;
294
292
  /** Reads one room membership from the homeserver, not the lagging local sync store. */
295
293
  getRoomMembership(roomId: string, userId?: string | null, options?: MatrixRequestOptions): Promise<string | null>;
296
294
  uploadFile(tree: TreeSpace, name: string, data: ArrayBuffer, mimetype: string, signal?: AbortSignal): Promise<string>;