@spacelr/sdk 0.15.1 → 0.16.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/dist/index.mjs CHANGED
@@ -2365,6 +2365,42 @@ var AuthModule = class _AuthModule {
2365
2365
  authenticated: true
2366
2366
  });
2367
2367
  }
2368
+ // ─── Session management (#805 SP1) ───
2369
+ /**
2370
+ * List the active sessions for the signed-in user. Each entry is flagged
2371
+ * `current` when it corresponds to the caller's own access token.
2372
+ */
2373
+ async listSessions() {
2374
+ const { sessions } = await this.http.request({
2375
+ method: "GET",
2376
+ path: "/auth/sessions",
2377
+ authenticated: true
2378
+ });
2379
+ return sessions;
2380
+ }
2381
+ /**
2382
+ * Revoke a single session by id, signing it out. The server refuses to
2383
+ * revoke the caller's own current session through this endpoint.
2384
+ */
2385
+ async revokeSession(sessionId) {
2386
+ return this.http.request({
2387
+ method: "DELETE",
2388
+ path: `/auth/sessions/${encodeURIComponent(sessionId)}`,
2389
+ authenticated: true
2390
+ });
2391
+ }
2392
+ /**
2393
+ * Sign out every other active session for the current user, keeping the
2394
+ * caller's own session intact.
2395
+ */
2396
+ async signOutOtherSessions() {
2397
+ return this.http.request({
2398
+ method: "POST",
2399
+ path: "/auth/sessions/revoke-others",
2400
+ authenticated: true,
2401
+ body: {}
2402
+ });
2403
+ }
2368
2404
  async storeTokensFromRegister(response) {
2369
2405
  if (!response.access_token) return;
2370
2406
  const expiresAt = response.expires_in ? Math.floor(Date.now() / 1e3) + response.expires_in : void 0;