Encrypted the Session.ts
This commit is contained in:
parent
6a9b3c2c5e
commit
61026cbe3c
@ -1,4 +1,5 @@
|
|||||||
import {model, ObjectId, Schema, Types} from "mongoose";
|
import {model, ObjectId, Schema, Types} from "mongoose";
|
||||||
|
import encrypt from "mongoose-encryption";
|
||||||
|
|
||||||
interface ISession {
|
interface ISession {
|
||||||
id: ObjectId,
|
id: ObjectId,
|
||||||
@ -19,4 +20,9 @@ const SessionSchema = new Schema<ISession>({
|
|||||||
userAgent: String
|
userAgent: String
|
||||||
});
|
});
|
||||||
|
|
||||||
|
SessionSchema.plugin(encrypt, {
|
||||||
|
encryptionKey: process.env.ENC_KEY,
|
||||||
|
signingKey: process.env.SIG_KEY
|
||||||
|
});
|
||||||
|
|
||||||
export const Session = model<ISession>('sessions', SessionSchema);
|
export const Session = model<ISession>('sessions', SessionSchema);
|
Loading…
x
Reference in New Issue
Block a user