@hemia/auth-sdk 0.0.19 → 0.0.20

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.
@@ -192,8 +192,8 @@ let AuthService = class AuthService {
192
192
  createdAt: new Date().toISOString(),
193
193
  sessionId: session_id
194
194
  };
195
- const expiresSession = Date.now() + (session_expires_in ? session_expires_in * 1000 : 0);
196
- await this.storage.set(`x-session:${sessionId}`, sessionData, expiresSession);
195
+ const ttlSeconds = session_expires_in || 604800;
196
+ await this.storage.set(`x-session:${sessionId}`, sessionData, ttlSeconds);
197
197
  return {
198
198
  sessionId,
199
199
  expiresIn: expires_in,
@@ -376,8 +376,8 @@ let AuthService = class AuthService {
376
376
  sessionId: session_id || '',
377
377
  createdAt: Date.now().toString()
378
378
  };
379
- const expiresSession = Date.now() + (session_expires_in ? session_expires_in * 1000 : 0);
380
- await this.storage.set(`x-session:${sessionId}`, updatedSession, expiresSession);
379
+ const ttlSeconds = session_expires_in || 604800;
380
+ await this.storage.set(`x-session:${sessionId}`, updatedSession, ttlSeconds);
381
381
  return updatedSession;
382
382
  }
383
383
  };
@@ -194,8 +194,8 @@ exports.AuthService = class AuthService {
194
194
  createdAt: new Date().toISOString(),
195
195
  sessionId: session_id
196
196
  };
197
- const expiresSession = Date.now() + (session_expires_in ? session_expires_in * 1000 : 0);
198
- await this.storage.set(`x-session:${sessionId}`, sessionData, expiresSession);
197
+ const ttlSeconds = session_expires_in || 604800;
198
+ await this.storage.set(`x-session:${sessionId}`, sessionData, ttlSeconds);
199
199
  return {
200
200
  sessionId,
201
201
  expiresIn: expires_in,
@@ -378,8 +378,8 @@ exports.AuthService = class AuthService {
378
378
  sessionId: session_id || '',
379
379
  createdAt: Date.now().toString()
380
380
  };
381
- const expiresSession = Date.now() + (session_expires_in ? session_expires_in * 1000 : 0);
382
- await this.storage.set(`x-session:${sessionId}`, updatedSession, expiresSession);
381
+ const ttlSeconds = session_expires_in || 604800;
382
+ await this.storage.set(`x-session:${sessionId}`, updatedSession, ttlSeconds);
383
383
  return updatedSession;
384
384
  }
385
385
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hemia/auth-sdk",
3
- "version": "0.0.19",
3
+ "version": "0.0.20",
4
4
  "description": "Hemia SDK for authentication",
5
5
  "main": "dist/hemia-auth-sdk.js",
6
6
  "module": "dist/hemia-auth-sdk.esm.js",