Mostly working websocket stuff, some message weirdness at the moment...

This commit is contained in:
Nate Anderson
2025-02-10 18:55:15 -07:00
parent 623474e0c6
commit b37862a321
19 changed files with 543 additions and 87 deletions
+9 -3
View File
@@ -1,5 +1,5 @@
import 'package:backend/database.dart';
import 'package:backend/service/db_access.dart';
import 'package:backend/db/database.dart';
import 'package:backend/db/db_access.dart';
import 'package:backend/utils/environment.dart';
import 'package:dart_jsonwebtoken/dart_jsonwebtoken.dart';
import 'package:logging/logging.dart';
@@ -25,7 +25,13 @@ class Authenticator {
final iat = DateTime.now().millisecondsSinceEpoch ~/ 1000;
final jwt = JWT(
header: {'algo': 'HS256'},
JWTBody(uuid: newUser.uuid, roomUuid: newUser.gameRoomUuid, iat: iat, exp: iat + expTimeSecs).toJson(),
JWTBody(
uuid: newUser.uuid,
roomUuid: newUser.gameRoomUuid,
roomCode: req.roomCode,
iat: iat,
exp: iat + expTimeSecs,
).toJson(),
);
return (jwt.sign(SecretKey(jwtSecret!)), newUser);