@korajs/auth 0.3.2 → 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.cjs CHANGED
@@ -1141,14 +1141,12 @@ var BuiltInAuthRoutes = class {
1141
1141
  throw err;
1142
1142
  }
1143
1143
  const deviceId = body.deviceId ?? `device-${user.id}`;
1144
- if (body.deviceId !== void 0 && body.devicePublicKey !== void 0) {
1145
- await this.userStore.registerDevice({
1146
- id: body.deviceId,
1147
- userId: user.id,
1148
- publicKey: body.devicePublicKey,
1149
- name: "Primary Device"
1150
- });
1151
- }
1144
+ await this.userStore.registerDevice({
1145
+ id: deviceId,
1146
+ userId: user.id,
1147
+ publicKey: body.devicePublicKey ?? "",
1148
+ name: body.deviceId ? "Primary Device" : "Browser"
1149
+ });
1152
1150
  const tokens = this.tokenManager.issueTokens(user.id, deviceId);
1153
1151
  return {
1154
1152
  status: 201,
@@ -1198,14 +1196,12 @@ var BuiltInAuthRoutes = class {
1198
1196
  }
1199
1197
  await this.rateLimiter.reset(rateLimitKey);
1200
1198
  const deviceId = body.deviceId ?? `device-${storedUser.id}`;
1201
- if (body.deviceId !== void 0 && body.devicePublicKey !== void 0) {
1202
- await this.userStore.registerDevice({
1203
- id: body.deviceId,
1204
- userId: storedUser.id,
1205
- publicKey: body.devicePublicKey,
1206
- name: "Device"
1207
- });
1208
- }
1199
+ await this.userStore.registerDevice({
1200
+ id: deviceId,
1201
+ userId: storedUser.id,
1202
+ publicKey: body.devicePublicKey ?? "",
1203
+ name: body.deviceId ? "Device" : "Browser"
1204
+ });
1209
1205
  const tokens = this.tokenManager.issueTokens(storedUser.id, deviceId);
1210
1206
  const user = {
1211
1207
  id: storedUser.id,