@telecrypt-io/storage 0.5.28 → 0.5.30

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
@@ -39,8 +39,8 @@ const vault = await core.createVault(storage, "Photos");
39
39
  await core.uploadFile(storage, vault.id, "cat.jpg", bytes, "image/jpeg");
40
40
  ```
41
41
 
42
- The recommended constructors configure the Matrix client with the SDK's bounded, manual-redirect
43
- 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
44
44
  an advanced escape hatch: it does not rewrite matrix-js-sdk internals. Callers using it must build
45
45
  the client through matrix-js-sdk's supported `createClient` options (`fetchFn` and
46
46
  `localTimeoutMs`) and remain responsible for the safety of other Matrix SDK requests. SDK methods
@@ -55,7 +55,7 @@ provides no server-side room-creation idempotency key.
55
55
 
56
56
  The SDK owns the browser authorization-code PKCE context in `sessionStorage` and provides device-code,
57
57
  discovery, dynamic registration, identity confirmation, and refresh helpers. OAuth metadata, token
58
- 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
59
59
  they are returned. Network-bound helpers accept `AbortSignal` where cancellation is meaningful; token
60
60
  refresh uses a public client and persists the resulting token pair through the caller's callback.
61
61
 
@@ -111,13 +111,23 @@ Synapse without that extension cannot provide the SDK deletion contract.
111
111
 
112
112
  ```bash
113
113
  npm ci --ignore-scripts --no-fund --no-audit
114
+ npm run test:unit # unit-only checks; does not start Podman
114
115
  npm run synapse:up # disposable local Synapse/MAS fixture
115
- npm test
116
- npm run synapse:down
117
- # For a complete reset, use ./throwaway_synapse/down.sh --wipe.
116
+ npm test # full SDK suite, including fixture-backed functional tests
118
117
  ```
119
118
 
120
- 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.
121
131
 
122
132
  See [RELEASING.md](./RELEASING.md) for the guarded npm release procedure.
123
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