@spacelr/sdk 0.10.1 → 0.10.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/dist/index.d.mts CHANGED
@@ -62,6 +62,12 @@ interface RegisterResponse {
62
62
  access_token?: string;
63
63
  /** Omitted by the server when `emailVerificationRequired` is true. */
64
64
  refresh_token?: string;
65
+ /**
66
+ * Access-token lifetime in seconds. Present whenever tokens are issued
67
+ * (i.e. not when email verification is required). Lets the SDK store an
68
+ * expiry and refresh proactively instead of on the first request.
69
+ */
70
+ expires_in?: number;
65
71
  emailVerificationRequired?: boolean;
66
72
  }
67
73
  interface TokenResponse {
package/dist/index.d.ts CHANGED
@@ -62,6 +62,12 @@ interface RegisterResponse {
62
62
  access_token?: string;
63
63
  /** Omitted by the server when `emailVerificationRequired` is true. */
64
64
  refresh_token?: string;
65
+ /**
66
+ * Access-token lifetime in seconds. Present whenever tokens are issued
67
+ * (i.e. not when email verification is required). Lets the SDK store an
68
+ * expiry and refresh proactively instead of on the first request.
69
+ */
70
+ expires_in?: number;
65
71
  emailVerificationRequired?: boolean;
66
72
  }
67
73
  interface TokenResponse {
package/dist/index.js CHANGED
@@ -1870,9 +1870,11 @@ var AuthModule = class {
1870
1870
  }
1871
1871
  async storeTokensFromRegister(response) {
1872
1872
  if (!response.access_token) return;
1873
+ const expiresAt = response.expires_in ? Math.floor(Date.now() / 1e3) + response.expires_in : void 0;
1873
1874
  await this.tokenManager.setTokens({
1874
1875
  accessToken: response.access_token,
1875
- refreshToken: response.refresh_token
1876
+ refreshToken: response.refresh_token,
1877
+ expiresAt
1876
1878
  });
1877
1879
  this.emitState("authenticated");
1878
1880
  }