@zitadel/sdk-core 0.1.0-alpha.0 → 0.1.0-alpha.11
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/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +38 -32
- package/dist/jwt.d.ts.map +1 -1
- package/dist/jwt.js +376 -102
- package/dist/middleware.d.ts +113 -0
- package/dist/middleware.d.ts.map +1 -1
- package/dist/middleware.js +72 -20
- package/dist/tsconfig.lib.tsbuildinfo +1 -1
- package/dist/types.d.ts +99 -196
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +20 -0
- package/package.json +26 -1
package/dist/types.d.ts
CHANGED
|
@@ -1,206 +1,109 @@
|
|
|
1
|
+
import type { ZitadelProject } from "@zitadel/api/config";
|
|
2
|
+
import type { CreateFlow201Step, CreateFlow201StepComplete, CreateFlowBodyPurpose } from "@zitadel/api/generated/model";
|
|
3
|
+
/** Re-exported so consumers can type the `purpose` prop without a deep import. */
|
|
4
|
+
export type { CreateFlowBodyPurpose } from "@zitadel/api/generated/model";
|
|
1
5
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* re-exports
|
|
6
|
-
*
|
|
6
|
+
* The SPA widget contract shared by every SPA SDK (`sdk-react`, `sdk-vue`,
|
|
7
|
+
* `sdk-angular`, `sdk-solid`, `sdk-svelte`, `sdk-qwik`): the widget event detail
|
|
8
|
+
* types plus the config/handler/props types derived from them. Each SPA SDK
|
|
9
|
+
* re-exports these from its own public surface so consumers don't need a direct
|
|
10
|
+
* `sdk-core` dependency. The middleware-layer types (`sdk-next`, `sdk-nuxt`) now
|
|
11
|
+
* live in `@zitadel/sdk-core/middleware`.
|
|
7
12
|
*/
|
|
13
|
+
/** Payload of the `zitadel-flow-step` event. */
|
|
14
|
+
export interface ZitadelFlowStepDetail {
|
|
15
|
+
readonly step: CreateFlow201Step;
|
|
16
|
+
}
|
|
17
|
+
/** Payload of the `zitadel-flow-input` event. */
|
|
18
|
+
export interface ZitadelFlowInputDetail {
|
|
19
|
+
readonly name: string;
|
|
20
|
+
readonly value: string;
|
|
21
|
+
}
|
|
22
|
+
/** Payload of the `zitadel-flow-complete` event. */
|
|
23
|
+
export interface ZitadelFlowCompleteDetail {
|
|
24
|
+
readonly behavior: CreateFlow201StepComplete;
|
|
25
|
+
readonly redirect_uri?: string;
|
|
26
|
+
readonly handoff_token?: string;
|
|
27
|
+
readonly handoff_token_expires_at?: string;
|
|
28
|
+
}
|
|
29
|
+
/** Payload of the `zitadel-flow-error` event. */
|
|
30
|
+
export interface ZitadelFlowErrorDetail {
|
|
31
|
+
readonly message: string;
|
|
32
|
+
}
|
|
33
|
+
/** Payload of the `zitadel-signout` event. */
|
|
34
|
+
export interface ZitadelSignoutDetail {
|
|
35
|
+
readonly name: string;
|
|
36
|
+
readonly email: string;
|
|
37
|
+
}
|
|
38
|
+
/** Events emitted by `<zitadel-login>`, keyed to their detail payload. */
|
|
39
|
+
export interface ZitadelLoginEventMap {
|
|
40
|
+
"zitadel-flow-step": ZitadelFlowStepDetail;
|
|
41
|
+
"zitadel-flow-input": ZitadelFlowInputDetail;
|
|
42
|
+
"zitadel-flow-complete": ZitadelFlowCompleteDetail;
|
|
43
|
+
"zitadel-flow-error": ZitadelFlowErrorDetail;
|
|
44
|
+
}
|
|
45
|
+
/** Events emitted by `<zitadel-logout>`, keyed to their detail payload. */
|
|
46
|
+
export interface ZitadelLogoutEventMap {
|
|
47
|
+
"zitadel-signout": ZitadelSignoutDetail;
|
|
48
|
+
}
|
|
8
49
|
/**
|
|
9
|
-
*
|
|
50
|
+
* Maps each `<zitadel-login>` event to the callback prop the SDKs expose. The
|
|
51
|
+
* `satisfies Record<keyof ZitadelLoginEventMap, …>` is the drift lock: every
|
|
52
|
+
* event needs exactly one handler entry — a missing one, or an extra one left
|
|
53
|
+
* behind for a removed event, fails `tsc`. Everything below derives from this.
|
|
10
54
|
*/
|
|
11
|
-
export
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
/** The user's display name, or `null` if not present in the token. */
|
|
17
|
-
name: string | null;
|
|
18
|
-
/** The raw verified JWT. */
|
|
19
|
-
token: string;
|
|
55
|
+
export declare const ZITADEL_LOGIN_EVENT_HANDLERS: {
|
|
56
|
+
readonly "zitadel-flow-step": "onFlowStep";
|
|
57
|
+
readonly "zitadel-flow-input": "onFlowInput";
|
|
58
|
+
readonly "zitadel-flow-complete": "onFlowComplete";
|
|
59
|
+
readonly "zitadel-flow-error": "onFlowError";
|
|
20
60
|
};
|
|
21
|
-
/**
|
|
22
|
-
export
|
|
23
|
-
|
|
24
|
-
session: NextgenSession;
|
|
61
|
+
/** Maps the `<zitadel-logout>` event to the callback prop the SDKs expose. */
|
|
62
|
+
export declare const ZITADEL_LOGOUT_EVENT_HANDLERS: {
|
|
63
|
+
readonly "zitadel-signout": "onSignout";
|
|
25
64
|
};
|
|
26
|
-
/**
|
|
27
|
-
export
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
65
|
+
/** Runtime list of `<zitadel-login>` event names (drives wiring + drift tests). */
|
|
66
|
+
export declare const ZITADEL_LOGIN_EVENTS: (keyof ZitadelLoginEventMap)[];
|
|
67
|
+
/** Runtime list of `<zitadel-logout>` event names. */
|
|
68
|
+
export declare const ZITADEL_LOGOUT_EVENTS: (keyof ZitadelLogoutEventMap)[];
|
|
69
|
+
/** Configuration props shared by every `ZitadelLogin` wrapper. */
|
|
70
|
+
export interface ZitadelLoginConfig {
|
|
71
|
+
/** The SDK handle from `configureZitadel(...)`. */
|
|
72
|
+
readonly project?: ZitadelProject;
|
|
73
|
+
/** Discrete project id, read when no {@link project} handle is supplied. */
|
|
74
|
+
readonly projectId?: string;
|
|
75
|
+
/** Reverse-proxy path prefix the widget calls. */
|
|
76
|
+
readonly proxyPath?: string;
|
|
77
|
+
/** Flow purpose. @default "login" */
|
|
78
|
+
readonly purpose?: CreateFlowBodyPurpose;
|
|
79
|
+
/** Where to navigate after a completed sign-in. */
|
|
80
|
+
readonly postSignInUrl?: string;
|
|
81
|
+
}
|
|
82
|
+
/** Configuration props shared by every `ZitadelLogout` wrapper. */
|
|
83
|
+
export interface ZitadelLogoutConfig {
|
|
84
|
+
/** The SDK handle from `configureZitadel(...)`. */
|
|
85
|
+
readonly project?: ZitadelProject;
|
|
86
|
+
/** Discrete project id, read when no {@link project} handle is supplied. */
|
|
87
|
+
readonly projectId?: string;
|
|
88
|
+
/** Reverse-proxy path prefix the widget calls. */
|
|
89
|
+
readonly proxyPath?: string;
|
|
90
|
+
/** Where to navigate after sign-out. */
|
|
91
|
+
readonly postSignOutUrl?: string;
|
|
92
|
+
}
|
|
33
93
|
/**
|
|
34
|
-
*
|
|
35
|
-
*
|
|
94
|
+
* Plain-callback handlers for the `<zitadel-login>` events, derived from
|
|
95
|
+
* {@link ZitadelLoginEventMap} and {@link ZITADEL_LOGIN_EVENT_HANDLERS} so the
|
|
96
|
+
* prop set can never drift from the events it forwards.
|
|
36
97
|
*/
|
|
37
|
-
export type
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* URL path prefix that is reverse-proxied to the auth backend.
|
|
45
|
-
* @default "/__nextgen"
|
|
46
|
-
*/
|
|
47
|
-
proxyPath?: string;
|
|
48
|
-
/**
|
|
49
|
-
* Pathnames that require a valid session. Requests to these routes without
|
|
50
|
-
* a valid token are redirected to {@link loginPath}.
|
|
51
|
-
* Entries ending with `*` match any sub-path (e.g. `"/admin*"`).
|
|
52
|
-
* @default []
|
|
53
|
-
*/
|
|
54
|
-
protectedRoutes?: string[];
|
|
55
|
-
/**
|
|
56
|
-
* Pathnames that are completely skipped by the middleware — no JWT
|
|
57
|
-
* verification, no protection check, no header tunnelling.
|
|
58
|
-
* Useful for webhooks, health-check endpoints, or any route where
|
|
59
|
-
* running auth logic is undesirable.
|
|
60
|
-
* Entries ending with `*` match any sub-path (e.g. `"/public*"`).
|
|
61
|
-
* @default []
|
|
62
|
-
*/
|
|
63
|
-
ignoredRoutes?: string[];
|
|
64
|
-
/**
|
|
65
|
-
* Pathname to redirect unauthenticated users to.
|
|
66
|
-
* A `next` query parameter is appended with the originally requested path.
|
|
67
|
-
* @default "/login"
|
|
68
|
-
*/
|
|
69
|
-
loginPath?: string;
|
|
70
|
-
/**
|
|
71
|
-
* Reserved for future use. Local PEM public key for offline JWT verification.
|
|
72
|
-
*/
|
|
73
|
-
jwtKey?: string;
|
|
74
|
-
/**
|
|
75
|
-
* Restrict accepted JWT `alg` header values. Tokens whose algorithm is not
|
|
76
|
-
* in this list are rejected before JWKS is fetched.
|
|
77
|
-
* @default ["RS256", "ES256"]
|
|
78
|
-
*/
|
|
79
|
-
allowedAlgorithms?: string[];
|
|
80
|
-
/**
|
|
81
|
-
* Clock skew tolerance in milliseconds applied to `exp`, `nbf`, and `iat`
|
|
82
|
-
* claim validation.
|
|
83
|
-
* @default 5000
|
|
84
|
-
*/
|
|
85
|
-
clockSkewMs?: number;
|
|
86
|
-
/**
|
|
87
|
-
* Expected value(s) of the `aud` claim. When omitted, audience is not
|
|
88
|
-
* validated. Pass a single string or an array when a token may carry
|
|
89
|
-
* multiple audiences.
|
|
90
|
-
*/
|
|
91
|
-
audience?: string | string[];
|
|
92
|
-
/**
|
|
93
|
-
* Accepted values for the JWT header `typ` claim (case-insensitive).
|
|
94
|
-
* Tokens whose `typ` is not in this list are rejected.
|
|
95
|
-
* Set to `[]` to disable token-type checking entirely.
|
|
96
|
-
* @default ["JWT", "at+JWT"]
|
|
97
|
-
*/
|
|
98
|
-
allowedTokenTypes?: string[];
|
|
99
|
-
/**
|
|
100
|
-
* Timeout in milliseconds for JWKS endpoint requests.
|
|
101
|
-
* Requests that do not complete within this window are aborted and the
|
|
102
|
-
* token is rejected, treating the request as unauthenticated.
|
|
103
|
-
* @default 5000
|
|
104
|
-
*/
|
|
105
|
-
jwksTimeoutMs?: number;
|
|
106
|
-
/**
|
|
107
|
-
* Timeout in milliseconds for upstream proxy requests.
|
|
108
|
-
* Requests that do not complete within this window are aborted with a
|
|
109
|
-
* network error. Defaults to 5 000 ms.
|
|
110
|
-
* @default 5000
|
|
111
|
-
*/
|
|
112
|
-
proxyTimeoutMs?: number;
|
|
113
|
-
/**
|
|
114
|
-
* Timeout in milliseconds for opaque (non-JWT) session token validation
|
|
115
|
-
* via the backend's `GET /sessions/me` endpoint. Tokens that cannot be
|
|
116
|
-
* validated within this window are treated as invalid.
|
|
117
|
-
* @default 5000
|
|
118
|
-
*/
|
|
119
|
-
opaqueTokenTimeoutMs?: number;
|
|
120
|
-
/**
|
|
121
|
-
* Optional hook called when a `POST /sessions/exchange` response is
|
|
122
|
-
* proxied back to the browser. Receives the upstream `Response` after
|
|
123
|
-
* hop-by-hop stripping and cookie upgrading. Return a modified
|
|
124
|
-
* `Response` to add custom headers, extra `Set-Cookie` values, or
|
|
125
|
-
* transform the body.
|
|
126
|
-
*
|
|
127
|
-
* The callback runs on the server — it has access to the full response
|
|
128
|
-
* including `Set-Cookie` headers that are `HttpOnly` and invisible to
|
|
129
|
-
* client-side JavaScript. It fires **after** the upstream has processed
|
|
130
|
-
* the exchange; it cannot prevent the exchange itself (return a 403
|
|
131
|
-
* `Response` to block the browser from receiving it).
|
|
132
|
-
*
|
|
133
|
-
* **Capabilities:**
|
|
134
|
-
*
|
|
135
|
-
* - **Add or modify cookies** — append `Set-Cookie` headers for
|
|
136
|
-
* user-preferences, analytics IDs, or any server-side state.
|
|
137
|
-
* - **Make additional fetch calls** — enrich the session by calling
|
|
138
|
-
* your own backend, a profile service, or any external API. The
|
|
139
|
-
* response body can be read with `response.json()` to extract
|
|
140
|
-
* session details like `user_id`.
|
|
141
|
-
* - **Map or transform response properties** — reshape the JSON body
|
|
142
|
-
* before it reaches the browser (e.g. strip internal fields, add
|
|
143
|
-
* computed properties).
|
|
144
|
-
* - **Logging and auditing** — clone the response, read its body for
|
|
145
|
-
* audit trails, and return the original unchanged.
|
|
146
|
-
*
|
|
147
|
-
* @example Add a cookie
|
|
148
|
-
* ```ts
|
|
149
|
-
* onExchangeResponse: async (response) => {
|
|
150
|
-
* const headers = new Headers(response.headers);
|
|
151
|
-
* headers.append("Set-Cookie", "theme=dark; Path=/; SameSite=Lax");
|
|
152
|
-
* return new Response(response.body, {
|
|
153
|
-
* status: response.status,
|
|
154
|
-
* headers,
|
|
155
|
-
* });
|
|
156
|
-
* },
|
|
157
|
-
* ```
|
|
158
|
-
*
|
|
159
|
-
* @example Fetch additional data and set a cookie from it
|
|
160
|
-
* ```ts
|
|
161
|
-
* onExchangeResponse: async (response) => {
|
|
162
|
-
* const body = await response.json();
|
|
163
|
-
* const profile = await fetch(
|
|
164
|
-
* `https://api.example.com/users/${body.session.user_id}`,
|
|
165
|
-
* );
|
|
166
|
-
* const { locale } = await profile.json();
|
|
167
|
-
* const headers = new Headers(response.headers);
|
|
168
|
-
* headers.append("Set-Cookie", `locale=${locale}; Path=/; SameSite=Lax`);
|
|
169
|
-
* return new Response(JSON.stringify(body), {
|
|
170
|
-
* status: response.status,
|
|
171
|
-
* headers,
|
|
172
|
-
* });
|
|
173
|
-
* },
|
|
174
|
-
* ```
|
|
175
|
-
*
|
|
176
|
-
* @example Log the exchange for auditing (pass-through)
|
|
177
|
-
* ```ts
|
|
178
|
-
* onExchangeResponse: async (response) => {
|
|
179
|
-
* const cloned = response.clone();
|
|
180
|
-
* const body = await cloned.json();
|
|
181
|
-
* await auditLog.record("session_exchange", body.session.session_id);
|
|
182
|
-
* return response;
|
|
183
|
-
* },
|
|
184
|
-
* ```
|
|
185
|
-
*
|
|
186
|
-
* @example Modify existing cookies (e.g. tighten the session cookie path)
|
|
187
|
-
* ```ts
|
|
188
|
-
* onExchangeResponse: async (response) => {
|
|
189
|
-
* const headers = new Headers();
|
|
190
|
-
* for (const [key, value] of response.headers.entries()) {
|
|
191
|
-
* if (key.toLowerCase() !== "set-cookie") headers.set(key, value);
|
|
192
|
-
* }
|
|
193
|
-
* for (const cookie of response.headers.getSetCookie()) {
|
|
194
|
-
* if (cookie.startsWith("__nextgen_session=")) {
|
|
195
|
-
* headers.append("set-cookie", cookie.replace("Path=/", "Path=/app"));
|
|
196
|
-
* } else {
|
|
197
|
-
* headers.append("set-cookie", cookie);
|
|
198
|
-
* }
|
|
199
|
-
* }
|
|
200
|
-
* return new Response(response.body, { status: response.status, headers });
|
|
201
|
-
* },
|
|
202
|
-
* ```
|
|
203
|
-
*/
|
|
204
|
-
onExchangeResponse?: (response: Response) => Response | Promise<Response>;
|
|
98
|
+
export type ZitadelLoginHandlers = {
|
|
99
|
+
readonly [E in keyof ZitadelLoginEventMap as (typeof ZITADEL_LOGIN_EVENT_HANDLERS)[E]]?: (detail: ZitadelLoginEventMap[E]) => void;
|
|
100
|
+
};
|
|
101
|
+
/** Plain-callback handler for the `<zitadel-logout>` event (derived, as above). */
|
|
102
|
+
export type ZitadelLogoutHandlers = {
|
|
103
|
+
readonly [E in keyof ZitadelLogoutEventMap as (typeof ZITADEL_LOGOUT_EVENT_HANDLERS)[E]]?: (detail: ZitadelLogoutEventMap[E]) => void;
|
|
205
104
|
};
|
|
105
|
+
/** Full prop set for a `ZitadelLogin` wrapper (config + plain-callback handlers). */
|
|
106
|
+
export type ZitadelLoginProps = ZitadelLoginConfig & ZitadelLoginHandlers;
|
|
107
|
+
/** Full prop set for a `ZitadelLogout` wrapper (config + plain-callback handlers). */
|
|
108
|
+
export type ZitadelLogoutProps = ZitadelLogoutConfig & ZitadelLogoutHandlers;
|
|
206
109
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAA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C,IAAI,MAAM,qBAAqB,IAAI,CAAC,OAAO,6BAA6B,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CACzF,MAAM,EAAE,qBAAqB,CAAC,CAAC,CAAC,KAC7B,IAAI;CACV,CAAC;AAEF,qFAAqF;AACrF,MAAM,MAAM,iBAAiB,GAAG,kBAAkB,GAAG,oBAAoB,CAAC;AAE1E,sFAAsF;AACtF,MAAM,MAAM,kBAAkB,GAAG,mBAAmB,GAAG,qBAAqB,CAAC"}
|
package/dist/types.js
CHANGED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Maps each `<zitadel-login>` event to the callback prop the SDKs expose. The
|
|
3
|
+
* `satisfies Record<keyof ZitadelLoginEventMap, …>` is the drift lock: every
|
|
4
|
+
* event needs exactly one handler entry — a missing one, or an extra one left
|
|
5
|
+
* behind for a removed event, fails `tsc`. Everything below derives from this.
|
|
6
|
+
*/
|
|
7
|
+
export const ZITADEL_LOGIN_EVENT_HANDLERS = {
|
|
8
|
+
"zitadel-flow-step": "onFlowStep",
|
|
9
|
+
"zitadel-flow-input": "onFlowInput",
|
|
10
|
+
"zitadel-flow-complete": "onFlowComplete",
|
|
11
|
+
"zitadel-flow-error": "onFlowError",
|
|
12
|
+
};
|
|
13
|
+
/** Maps the `<zitadel-logout>` event to the callback prop the SDKs expose. */
|
|
14
|
+
export const ZITADEL_LOGOUT_EVENT_HANDLERS = {
|
|
15
|
+
"zitadel-signout": "onSignout",
|
|
16
|
+
};
|
|
17
|
+
/** Runtime list of `<zitadel-login>` event names (drives wiring + drift tests). */
|
|
18
|
+
export const ZITADEL_LOGIN_EVENTS = Object.keys(ZITADEL_LOGIN_EVENT_HANDLERS);
|
|
19
|
+
/** Runtime list of `<zitadel-logout>` event names. */
|
|
20
|
+
export const ZITADEL_LOGOUT_EVENTS = Object.keys(ZITADEL_LOGOUT_EVENT_HANDLERS);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zitadel/sdk-core",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.11",
|
|
4
4
|
"description": "Core types and shared utilities for Zitadel SDKs",
|
|
5
5
|
"homepage": "https://github.com/zitadel/nextgen/tree/main/packages/sdk-core#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -40,5 +40,30 @@
|
|
|
40
40
|
},
|
|
41
41
|
"publishConfig": {
|
|
42
42
|
"access": "public"
|
|
43
|
+
},
|
|
44
|
+
"dependencies": {
|
|
45
|
+
"@zitadel/api": "0.1.0-alpha.11"
|
|
46
|
+
},
|
|
47
|
+
"devDependencies": {
|
|
48
|
+
"@eslint/js": "^9.0.0",
|
|
49
|
+
"@eslint/json": "^0.11.0",
|
|
50
|
+
"@eslint/markdown": "^6.0.0",
|
|
51
|
+
"eslint": "^9.0.0",
|
|
52
|
+
"eslint-config-prettier": "^10.0.0",
|
|
53
|
+
"eslint-import-resolver-typescript": "^3.7.0",
|
|
54
|
+
"eslint-plugin-import": "^2.31.0",
|
|
55
|
+
"eslint-plugin-perfectionist": "^4.0.0",
|
|
56
|
+
"eslint-plugin-prettier": "^5.0.0",
|
|
57
|
+
"prettier": "^3.0.0",
|
|
58
|
+
"typescript": "^6.0.3",
|
|
59
|
+
"typescript-eslint": "^8.0.0",
|
|
60
|
+
"vite": "^7.3.5",
|
|
61
|
+
"vitest": "^3.0.0"
|
|
62
|
+
},
|
|
63
|
+
"scripts": {
|
|
64
|
+
"build": "tsc -p tsconfig.lib.json",
|
|
65
|
+
"typecheck": "tsc --noEmit -p tsconfig.json",
|
|
66
|
+
"test": "vitest run",
|
|
67
|
+
"lint": "eslint ."
|
|
43
68
|
}
|
|
44
69
|
}
|