i went overboard
All checks were successful
Code quality checks / build (23) (push) Successful in 34s
Push code / build (push) Successful in 45s

This commit is contained in:
Lara 2024-11-02 17:07:25 +02:00
parent ca31bba520
commit 1fcbbaab55
Signed by: laratheprotogen
GPG key ID: 5C0296EB3165F98B

View file

@ -49,7 +49,7 @@ export class ApiLogins extends BaseRepository {
// Generate random login id
let loginId;
while (true) {
loginId = randomBytes(64).toString("hex");
loginId = randomBytes(16).toString("hex");
const existing = await this.apiLogins.findOne({
where: {
id: loginId,
@ -59,7 +59,7 @@ export class ApiLogins extends BaseRepository {
}
// Generate token
const token = randomBytes(64).toString("hex");
const token = randomBytes(32).toString("hex");
const hash = crypto.createHash("sha256");
hash.update(loginId + token); // Use loginId as a salt
const hashedToken = hash.digest("hex");