@flow-industries/id 0.18.0 → 0.19.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.
- package/README.md +19 -0
- package/dist/sdk/client/access-key.d.ts +1 -1
- package/dist/sdk/client/access-key.js +20 -6
- package/dist/sdk/client/create-flow.js +19 -11
- package/dist/sdk/client/dialog-host.js +8 -2
- package/dist/sdk/client/flow-widget.js +2 -1
- package/dist/sdk/client/idb.d.ts +2 -2
- package/dist/sdk/client/idb.js +17 -2
- package/dist/sdk/client/profile-button.js +1 -1
- package/dist/sdk/client/rooms.js +19 -4
- package/dist/sdk/client/session.js +8 -5
- package/dist/sdk/client/signing.js +22 -7
- package/dist/sdk/client/store.js +4 -5
- package/dist/sdk/cookies.d.ts +3 -1
- package/dist/sdk/cookies.js +11 -9
- package/dist/sdk/dialog/remote/Messenger.d.ts +0 -5
- package/dist/sdk/dialog/remote/Messenger.js +26 -14
- package/dist/sdk/driver-error.d.ts +8 -0
- package/dist/sdk/driver-error.js +17 -0
- package/dist/sdk/hex.d.ts +6 -0
- package/dist/sdk/hex.js +6 -0
- package/dist/sdk/id-host.d.ts +1 -1
- package/dist/sdk/id-host.js +4 -5
- package/dist/sdk/json.d.ts +17 -0
- package/dist/sdk/json.js +5 -0
- package/dist/sdk/react/flow-widget.js +2 -2
- package/dist/sdk/react/hooks.d.ts +8 -4
- package/dist/sdk/react/hooks.js +1 -10
- package/dist/sdk/react/profile-button.js +2 -2
- package/dist/sdk/server.js +2 -1
- package/dist/sdk/session-core.d.ts +1 -6
- package/dist/sdk/session-core.js +7 -4
- package/dist/sdk/session-route.d.ts +0 -20
- package/dist/sdk/session-route.js +25 -9
- package/dist/sdk/start/graceful-shutdown.d.ts +8 -0
- package/dist/sdk/start/graceful-shutdown.js +81 -0
- package/dist/sdk/start/index.d.ts +2 -0
- package/dist/sdk/start/index.js +3 -2
- package/dist/sdk/token-expiry.js +3 -1
- package/dist/sdk/types/cosmetics.d.ts +162 -0
- package/dist/sdk/types/cosmetics.js +78 -0
- package/dist/sdk/types/game.d.ts +58 -0
- package/dist/sdk/types/game.js +8 -0
- package/dist/sdk/types/index.d.ts +7 -3
- package/dist/sdk/types/index.js +2 -0
- package/dist/sdk/types/messenger.d.ts +1 -1
- package/dist/sdk/types/protocol.d.ts +6 -5
- package/dist/sdk/types/protocol.js +10 -4
- package/dist/sdk/types/room-events.d.ts +49 -1
- package/dist/sdk/types/rooms.d.ts +53 -3
- package/dist/sdk/types/rooms.js +0 -1
- package/dist/sdk/types/sdk.d.ts +2 -1
- package/dist/sdk/types/server.d.ts +18 -0
- package/dist/sdk/verify.js +1 -0
- package/dist/sdk/wagmi/index.d.ts +7 -3
- package/dist/sdk/wagmi/index.js +19 -32
- package/package.json +11 -8
- package/dist/sdk/client/refresh-store.d.ts +0 -22
- package/dist/sdk/client/refresh-store.js +0 -66
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flow-industries/id",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.19.0",
|
|
4
4
|
"main": "./dist/sdk/client/index.js",
|
|
5
5
|
"module": "./dist/sdk/client/index.js",
|
|
6
6
|
"types": "./dist/sdk/client/index.d.ts",
|
|
@@ -47,10 +47,7 @@
|
|
|
47
47
|
"dist/sdk"
|
|
48
48
|
],
|
|
49
49
|
"scripts": {
|
|
50
|
-
"dev": "
|
|
51
|
-
"dev:dialog": "bunx vite",
|
|
52
|
-
"dev:playground": "bunx vite --config vite.playground.config.ts",
|
|
53
|
-
"dev:landing": "bunx vite --config vite.landing.config.ts",
|
|
50
|
+
"dev": "./dev.sh",
|
|
54
51
|
"build:dialog": "bunx vite build",
|
|
55
52
|
"build:playground": "bunx vite build --config vite.playground.config.ts",
|
|
56
53
|
"build:landing": "bunx vite build --config vite.landing.config.ts",
|
|
@@ -59,12 +56,12 @@
|
|
|
59
56
|
"prepublishOnly": "bun run build:sdk",
|
|
60
57
|
"start": "bun run src/index.ts",
|
|
61
58
|
"worker": "bun run src/worker.ts",
|
|
62
|
-
"email:dev": "email dev --dir src/emails --port 3010",
|
|
63
59
|
"db:generate": "bunx @better-auth/cli generate",
|
|
64
60
|
"db:migrate:gen": "bunx drizzle-kit generate",
|
|
65
61
|
"db:migrate": "bunx drizzle-kit migrate",
|
|
66
62
|
"db:push": "bunx drizzle-kit push",
|
|
67
63
|
"db:studio": "bunx drizzle-kit studio",
|
|
64
|
+
"usernames:refresh": "bun run scripts/generate-reserved-usernames.ts",
|
|
68
65
|
"lint": "biome check",
|
|
69
66
|
"test": "bun test src",
|
|
70
67
|
"format": "biome format --write",
|
|
@@ -91,9 +88,9 @@
|
|
|
91
88
|
},
|
|
92
89
|
"devDependencies": {
|
|
93
90
|
"@better-auth/cli": "^1.4.17",
|
|
94
|
-
"@biomejs/biome": "2.
|
|
91
|
+
"@biomejs/biome": "2.5.8",
|
|
95
92
|
"@electric-sql/pglite": "^0.5.4",
|
|
96
|
-
"@flow-industries/lint": "0.
|
|
93
|
+
"@flow-industries/lint": "0.3.0",
|
|
97
94
|
"@react-email/ui": "^6.6.0",
|
|
98
95
|
"@tailwindcss/vite": "^4.1.18",
|
|
99
96
|
"@tanstack/react-router-devtools": "^1.160.0",
|
|
@@ -104,6 +101,7 @@
|
|
|
104
101
|
"@types/react": "^19.2.13",
|
|
105
102
|
"@types/react-dom": "^19.2.3",
|
|
106
103
|
"@vitejs/plugin-react": "^5.1.3",
|
|
104
|
+
"biome-anti-slop": "0.1.0",
|
|
107
105
|
"drizzle-kit": "^0.31.8",
|
|
108
106
|
"pino-pretty": "^13.1.3",
|
|
109
107
|
"react-email": "^6.6.0",
|
|
@@ -112,6 +110,10 @@
|
|
|
112
110
|
"typescript": "^5",
|
|
113
111
|
"vite": "^7.3.1"
|
|
114
112
|
},
|
|
113
|
+
"trustedDependencies": [
|
|
114
|
+
"esbuild",
|
|
115
|
+
"sharp"
|
|
116
|
+
],
|
|
115
117
|
"dependencies": {
|
|
116
118
|
"@aws-sdk/client-s3": "^3.1073.0",
|
|
117
119
|
"@flow-industries/ui": "^0.19.0",
|
|
@@ -146,6 +148,7 @@
|
|
|
146
148
|
"tempo.ts": "^0.14.2",
|
|
147
149
|
"viem": "2.47.10",
|
|
148
150
|
"wagmi": "^3.4.2",
|
|
151
|
+
"zod": "^4.3.6",
|
|
149
152
|
"zustand": "^5.0.11"
|
|
150
153
|
}
|
|
151
154
|
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { RefreshCookieConfig } from "../types";
|
|
2
|
-
/**
|
|
3
|
-
* First-party persistence for the rotating refresh token. It lives in the
|
|
4
|
-
* consumer app's OWN localStorage (origin-scoped), so it survives reloads and
|
|
5
|
-
* navigations and — unlike the old id.flow.industries cookie — is never a
|
|
6
|
-
* third-party cookie, so iOS ITP can't block it. Keyed by `host` so pointing
|
|
7
|
-
* the SDK at a different Flow ID origin (dev vs prod) doesn't collide.
|
|
8
|
-
*/
|
|
9
|
-
export interface RefreshStore {
|
|
10
|
-
get(): string | null;
|
|
11
|
-
set(token: string): void;
|
|
12
|
-
clear(): void;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* With a cookie config (`createFlow({ cookies: true })`) the token is
|
|
16
|
-
* additionally mirrored into a first-party cookie so the app's own server can
|
|
17
|
-
* refresh the session during SSR. Reads prefer the cookie: the only writer
|
|
18
|
-
* that updates one side without the other is that server (Set-Cookie only),
|
|
19
|
-
* and its value is always a successor of whatever localStorage still holds;
|
|
20
|
-
* every client-side write hits both in the same call.
|
|
21
|
-
*/
|
|
22
|
-
export declare function makeRefreshStore(host: string, cookie?: RefreshCookieConfig): RefreshStore;
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { clearBrowserCookie, REFRESH_COOKIE_MAX_AGE_S, readBrowserCookie, writeBrowserCookie, } from "../cookies";
|
|
2
|
-
/**
|
|
3
|
-
* With a cookie config (`createFlow({ cookies: true })`) the token is
|
|
4
|
-
* additionally mirrored into a first-party cookie so the app's own server can
|
|
5
|
-
* refresh the session during SSR. Reads prefer the cookie: the only writer
|
|
6
|
-
* that updates one side without the other is that server (Set-Cookie only),
|
|
7
|
-
* and its value is always a successor of whatever localStorage still holds;
|
|
8
|
-
* every client-side write hits both in the same call.
|
|
9
|
-
*/
|
|
10
|
-
export function makeRefreshStore(host, cookie) {
|
|
11
|
-
const key = `flow.id.refresh:${host}`;
|
|
12
|
-
const readLocal = () => {
|
|
13
|
-
try {
|
|
14
|
-
return localStorage.getItem(key);
|
|
15
|
-
}
|
|
16
|
-
catch {
|
|
17
|
-
return null;
|
|
18
|
-
}
|
|
19
|
-
};
|
|
20
|
-
const readCookie = () => {
|
|
21
|
-
if (!cookie || typeof document === "undefined")
|
|
22
|
-
return null;
|
|
23
|
-
return readBrowserCookie(document.cookie, cookie.name);
|
|
24
|
-
};
|
|
25
|
-
const store = {
|
|
26
|
-
get() {
|
|
27
|
-
return readCookie() ?? readLocal();
|
|
28
|
-
},
|
|
29
|
-
set(token) {
|
|
30
|
-
// Never persist a missing token: localStorage.setItem coerces undefined
|
|
31
|
-
// to the literal "undefined", which later reads back as a bogus bearer
|
|
32
|
-
// and 401s as refresh_token_invalid. Fail safe by ignoring it instead.
|
|
33
|
-
if (!token)
|
|
34
|
-
return;
|
|
35
|
-
try {
|
|
36
|
-
localStorage.setItem(key, token);
|
|
37
|
-
}
|
|
38
|
-
catch { }
|
|
39
|
-
if (cookie) {
|
|
40
|
-
writeBrowserCookie(cookie.name, token, {
|
|
41
|
-
maxAge: REFRESH_COOKIE_MAX_AGE_S,
|
|
42
|
-
secure: cookie.secure,
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
},
|
|
46
|
-
clear() {
|
|
47
|
-
try {
|
|
48
|
-
localStorage.removeItem(key);
|
|
49
|
-
}
|
|
50
|
-
catch { }
|
|
51
|
-
if (cookie)
|
|
52
|
-
clearBrowserCookie(cookie.name, { secure: cookie.secure });
|
|
53
|
-
},
|
|
54
|
-
};
|
|
55
|
-
// One-time reconcile so exactly one canonical value exists before the first
|
|
56
|
-
// refresh: an SSR rotation updates only the cookie, leaving localStorage one
|
|
57
|
-
// generation behind — presenting that stale token would look like reuse.
|
|
58
|
-
const fromCookie = readCookie();
|
|
59
|
-
if (fromCookie && fromCookie !== readLocal()) {
|
|
60
|
-
try {
|
|
61
|
-
localStorage.setItem(key, fromCookie);
|
|
62
|
-
}
|
|
63
|
-
catch { }
|
|
64
|
-
}
|
|
65
|
-
return store;
|
|
66
|
-
}
|