diff --git a/src/models/Session.ts b/src/models/Session.ts index 2607138..cf2119a 100644 --- a/src/models/Session.ts +++ b/src/models/Session.ts @@ -1,6 +1,6 @@ import {model, ObjectId, Schema, Types} from "mongoose"; import { fieldEncryption } from "mongoose-field-encryption"; -import process from "process"; +import crypto from "crypto"; interface ISession { id: ObjectId, @@ -18,7 +18,7 @@ const SessionSchema = new Schema({ }, token: { type: String, - required: true + default: () => crypto.randomBytes(48).toString('hex') }, ip: String, userAgent: String,