@crowdedkingdoms/crowdyjs 7.1.0 → 8.0.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/MIGRATION.md +46 -0
- package/README.md +27 -20
- package/dist/domains/auth.d.ts +77 -140
- package/dist/domains/auth.d.ts.map +1 -1
- package/dist/domains/auth.js +81 -178
- package/dist/domains/portal.d.ts +43 -1
- package/dist/domains/portal.d.ts.map +1 -1
- package/dist/domains/portal.js +59 -1
- package/dist/generated/graphql.d.ts +178 -147
- package/dist/generated/graphql.d.ts.map +1 -1
- package/dist/generated/graphql.js +0 -7
- package/dist/index.d.ts +13 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -8
- package/package.json +1 -1
package/MIGRATION.md
CHANGED
|
@@ -1,3 +1,49 @@
|
|
|
1
|
+
# CrowdyJS v8 — Passwordless & federated sign-in (BREAKING)
|
|
2
|
+
|
|
3
|
+
**Crowded Kingdoms is passwordless.** Email + password login is removed. Update
|
|
4
|
+
your sign-in flow to one of:
|
|
5
|
+
|
|
6
|
+
- **Magic link (email):**
|
|
7
|
+
```ts
|
|
8
|
+
await client.auth.requestLoginLink({ email, redirectUri }); // emails a one-time link
|
|
9
|
+
// on the landing page (token from the URL):
|
|
10
|
+
const { user } = await client.auth.completeLoginLink(tokenFromUrl);
|
|
11
|
+
```
|
|
12
|
+
- **Social (federated / OIDC):**
|
|
13
|
+
```ts
|
|
14
|
+
const providers = await client.auth.availableLoginProviders(); // e.g. ['google']
|
|
15
|
+
const { authorizeUrl, state } = await client.auth.socialLoginStart('google', callbackUrl);
|
|
16
|
+
location.assign(authorizeUrl);
|
|
17
|
+
// on the callback page:
|
|
18
|
+
await client.auth.socialLoginComplete({ provider: 'google', code, state });
|
|
19
|
+
```
|
|
20
|
+
- **Dev bypass (development only):** `await client.auth.devLogin(email)` — works only
|
|
21
|
+
when the server has `DEV_AUTH_BYPASS` enabled.
|
|
22
|
+
|
|
23
|
+
**Removed:** `client.auth.login`, `register`, `confirmEmail`, `requestPasswordReset`,
|
|
24
|
+
`resetPassword`, `resendConfirmationEmail`, `changePassword` (and the
|
|
25
|
+
`LoginUserInput` / `RegisterUserInput` / `ResetPasswordInput` types).
|
|
26
|
+
|
|
27
|
+
**New:** `requestLoginLink`, `completeLoginLink`, `socialLoginStart`,
|
|
28
|
+
`socialLoginComplete`, `devLogin`, `availableLoginProviders`, `myIdentities`,
|
|
29
|
+
`linkIdentity`, `unlinkIdentity`. Each sign-in still returns an identity session
|
|
30
|
+
token, stored on the shared session automatically (account is created on first
|
|
31
|
+
sign-in).
|
|
32
|
+
|
|
33
|
+
**Portal consent + connected apps (new on `client.portal`):** `getConsent(appId)`,
|
|
34
|
+
`authorizeApp(appId)`, `revokeAppAuthorization(appId)`, `myAuthorizedApps()`,
|
|
35
|
+
`setAppClientSettings({ appId, redirectUris, clientType, launchUrl })`.
|
|
36
|
+
`handleAuthorizeRequest` now enforces consent: untrusted apps throw
|
|
37
|
+
`PortalConsentRequiredError` unless you pass `{ grantConsent: true }` (call after
|
|
38
|
+
the user approves on the consent screen). Trusted/first-party apps (the Overworld,
|
|
39
|
+
app 1) skip consent. Browser portal entry now requires the destination app's
|
|
40
|
+
`redirect_uris` to be registered (`setAppClientSettings`).
|
|
41
|
+
|
|
42
|
+
Everything else from v7 (the two-client pattern, `client.portal` minting/PKCE,
|
|
43
|
+
app-scoped tokens) is unchanged.
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
1
47
|
# CrowdyJS v7 — Overworld portals & app-scoped tokens (BREAKING)
|
|
2
48
|
|
|
3
49
|
v7 splits the single app-agnostic game token into two credentials and makes
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# CrowdyJS
|
|
2
2
|
|
|
3
|
-
The official browser-first TypeScript SDK for **Crowded Kingdoms**. CrowdyJS gives you
|
|
3
|
+
The official browser-first TypeScript SDK for **Crowded Kingdoms**. CrowdyJS gives you typed clients for auth, the world/replication GraphQL API, and the UDP proxy subscription stream. As of **v7** it follows the Overworld two-token model: an identity **session token** for the Management API, and short-lived **app-scoped tokens** for gameplay via `client.portal` (see [Overworld portals & app-scoped tokens (v7)](#overworld-portals--app-scoped-tokens-v7)).
|
|
4
4
|
|
|
5
5
|
## Install
|
|
6
6
|
|
|
@@ -41,12 +41,15 @@ if (!client.session.getToken()) {
|
|
|
41
41
|
await client.auth.login({ email: 'player@example.com', password: 'secret' });
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
//
|
|
45
|
-
|
|
46
|
-
|
|
44
|
+
// `client.auth.login()` returns an identity SESSION token (Management API only).
|
|
45
|
+
// Identity reads run on it:
|
|
46
|
+
const me = await client.users.me();
|
|
47
|
+
console.log(me.email);
|
|
47
48
|
```
|
|
48
49
|
|
|
49
|
-
|
|
50
|
+
**Gameplay needs an app-scoped token, not the login token.** Mint one per app and
|
|
51
|
+
drive the Game API world/UDP surface (including `gameClientBootstrap`) from a
|
|
52
|
+
per-game client — see [Overworld portals & app-scoped tokens (v7)](#overworld-portals--app-scoped-tokens-v7).
|
|
50
53
|
|
|
51
54
|
If `managementUrl` is omitted, the SDK falls back to `httpUrl` for backwards-compat with the single-endpoint deployment.
|
|
52
55
|
|
|
@@ -90,16 +93,17 @@ If `managementUrl` is omitted, the SDK falls back to `httpUrl` for backwards-com
|
|
|
90
93
|
|---|---|
|
|
91
94
|
| `client.operator` | Control plane: cross-org environments, change orders, secrets, release management, audit. |
|
|
92
95
|
|
|
93
|
-
Auth, user reads, and the studio-admin / operator surfaces target `managementUrl
|
|
96
|
+
Auth, user reads, and the studio-admin / operator surfaces target `managementUrl` and use the **identity session token**; the game-client world/UDP surfaces target `httpUrl` / `wsUrl` and require an **app-scoped token** for that app. Use one identity client plus a per-game client (see [Overworld portals & app-scoped tokens (v7)](#overworld-portals--app-scoped-tokens-v7)); each client's `AuthState` carries its token to its own endpoints, so HTTP and WebSocket auth never drift within a client.
|
|
94
97
|
|
|
95
98
|
## Game-loop lifecycle
|
|
96
99
|
|
|
97
|
-
1. Authenticate with `client.auth.login()` or
|
|
98
|
-
2.
|
|
99
|
-
3.
|
|
100
|
-
4.
|
|
101
|
-
5.
|
|
102
|
-
6. Call `
|
|
100
|
+
1. Authenticate on the identity client with `client.auth.login()` (or `client.session.restore()`) — this yields the **session token**.
|
|
101
|
+
2. Mint an **app-scoped token** for the app (`identity.portal.mintAppToken(appId)`, or the PKCE portal flow across origins) and build a per-game client holding it (`game.setToken(token)`). The gameplay steps below run on that **game** client.
|
|
102
|
+
3. Subscribe to UDP proxy notifications with `game.udp.subscribe(handlers, appId)` — `appId` is **required** (the SDK opens the realtime socket on demand and scopes it to that app).
|
|
103
|
+
4. Join a chunk by sending an initial actor update.
|
|
104
|
+
5. Send actor, voxel, text, audio, and client-event updates through `game.udp` or the higher-level `game.world(appId)` helpers.
|
|
105
|
+
6. Call `game.udp.disconnect()` when leaving the world; `game.portal.refresh()` before the token expires to keep playing.
|
|
106
|
+
7. Call `client.close()` (and `game.close()`) when disposing the SDK instances.
|
|
103
107
|
|
|
104
108
|
## Per-app routing
|
|
105
109
|
|
|
@@ -118,18 +122,21 @@ query AppForRouting($appId: BigInt!) {
|
|
|
118
122
|
|
|
119
123
|
`gameApiUrl` is populated for **both** dedicated (`splitMode`) and shared
|
|
120
124
|
(`deploymentTarget: "shared"`) apps. When it's set, build a **second**
|
|
121
|
-
`CrowdyClient` with `httpUrl: gameApiUrl` (and the matching `wsUrl`)
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
+
`CrowdyClient` with `httpUrl: gameApiUrl` (and the matching `wsUrl`) holding that
|
|
126
|
+
app's **app-scoped token** (`identity.portal.mintAppToken(appId)` — do **not**
|
|
127
|
+
reuse the identity client's session token store), then drive gameplay through that
|
|
128
|
+
client. In practice `mintAppToken` already returns `gameApiUrl` / `gameApiWsUrl`,
|
|
129
|
+
so you rarely need this separate routing query. Apps with no `gameApiUrl` keep
|
|
130
|
+
working against the default `httpUrl` you configured.
|
|
125
131
|
|
|
126
132
|
## Realtime notifications
|
|
127
133
|
|
|
128
134
|
`subscribe` takes the handlers **and a required `appId`** (second argument). The
|
|
129
135
|
Game API scopes the realtime session to that app and rejects an app-agnostic
|
|
130
|
-
subscription with a `RealtimeConnectionEvent` (`code: 'APP_ID_REQUIRED'`).
|
|
131
|
-
|
|
132
|
-
|
|
136
|
+
subscription with a `RealtimeConnectionEvent` (`code: 'APP_ID_REQUIRED'`). It also
|
|
137
|
+
rejects an identity session token (`APP_TOKEN_REQUIRED`) or a token scoped to a
|
|
138
|
+
different app (`APP_SCOPE_MISMATCH`). Run one client per app (each holding that
|
|
139
|
+
app's app-scoped token) when a player is in multiple apps at once.
|
|
133
140
|
|
|
134
141
|
```ts
|
|
135
142
|
const appId = '1';
|
|
@@ -258,7 +265,7 @@ The key parameter is optional and trailing, so it's safe to omit. Requires a ser
|
|
|
258
265
|
|
|
259
266
|
- Use `client.auth.setToken(token)` if you need to seed a token externally (e.g. when restoring auth from a non-default storage).
|
|
260
267
|
- `client.session.restore()` reads from the configured `tokenStore`. `BrowserLocalStorageTokenStore` is provided; bring your own for SSR or Node usage.
|
|
261
|
-
-
|
|
268
|
+
- Each client's `AuthState` is observed by both its HTTP client and its realtime socket, so HTTP and WebSocket auth never drift within a client. Hold the **identity session token** on the management/identity client and an **app-scoped token** on each per-game client (`client.portal` — see the [v7 section](#overworld-portals--app-scoped-tokens-v7)).
|
|
262
269
|
|
|
263
270
|
## Overworld portals & app-scoped tokens (v7)
|
|
264
271
|
|
package/dist/domains/auth.d.ts
CHANGED
|
@@ -1,163 +1,100 @@
|
|
|
1
1
|
import type { GraphQLClient } from '../client.js';
|
|
2
2
|
import type { AuthState } from '../auth-state.js';
|
|
3
|
-
import { type LoginMutation, type LoginUserInput, type RegisterMutation, type RegisterUserInput, type ResetPasswordInput } from '../generated/graphql.js';
|
|
4
3
|
/**
|
|
5
|
-
* Authentication and account
|
|
4
|
+
* Authentication and account lifecycle — exposed as `client.auth`.
|
|
6
5
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
6
|
+
* Crowded Kingdoms is **passwordless**. There is no email+password login: a user
|
|
7
|
+
* authenticates with an emailed magic link, a federated social provider (OIDC),
|
|
8
|
+
* or — in development only — the dev bypass. Every path returns an identity
|
|
9
|
+
* SESSION token (management-plane), which is stored on the shared session state
|
|
10
|
+
* automatically. Gameplay tokens are minted separately via `client.portal`.
|
|
12
11
|
*
|
|
13
|
-
*
|
|
14
|
-
* the shared session state automatically, so every later call on *either*
|
|
15
|
-
* endpoint (auth, users, apps, actors, chunks, udp, ...) is authenticated
|
|
16
|
-
* without you threading the token through by hand. Use {@link setToken} to
|
|
17
|
-
* rehydrate a saved token and {@link getToken} to read the current one. `BigInt`
|
|
18
|
-
* ids on the returned user (e.g. `userId`, `orgId`) are decimal strings.
|
|
12
|
+
* Targets the **management-api** (`managementUrl`).
|
|
19
13
|
*
|
|
20
|
-
* **Public
|
|
21
|
-
* {@link
|
|
22
|
-
* {@link
|
|
23
|
-
* {@link logoutAllDevices},
|
|
24
|
-
* {@link
|
|
25
|
-
* missing, expired, or revoked.
|
|
14
|
+
* **Public (no session):** {@link requestLoginLink}, {@link completeLoginLink},
|
|
15
|
+
* {@link socialLoginStart}, {@link socialLoginComplete}, {@link devLogin},
|
|
16
|
+
* {@link availableLoginProviders}. **Require a session:** {@link logout},
|
|
17
|
+
* {@link logoutAllDevices}, {@link myIdentities}, {@link linkIdentity},
|
|
18
|
+
* {@link unlinkIdentity}.
|
|
26
19
|
*/
|
|
20
|
+
export interface AuthUser {
|
|
21
|
+
userId: string;
|
|
22
|
+
email?: string | null;
|
|
23
|
+
gamertag?: string | null;
|
|
24
|
+
}
|
|
25
|
+
export interface AuthResponse {
|
|
26
|
+
/** Identity session token; stored on the session state automatically. */
|
|
27
|
+
token: string;
|
|
28
|
+
gameTokenId: string;
|
|
29
|
+
user: AuthUser;
|
|
30
|
+
}
|
|
31
|
+
export interface UserIdentity {
|
|
32
|
+
identityId: string;
|
|
33
|
+
provider: string;
|
|
34
|
+
subject: string;
|
|
35
|
+
email: string | null;
|
|
36
|
+
emailVerified: boolean;
|
|
37
|
+
createdAt: string;
|
|
38
|
+
lastLoginAt: string | null;
|
|
39
|
+
}
|
|
27
40
|
export declare class AuthAPI {
|
|
28
41
|
private readonly graphql;
|
|
29
42
|
private readonly session;
|
|
30
43
|
constructor(graphql: GraphQLClient, session: AuthState);
|
|
44
|
+
/** The federated sign-in providers currently enabled (e.g. `['google']`). */
|
|
45
|
+
availableLoginProviders(): Promise<string[]>;
|
|
31
46
|
/**
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
* session state, so subsequent calls on any sub-client (management-api or
|
|
37
|
-
* game-api) carry it automatically — no need to call {@link setToken}.
|
|
38
|
-
*
|
|
39
|
-
* @param input - Credentials ({@link LoginUserInput}): `email` and `password`
|
|
40
|
-
* (min 8 characters).
|
|
41
|
-
* @returns An {@link AuthResponse}: the opaque session `token` (sent as
|
|
42
|
-
* `Authorization: Bearer <token>`), `gameTokenId` (the session row id, a
|
|
43
|
-
* string), and the authenticated `user`.
|
|
44
|
-
* @throws {CrowdyGraphQLError} `UNAUTHENTICATED` on invalid credentials, or
|
|
45
|
-
* `BAD_USER_INPUT` on malformed input.
|
|
46
|
-
* @example
|
|
47
|
-
* ```ts
|
|
48
|
-
* const { user } = await client.auth.login({ email, password });
|
|
49
|
-
* // the session token is now stored; later calls are authenticated for you
|
|
50
|
-
* await client.users.me();
|
|
51
|
-
* ```
|
|
47
|
+
* Passwordless: email the address a one-time magic sign-in link (creating the
|
|
48
|
+
* account on first sign-in). Always resolves `sent: true` (no enumeration). In
|
|
49
|
+
* development (`DEV_AUTH_BYPASS`) the response also carries `devToken`, the
|
|
50
|
+
* token to pass straight to {@link completeLoginLink} without an inbox.
|
|
52
51
|
*/
|
|
53
|
-
|
|
52
|
+
requestLoginLink(input: {
|
|
53
|
+
email: string;
|
|
54
|
+
redirectUri?: string;
|
|
55
|
+
}): Promise<{
|
|
56
|
+
sent: boolean;
|
|
57
|
+
devToken: string | null;
|
|
58
|
+
}>;
|
|
59
|
+
/** Complete a magic-link sign-in; stores the session token on success. */
|
|
60
|
+
completeLoginLink(token: string): Promise<AuthResponse>;
|
|
54
61
|
/**
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
* required. Same token-persistence behaviour as {@link login}: the new `token`
|
|
58
|
-
* is stored on the shared session state automatically.
|
|
59
|
-
*
|
|
60
|
-
* @param input - New-account details ({@link RegisterUserInput}): `email`
|
|
61
|
-
* (where the confirmation email is sent), `password` (min 8 characters), and
|
|
62
|
-
* an optional initial `gamertag` (min 3 characters; can also be set later via
|
|
63
|
-
* `client.users.updateGamertag`).
|
|
64
|
-
* @returns An {@link AuthResponse} (session `token`, `gameTokenId`, and the new
|
|
65
|
-
* `user`).
|
|
66
|
-
* @throws {CrowdyGraphQLError} `BAD_USER_INPUT` if the email already exists or
|
|
67
|
-
* the input is invalid.
|
|
62
|
+
* Begin a federated (social) sign-in. Returns an `authorizeUrl` to redirect the
|
|
63
|
+
* user to and an opaque `state` to round-trip back to {@link socialLoginComplete}.
|
|
68
64
|
*/
|
|
69
|
-
|
|
65
|
+
socialLoginStart(provider: string, redirectUri: string): Promise<{
|
|
66
|
+
authorizeUrl: string;
|
|
67
|
+
state: string;
|
|
68
|
+
}>;
|
|
69
|
+
/** Complete a federated sign-in from the provider callback; stores the token. */
|
|
70
|
+
socialLoginComplete(input: {
|
|
71
|
+
provider: string;
|
|
72
|
+
code: string;
|
|
73
|
+
state: string;
|
|
74
|
+
}): Promise<AuthResponse>;
|
|
70
75
|
/**
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
* other sub-clients stop using it. Requires a valid session.
|
|
75
|
-
*
|
|
76
|
-
* @returns `true` if a token was revoked, or `false` if the request carried no
|
|
77
|
-
* game token.
|
|
78
|
-
* @throws {CrowdyGraphQLError} `UNAUTHENTICATED` if the session is invalid.
|
|
76
|
+
* DEV ONLY bypass sign-in (active only when the server has `DEV_AUTH_BYPASS`).
|
|
77
|
+
* Returns a session for `email` without email/social verification; stores it.
|
|
78
|
+
* Throws `FORBIDDEN` when the bypass is disabled (e.g. production).
|
|
79
79
|
*/
|
|
80
|
+
devLogin(email: string): Promise<AuthResponse>;
|
|
81
|
+
/** The signed-in user's linked sign-in identities. Requires a session. */
|
|
82
|
+
myIdentities(): Promise<UserIdentity[]>;
|
|
83
|
+
/** Link an additional federated identity (from a social callback). */
|
|
84
|
+
linkIdentity(input: {
|
|
85
|
+
provider: string;
|
|
86
|
+
code: string;
|
|
87
|
+
state: string;
|
|
88
|
+
}): Promise<UserIdentity>;
|
|
89
|
+
/** Unlink a federated identity (cannot remove the last sign-in method). */
|
|
90
|
+
unlinkIdentity(identityId: string): Promise<boolean>;
|
|
91
|
+
/** Single-device logout; clears the in-memory token on success. */
|
|
80
92
|
logout(): Promise<boolean>;
|
|
81
|
-
/**
|
|
82
|
-
* Revoke **every** active session for the authenticated user (deletes all
|
|
83
|
-
* their `game_tokens` rows and records revocations). Requires a valid session;
|
|
84
|
-
* use {@link logout} to end only the current one.
|
|
85
|
-
*
|
|
86
|
-
* Note: unlike {@link logout}, this does not clear the SDK's in-memory token —
|
|
87
|
-
* call {@link setToken}`(null)` afterwards if you also want to drop it locally.
|
|
88
|
-
*
|
|
89
|
-
* @returns `true` on success.
|
|
90
|
-
* @throws {CrowdyGraphQLError} `UNAUTHENTICATED` if the session is invalid.
|
|
91
|
-
*/
|
|
93
|
+
/** Revoke every active session for the user. Requires a session. */
|
|
92
94
|
logoutAllDevices(): Promise<boolean>;
|
|
93
|
-
/**
|
|
94
|
-
* Confirm a user's email address using the token from the confirmation email.
|
|
95
|
-
* **Public** — the token itself authorizes the call.
|
|
96
|
-
*
|
|
97
|
-
* @param token - The confirmation token from the emailed link.
|
|
98
|
-
* @returns `true` on success, or `false` if the token is invalid or expired.
|
|
99
|
-
* @throws {CrowdyGraphQLError} on transport/validation failures (invalid or
|
|
100
|
-
* expired tokens resolve to `false` rather than throwing).
|
|
101
|
-
*/
|
|
102
|
-
confirmEmail(token: string): Promise<boolean>;
|
|
103
|
-
/**
|
|
104
|
-
* Start the password-reset flow by emailing a reset link to the address.
|
|
105
|
-
* **Public**. Always returns `true` regardless of whether the email exists or
|
|
106
|
-
* is confirmed, to prevent account enumeration.
|
|
107
|
-
*
|
|
108
|
-
* @param email - Email address to send the password-reset link to.
|
|
109
|
-
* @returns `true` (always, even when no such account exists).
|
|
110
|
-
* @throws {CrowdyGraphQLError} on transport/validation failures.
|
|
111
|
-
*/
|
|
112
|
-
requestPasswordReset(email: string): Promise<boolean>;
|
|
113
|
-
/**
|
|
114
|
-
* Complete a password reset using the reset token and a new password.
|
|
115
|
-
* **Public** — the reset token authorizes the call. Existing sessions are
|
|
116
|
-
* **not** revoked.
|
|
117
|
-
*
|
|
118
|
-
* @param input - {@link ResetPasswordInput}: the `token` from the emailed reset
|
|
119
|
-
* link and the `newPassword` to set (min 8 characters).
|
|
120
|
-
* @returns `true` on success.
|
|
121
|
-
* @throws {CrowdyGraphQLError} `BAD_USER_INPUT` if the token is invalid or
|
|
122
|
-
* expired.
|
|
123
|
-
*/
|
|
124
|
-
resetPassword(input: ResetPasswordInput): Promise<boolean>;
|
|
125
|
-
/**
|
|
126
|
-
* Re-send the email-confirmation link. **Public**. Always returns `true`
|
|
127
|
-
* regardless of whether the account exists or is already confirmed (prevents
|
|
128
|
-
* enumeration); the email is only actually sent for existing unconfirmed
|
|
129
|
-
* accounts.
|
|
130
|
-
*
|
|
131
|
-
* @param email - Email address of the account to re-send confirmation to.
|
|
132
|
-
* @returns `true` (always).
|
|
133
|
-
* @throws {CrowdyGraphQLError} on transport/validation failures.
|
|
134
|
-
*/
|
|
135
|
-
resendConfirmationEmail(email: string): Promise<boolean>;
|
|
136
|
-
/**
|
|
137
|
-
* Change the authenticated user's password after verifying the current one.
|
|
138
|
-
* Requires a valid session. Existing sessions are **not** revoked.
|
|
139
|
-
*
|
|
140
|
-
* @param currentPassword - The user's current password, for verification.
|
|
141
|
-
* @param newPassword - The new password to set (min 8 characters).
|
|
142
|
-
* @returns `true` on success.
|
|
143
|
-
* @throws {CrowdyGraphQLError} `UNAUTHENTICATED` without a valid session, or
|
|
144
|
-
* `BAD_USER_INPUT` if the current password is wrong.
|
|
145
|
-
*/
|
|
146
|
-
changePassword(currentPassword: string, newPassword: string): Promise<boolean>;
|
|
147
|
-
/**
|
|
148
|
-
* Imperatively replace the in-memory bearer token on the shared session state
|
|
149
|
-
* (e.g. to rehydrate a token persisted to disk). Affects every sub-client.
|
|
150
|
-
* Local only — performs no network call. Pass `null` to clear it.
|
|
151
|
-
*
|
|
152
|
-
* @param token - The bearer token to use, or `null` to clear the session.
|
|
153
|
-
*/
|
|
95
|
+
/** Imperatively set the in-memory bearer token (e.g. rehydrate). */
|
|
154
96
|
setToken(token: string | null): void;
|
|
155
|
-
/**
|
|
156
|
-
* Read the current in-memory bearer token from the shared session state. Local
|
|
157
|
-
* only — performs no network call.
|
|
158
|
-
*
|
|
159
|
-
* @returns The current bearer token, or `null` if none is set.
|
|
160
|
-
*/
|
|
97
|
+
/** Read the current in-memory bearer token. */
|
|
161
98
|
getToken(): string | null;
|
|
162
99
|
}
|
|
163
100
|
//# sourceMappingURL=auth.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/domains/auth.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/domains/auth.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAGlD;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM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