From 61026cbe3c365ed820008e0c7c0eba4dc3905d8a Mon Sep 17 00:00:00 2001 From: Mathias Wagner Date: Sun, 15 Jan 2023 00:31:29 +0100 Subject: [PATCH] Encrypted the Session.ts --- src/models/Session.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/models/Session.ts b/src/models/Session.ts index 3171ec7..cd90527 100644 --- a/src/models/Session.ts +++ b/src/models/Session.ts @@ -1,4 +1,5 @@ import {model, ObjectId, Schema, Types} from "mongoose"; +import encrypt from "mongoose-encryption"; interface ISession { id: ObjectId, @@ -19,4 +20,9 @@ const SessionSchema = new Schema({ userAgent: String }); +SessionSchema.plugin(encrypt, { + encryptionKey: process.env.ENC_KEY, + signingKey: process.env.SIG_KEY +}); + export const Session = model('sessions', SessionSchema); \ No newline at end of file