@telecrypt-io/storage 0.2.1 → 0.2.3
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 +3 -3
- package/dist/core/oidc.d.ts +4 -5
- package/dist/core/oidc.js +4 -5
- package/dist/core/operations.js +21 -1
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -8,14 +8,14 @@ Files are encrypted on the client before upload. The server stores only opaque c
|
|
|
8
8
|
never holds the decryption keys. Shared folders let multiple people add and read files, and a
|
|
9
9
|
Recovery Key restores your files on a new device — even if you lose the original.
|
|
10
10
|
|
|
11
|
-
**Status:** library source only. `@telecrypt-io/storage@0.2.
|
|
12
|
-
published from this repository's protected `v0.2.
|
|
11
|
+
**Status:** library source only. `@telecrypt-io/storage@0.2.3` is the current public release,
|
|
12
|
+
published from this repository's protected `v0.2.3` tag with NPM Trusted Publishing/OIDC
|
|
13
13
|
provenance. The older `0.1.3` release is the immutable legacy combined library-and-CLI package.
|
|
14
14
|
|
|
15
15
|
## Install
|
|
16
16
|
|
|
17
17
|
```bash
|
|
18
|
-
npm install @telecrypt-io/storage
|
|
18
|
+
npm install @telecrypt-io/storage@0.2.3
|
|
19
19
|
```
|
|
20
20
|
|
|
21
21
|
This gives you the `TeleCryptIOStorage` library and its browser-safe `core` API.
|
package/dist/core/oidc.d.ts
CHANGED
|
@@ -28,11 +28,10 @@ export interface OidcTokenSet {
|
|
|
28
28
|
*
|
|
29
29
|
* NODE CALLERS: this internally constructs oidc-client-ts state that
|
|
30
30
|
* requires `window.sessionStorage`/`window.localStorage` to exist (a real
|
|
31
|
-
* browser has both natively).
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
* `
|
|
35
|
-
* it's safe here specifically (called once, before any crypto/WASM exists).
|
|
31
|
+
* browser has both natively). A Node adapter may install those only around
|
|
32
|
+
* this call: a permanent global `window` breaks rust-crypto WASM's own
|
|
33
|
+
* environment detection. The functional-test-only adapter is kept in
|
|
34
|
+
* `test/harness/oidcWindowShim.ts`, rather than in the production SDK.
|
|
36
35
|
*/
|
|
37
36
|
export declare function discoverOidcIssuer(homeserverBaseUrl: string): Promise<OidcClientConfig>;
|
|
38
37
|
/**
|
package/dist/core/oidc.js
CHANGED
|
@@ -19,11 +19,10 @@ import { CliError } from "./errors.js";
|
|
|
19
19
|
*
|
|
20
20
|
* NODE CALLERS: this internally constructs oidc-client-ts state that
|
|
21
21
|
* requires `window.sessionStorage`/`window.localStorage` to exist (a real
|
|
22
|
-
* browser has both natively).
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
* `
|
|
26
|
-
* it's safe here specifically (called once, before any crypto/WASM exists).
|
|
22
|
+
* browser has both natively). A Node adapter may install those only around
|
|
23
|
+
* this call: a permanent global `window` breaks rust-crypto WASM's own
|
|
24
|
+
* environment detection. The functional-test-only adapter is kept in
|
|
25
|
+
* `test/harness/oidcWindowShim.ts`, rather than in the production SDK.
|
|
27
26
|
*/
|
|
28
27
|
export async function discoverOidcIssuer(homeserverBaseUrl) {
|
|
29
28
|
const client = createClient({ baseUrl: homeserverBaseUrl });
|
package/dist/core/operations.js
CHANGED
|
@@ -100,8 +100,15 @@ export async function listPendingInvites(storage) {
|
|
|
100
100
|
}
|
|
101
101
|
/** Decline a folder invite (same as leaving before join). */
|
|
102
102
|
export async function declineInvite(storage, folderId) {
|
|
103
|
+
const client = storage.getClient();
|
|
103
104
|
try {
|
|
104
|
-
await
|
|
105
|
+
await client.leave(folderId);
|
|
106
|
+
// The server only allows forgetting a room once this account's
|
|
107
|
+
// membership is `leave`; forgetting removes the room from the local
|
|
108
|
+
// store immediately, so a declined invite stops showing up in
|
|
109
|
+
// listFolders/listPendingInvites without waiting for the leave event to
|
|
110
|
+
// round-trip through the background sync loop.
|
|
111
|
+
await client.forget(folderId);
|
|
105
112
|
}
|
|
106
113
|
catch (err) {
|
|
107
114
|
throw new CliError(`decline failed: ${err.message}`);
|
|
@@ -167,7 +174,20 @@ export async function renameFolder(storage, folderId, name) {
|
|
|
167
174
|
}
|
|
168
175
|
export async function deleteFolder(storage, folderId) {
|
|
169
176
|
const tree = await resolveTree(storage, folderId);
|
|
177
|
+
// `tree.delete()` kicks members and leaves this room AND every
|
|
178
|
+
// subdirectory room, but never forgets any of them, so they all linger in
|
|
179
|
+
// the local store and listFolders keeps returning the deleted folder until
|
|
180
|
+
// the leave events round-trip through the background sync loop (30-60s
|
|
181
|
+
// under full-suite load). Forgetting removes each room from the local
|
|
182
|
+
// store immediately; the server only accepts a forget once membership is
|
|
183
|
+
// `leave`, which `tree.delete()` has just completed for the whole tree.
|
|
184
|
+
const subdirectoryIds = tree.getDirectories().map((d) => d.id);
|
|
170
185
|
await tree.delete();
|
|
186
|
+
const client = storage.getClient();
|
|
187
|
+
await client.forget(folderId);
|
|
188
|
+
for (const subId of subdirectoryIds) {
|
|
189
|
+
await client.forget(subId);
|
|
190
|
+
}
|
|
171
191
|
return { id: folderId, deleted: true };
|
|
172
192
|
}
|
|
173
193
|
export async function renameFile(storage, folderId, fileId, name) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@telecrypt-io/storage",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"license": "BUSL-1.1",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
"build": "tsc",
|
|
29
29
|
"lint": "eslint src test --ext .ts",
|
|
30
30
|
"test": "vitest run",
|
|
31
|
+
"test:unit": "vitest run --config vitest.unit.config.ts",
|
|
31
32
|
"test:watch": "vitest",
|
|
32
33
|
"synapse:up": "./throwaway_synapse/up.sh",
|
|
33
34
|
"synapse:fresh": "./throwaway_synapse/up.sh --fresh",
|