@spacelr/sdk 0.2.0 → 0.2.1

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
@@ -378,7 +378,9 @@ var TokenManager = class {
378
378
  return tokens.accessToken;
379
379
  }
380
380
  async setTokens(tokens) {
381
- await this.storage.setTokens(tokens);
381
+ const needsDefault = tokens.expiresAt === void 0 && !!tokens.refreshToken;
382
+ const normalised = needsDefault ? { ...tokens, expiresAt: Math.floor(Date.now() / 1e3) } : tokens;
383
+ await this.storage.setTokens(normalised);
382
384
  this.authLostEmitted = false;
383
385
  }
384
386
  async clearTokens() {