@korajs/auth 0.3.1 → 0.3.3

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/server.js CHANGED
@@ -815,14 +815,12 @@ var BuiltInAuthRoutes = class {
815
815
  throw err;
816
816
  }
817
817
  const deviceId = body.deviceId ?? `device-${user.id}`;
818
- if (body.deviceId !== void 0 && body.devicePublicKey !== void 0) {
819
- await this.userStore.registerDevice({
820
- id: body.deviceId,
821
- userId: user.id,
822
- publicKey: body.devicePublicKey,
823
- name: "Primary Device"
824
- });
825
- }
818
+ await this.userStore.registerDevice({
819
+ id: deviceId,
820
+ userId: user.id,
821
+ publicKey: body.devicePublicKey ?? "",
822
+ name: body.deviceId ? "Primary Device" : "Browser"
823
+ });
826
824
  const tokens = this.tokenManager.issueTokens(user.id, deviceId);
827
825
  return {
828
826
  status: 201,
@@ -872,14 +870,12 @@ var BuiltInAuthRoutes = class {
872
870
  }
873
871
  await this.rateLimiter.reset(rateLimitKey);
874
872
  const deviceId = body.deviceId ?? `device-${storedUser.id}`;
875
- if (body.deviceId !== void 0 && body.devicePublicKey !== void 0) {
876
- await this.userStore.registerDevice({
877
- id: body.deviceId,
878
- userId: storedUser.id,
879
- publicKey: body.devicePublicKey,
880
- name: "Device"
881
- });
882
- }
873
+ await this.userStore.registerDevice({
874
+ id: deviceId,
875
+ userId: storedUser.id,
876
+ publicKey: body.devicePublicKey ?? "",
877
+ name: body.deviceId ? "Device" : "Browser"
878
+ });
883
879
  const tokens = this.tokenManager.issueTokens(storedUser.id, deviceId);
884
880
  const user = {
885
881
  id: storedUser.id,