Base64 encode auth tokens (#1029)

* Base64 encode auth tokens to prevent issues in emails
This fixes #1023, which should in turn solve some issues people were having with emails.

* Make test bcrypt hash things as the auth token isn't one by default

* Update ProjectLighthouse/Helpers/CryptoHelper.cs

Co-authored-by: Josh <josh@slendy.pw>

* Make only email tokens base64 encoded

---------

Co-authored-by: Zaprit <zaprit@hugespaceship.io>
Co-authored-by: Josh <josh@slendy.pw>
This commit is contained in:
Henry Asbridge 2024-06-29 19:14:16 +01:00 committed by GitHub
commit e060f55896
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 10 additions and 5 deletions

View file

@ -20,8 +20,8 @@ public class DatabaseTests : LighthouseServerTest<GameServerTestStartup>
int rand = new Random().Next();
UserEntity userA = await database.CreateUser("unitTestUser" + rand, CryptoHelper.GenerateAuthToken());
UserEntity userB = await database.CreateUser("unitTestUser" + rand, CryptoHelper.GenerateAuthToken());
UserEntity userA = await database.CreateUser("unitTestUser" + rand, CryptoHelper.BCryptHash(CryptoHelper.GenerateAuthToken()));
UserEntity userB = await database.CreateUser("unitTestUser" + rand, CryptoHelper.BCryptHash(CryptoHelper.GenerateAuthToken()));
Assert.NotNull(userA);
Assert.NotNull(userB);