@solarpunkltd/swarm-id 0.8.1 → 0.9.0

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.
@@ -1,13 +1,16 @@
1
1
  /**
2
- * Whether the proxy iframe can read the trusted domain's first-party store —
2
+ * Whether a Swarm ID frame can read the trusted domain's first-party store,
3
3
  * asked BEFORE authentication, because it decides which transport the auth
4
- * popup has to take (#613).
4
+ * popup has to take (#613). Both frames a site embeds read it: the session
5
+ * frame, to tell the client whether `connect()` can work, and the button
6
+ * frame, to decide whether to leave the popup's challenge in storage.
5
7
  *
6
8
  * The mirror image of the probe the connect popup already runs: there, the
7
- * iframe writes a challenge and the popup checks whether it can read it back
8
- * first-party (`ui/src/lib/stores/connect.svelte.ts`). That answer arrives far
9
- * too late to choose a transport, so the same question is asked the other way
10
- * round — the first-party app leaves a marker, and the iframe reads it back.
9
+ * button frame writes a challenge and the popup checks whether it can read it
10
+ * back first-party (`ui/src/lib/stores/connect.svelte.ts`). That answer
11
+ * arrives far too late to choose a transport, so the same question is asked
12
+ * the other way round: the first-party app leaves a marker, and the frames
13
+ * read it back.
11
14
  *
12
15
  * Deliberately NOT any of these:
13
16
  *
@@ -24,7 +27,14 @@
24
27
  * The marker only ever answers YES with certainty. Absent means "not proven
25
28
  * shared" — a partitioned iframe, or a browser that has never had the SwarmID
26
29
  * site open at the top level — and the caller treats that as partitioned,
27
- * which is the safe direction: the delegated transport works in both modes.
30
+ * which is the safe direction: the handover through the Swarm ID button works
31
+ * in both modes.
32
+ *
33
+ * The marker is sealed, because the keys in that store are: a frame that sees
34
+ * the store but not the IndexedDB key that opens it sees no session in it.
35
+ * Playwright's WebKit gives a cross-site frame exactly that, one
36
+ * `localStorage` and its own IndexedDB (measured 2026-10-15), and a plain
37
+ * marker had it wait for a storage write it could never read.
28
38
  */
29
39
  export declare const STORAGE_SHARED_KEY = "swarm-id-first-party";
30
40
  /**
@@ -35,6 +45,6 @@ export declare const STORAGE_SHARED_KEY = "swarm-id-first-party";
35
45
  * bucket and make the iframe report itself shared — the one wrong answer this
36
46
  * must never give.
37
47
  */
38
- export declare function markFirstPartyStorage(): void;
39
- /** Whether this context can see the marker a first-party page left. */
40
- export declare function isStorageShared(): boolean;
48
+ export declare function markFirstPartyStorage(): Promise<void>;
49
+ /** Whether this context can see, and open, the marker a first-party page left. */
50
+ export declare function isStorageShared(): Promise<boolean>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solarpunkltd/swarm-id",
3
- "version": "0.8.1",
3
+ "version": "0.9.0",
4
4
  "type": "module",
5
5
  "description": "Swarm ID library for authentication and Bee API operations",
6
6
  "main": "dist/swarm-id.esm.js",
@@ -19,6 +19,25 @@
19
19
  "files": [
20
20
  "dist"
21
21
  ],
22
+ "scripts": {
23
+ "build": "rollup -c",
24
+ "build:watch": "rollup -c -w",
25
+ "clean": "rm -rf dist",
26
+ "test": "vitest run",
27
+ "test:watch": "vitest",
28
+ "test:integration": "vitest run --config vitest.integration.config.ts",
29
+ "test:live": "vitest run --config vitest.live.config.ts",
30
+ "test:ui": "vitest --ui",
31
+ "test:coverage": "vitest run --coverage",
32
+ "lint": "eslint .",
33
+ "lint:fix": "eslint . --fix",
34
+ "format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
35
+ "format:check": "prettier --check \"src/**/*.ts\" \"test/**/*.ts\"",
36
+ "typecheck": "tsc --noEmit -p tsconfig.check.json",
37
+ "check:all": "pnpm format:check && pnpm lint && pnpm typecheck && pnpm test",
38
+ "prepack": "npm run clean && npm run build",
39
+ "check:pack": "node dev/check-pack.js"
40
+ },
22
41
  "keywords": [
23
42
  "swarm",
24
43
  "identity",
@@ -52,6 +71,8 @@
52
71
  "@rollup/plugin-replace": "6.0.3",
53
72
  "@rollup/plugin-terser": "0.4.4",
54
73
  "@rollup/plugin-typescript": "12.3.0",
74
+ "@swarm-id/eslint-rules": "workspace:*",
75
+ "@swarm-id/signaling": "workspace:*",
55
76
  "@types/node": "24.10.1",
56
77
  "@typescript-eslint/eslint-plugin": "8.69.0",
57
78
  "@typescript-eslint/parser": "8.69.0",
@@ -62,9 +83,7 @@
62
83
  "rollup": "4.53.3",
63
84
  "tslib": "2.8.1",
64
85
  "typescript": "5.8.3",
65
- "vitest": "4.0.14",
66
- "@swarm-id/signaling": "0.1.0",
67
- "@swarm-id/eslint-rules": "0.0.0"
86
+ "vitest": "4.0.14"
68
87
  },
69
88
  "engines": {
70
89
  "node": ">=22",
@@ -72,23 +91,5 @@
72
91
  },
73
92
  "publishConfig": {
74
93
  "access": "public"
75
- },
76
- "scripts": {
77
- "build": "rollup -c",
78
- "build:watch": "rollup -c -w",
79
- "clean": "rm -rf dist",
80
- "test": "vitest run",
81
- "test:watch": "vitest",
82
- "test:integration": "vitest run --config vitest.integration.config.ts",
83
- "test:live": "vitest run --config vitest.live.config.ts",
84
- "test:ui": "vitest --ui",
85
- "test:coverage": "vitest run --coverage",
86
- "lint": "eslint .",
87
- "lint:fix": "eslint . --fix",
88
- "format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
89
- "format:check": "prettier --check \"src/**/*.ts\" \"test/**/*.ts\"",
90
- "typecheck": "tsc --noEmit -p tsconfig.check.json",
91
- "check:all": "pnpm format:check && pnpm lint && pnpm typecheck && pnpm test",
92
- "check:pack": "node dev/check-pack.js"
93
94
  }
94
- }
95
+ }