refactor(api): 🎨 Don't use node:crypto for random strings

This commit is contained in:
Jesse Wierzbinski 2024-06-12 19:38:26 -10:00
parent d8cb1d475b
commit d301d4da09
No known key found for this signature in database
12 changed files with 37 additions and 35 deletions

View file

@ -1,6 +1,6 @@
import { randomBytes } from "node:crypto";
import { idValidator } from "@/api";
import { getBestContentType, urlToContentFormat } from "@/content_types";
import { randomString } from "@/math";
import { addUserToMeilisearch } from "@/meilisearch";
import { proxyUrl } from "@/response";
import { EntityValidator } from "@lysand-org/federation";
@ -190,7 +190,7 @@ export class User extends BaseInterface<typeof Users, UserWithRelations> {
}
async resetPassword() {
const resetToken = await randomBytes(32).toString("hex");
const resetToken = randomString(32, "hex");
await this.update({
passwordResetToken: resetToken,