@totop/platform-sdk 1.1.1 → 1.1.2

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 CHANGED
@@ -3,7 +3,7 @@
3
3
  Browser SDK for reviewed ToTop applications and games. It provides unified identity, protected API access, cloud saves, token rotation, and local/global logout separation.
4
4
 
5
5
  ```bash
6
- npm install @totop/platform-sdk@1.1.1
6
+ npm install @totop/platform-sdk@1.1.2
7
7
  ```
8
8
 
9
9
  ```ts
@@ -27,7 +27,7 @@ const response = await ToTop.authorizedFetch('https://api.totop.ai/game-api/game
27
27
  await ToTop.logout()
28
28
  ```
29
29
 
30
- The reviewed `totop.auth.json` is public configuration and contains no secret. Access tokens stay in memory; rotating refresh tokens are limited to the current browser tab's `sessionStorage` for at most eight hours.
30
+ The reviewed `totop.auth.json` is public configuration and contains no secret. Access tokens stay in memory; rotating refresh tokens are limited to the current browser tab's `sessionStorage`. The server enforces an absolute 30-day lifetime for every refresh-token family.
31
31
 
32
32
  ## Cloud save (game clients)
33
33
 
package/dist/core.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export declare const PLATFORM_SDK_VERSION = "1.1.1";
1
+ export declare const PLATFORM_SDK_VERSION = "1.1.2";
2
2
  export type ToTopPlatformConfig = {
3
3
  version: 1;
4
4
  clientId: string;
@@ -1,5 +1,5 @@
1
1
  // packages/auth-sdk/src/core.ts
2
- var PLATFORM_SDK_VERSION = "1.1.1";
2
+ var PLATFORM_SDK_VERSION = "1.1.2";
3
3
  var CONFIG_VERSION = 1;
4
4
  var MAX_CLOUD_SAVE_BYTES = 1024 * 1024;
5
5
  var SESSION_PREFIX = "totop:auth-sdk:";
@@ -337,8 +337,7 @@ var ToTopPlatformClient = class {
337
337
  if (this.refreshFlight) return this.refreshFlight;
338
338
  const config = this.requireConfig();
339
339
  const token = this.deps.storage.getItem(this.key("refresh"));
340
- const familyExpires = Number(this.deps.storage.getItem(this.key("family_expires")) ?? 0);
341
- if (!token || familyExpires <= this.now()) {
340
+ if (!token) {
342
341
  this.clearState();
343
342
  throw new Error("login required");
344
343
  }
@@ -381,7 +380,6 @@ var ToTopPlatformClient = class {
381
380
  this.accessToken = result.access_token;
382
381
  this.accessExpiresAt = this.now() + result.expires_in * 1e3;
383
382
  this.deps.storage.setItem(this.key("refresh"), result.refresh_token);
384
- if (!this.deps.storage.getItem(this.key("family_expires"))) this.deps.storage.setItem(this.key("family_expires"), String(this.now() + 8 * 60 * 60 * 1e3));
385
383
  } finally {
386
384
  this.controllers.delete(controller);
387
385
  }
@@ -30,7 +30,7 @@ var ToTopPlatformSDK = (() => {
30
30
  });
31
31
 
32
32
  // packages/auth-sdk/src/core.ts
33
- var PLATFORM_SDK_VERSION = "1.1.1";
33
+ var PLATFORM_SDK_VERSION = "1.1.2";
34
34
  var CONFIG_VERSION = 1;
35
35
  var MAX_CLOUD_SAVE_BYTES = 1024 * 1024;
36
36
  var SESSION_PREFIX = "totop:auth-sdk:";
@@ -368,8 +368,7 @@ var ToTopPlatformSDK = (() => {
368
368
  if (this.refreshFlight) return this.refreshFlight;
369
369
  const config = this.requireConfig();
370
370
  const token = this.deps.storage.getItem(this.key("refresh"));
371
- const familyExpires = Number(this.deps.storage.getItem(this.key("family_expires")) ?? 0);
372
- if (!token || familyExpires <= this.now()) {
371
+ if (!token) {
373
372
  this.clearState();
374
373
  throw new Error("login required");
375
374
  }
@@ -412,7 +411,6 @@ var ToTopPlatformSDK = (() => {
412
411
  this.accessToken = result.access_token;
413
412
  this.accessExpiresAt = this.now() + result.expires_in * 1e3;
414
413
  this.deps.storage.setItem(this.key("refresh"), result.refresh_token);
415
- if (!this.deps.storage.getItem(this.key("family_expires"))) this.deps.storage.setItem(this.key("family_expires"), String(this.now() + 8 * 60 * 60 * 1e3));
416
414
  } finally {
417
415
  this.controllers.delete(controller);
418
416
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@totop/platform-sdk",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
4
4
  "type": "module",
5
5
  "exports": { ".": "./dist/totop-platform.esm.js" },
6
6
  "main": "./dist/totop-platform.global.js",