@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.d.mts CHANGED
@@ -307,6 +307,21 @@ interface PasskeyCredential {
307
307
  createdAt: string;
308
308
  lastUsedAt?: string;
309
309
  }
310
+ /**
311
+ * A single active session, as returned by the session-list endpoint (#805).
312
+ * `current` marks the session tied to the caller's own access token.
313
+ */
314
+ interface SessionSummary {
315
+ sessionId: string;
316
+ current: boolean;
317
+ clientId: string;
318
+ credentialId?: string;
319
+ userAgent?: string;
320
+ ip?: string;
321
+ country?: string;
322
+ createdAt: string;
323
+ lastSeenAt: string;
324
+ }
310
325
 
311
326
  interface TokenStorage {
312
327
  getTokens(): Promise<StoredTokens | null>;
@@ -1222,6 +1237,25 @@ declare class AuthModule {
1222
1237
  * their recovery phrase. Authenticated.
1223
1238
  */
1224
1239
  getRecoveryStatus(): Promise<RecoveryStatusResponse>;
1240
+ /**
1241
+ * List the active sessions for the signed-in user. Each entry is flagged
1242
+ * `current` when it corresponds to the caller's own access token.
1243
+ */
1244
+ listSessions(): Promise<SessionSummary[]>;
1245
+ /**
1246
+ * Revoke a single session by id, signing it out. The server refuses to
1247
+ * revoke the caller's own current session through this endpoint.
1248
+ */
1249
+ revokeSession(sessionId: string): Promise<{
1250
+ revoked: true;
1251
+ }>;
1252
+ /**
1253
+ * Sign out every other active session for the current user, keeping the
1254
+ * caller's own session intact.
1255
+ */
1256
+ signOutOtherSessions(): Promise<{
1257
+ revokedCount: number;
1258
+ }>;
1225
1259
  private storeTokensFromRegister;
1226
1260
  }
1227
1261
 
package/dist/index.d.ts CHANGED
@@ -307,6 +307,21 @@ interface PasskeyCredential {
307
307
  createdAt: string;
308
308
  lastUsedAt?: string;
309
309
  }
310
+ /**
311
+ * A single active session, as returned by the session-list endpoint (#805).
312
+ * `current` marks the session tied to the caller's own access token.
313
+ */
314
+ interface SessionSummary {
315
+ sessionId: string;
316
+ current: boolean;
317
+ clientId: string;
318
+ credentialId?: string;
319
+ userAgent?: string;
320
+ ip?: string;
321
+ country?: string;
322
+ createdAt: string;
323
+ lastSeenAt: string;
324
+ }
310
325
 
311
326
  interface TokenStorage {
312
327
  getTokens(): Promise<StoredTokens | null>;
@@ -1222,6 +1237,25 @@ declare class AuthModule {
1222
1237
  * their recovery phrase. Authenticated.
1223
1238
  */
1224
1239
  getRecoveryStatus(): Promise<RecoveryStatusResponse>;
1240
+ /**
1241
+ * List the active sessions for the signed-in user. Each entry is flagged
1242
+ * `current` when it corresponds to the caller's own access token.
1243
+ */
1244
+ listSessions(): Promise<SessionSummary[]>;
1245
+ /**
1246
+ * Revoke a single session by id, signing it out. The server refuses to
1247
+ * revoke the caller's own current session through this endpoint.
1248
+ */
1249
+ revokeSession(sessionId: string): Promise<{
1250
+ revoked: true;
1251
+ }>;
1252
+ /**
1253
+ * Sign out every other active session for the current user, keeping the
1254
+ * caller's own session intact.
1255
+ */
1256
+ signOutOtherSessions(): Promise<{
1257
+ revokedCount: number;
1258
+ }>;
1225
1259
  private storeTokensFromRegister;
1226
1260
  }
1227
1261
 
package/dist/index.js CHANGED
@@ -2412,6 +2412,42 @@ var AuthModule = class _AuthModule {
2412
2412
  authenticated: true
2413
2413
  });
2414
2414
  }
2415
+ // ─── Session management (#805 SP1) ───
2416
+ /**
2417
+ * List the active sessions for the signed-in user. Each entry is flagged
2418
+ * `current` when it corresponds to the caller's own access token.
2419
+ */
2420
+ async listSessions() {
2421
+ const { sessions } = await this.http.request({
2422
+ method: "GET",
2423
+ path: "/auth/sessions",
2424
+ authenticated: true
2425
+ });
2426
+ return sessions;
2427
+ }
2428
+ /**
2429
+ * Revoke a single session by id, signing it out. The server refuses to
2430
+ * revoke the caller's own current session through this endpoint.
2431
+ */
2432
+ async revokeSession(sessionId) {
2433
+ return this.http.request({
2434
+ method: "DELETE",
2435
+ path: `/auth/sessions/${encodeURIComponent(sessionId)}`,
2436
+ authenticated: true
2437
+ });
2438
+ }
2439
+ /**
2440
+ * Sign out every other active session for the current user, keeping the
2441
+ * caller's own session intact.
2442
+ */
2443
+ async signOutOtherSessions() {
2444
+ return this.http.request({
2445
+ method: "POST",
2446
+ path: "/auth/sessions/revoke-others",
2447
+ authenticated: true,
2448
+ body: {}
2449
+ });
2450
+ }
2415
2451
  async storeTokensFromRegister(response) {
2416
2452
  if (!response.access_token) return;
2417
2453
  const expiresAt = response.expires_in ? Math.floor(Date.now() / 1e3) + response.expires_in : void 0;