Encrypted the Account.ts

This commit is contained in:
2023-01-15 00:23:40 +01:00
parent 00c00d40a2
commit 0aff108ada

View File

@ -1,4 +1,5 @@
import {Schema, ObjectId, model} from "mongoose";
import encrypt from "mongoose-encryption";
export interface IAccount {
id: ObjectId,
@ -24,4 +25,9 @@ const AccountSchema = new Schema<IAccount>({
totpSecret: String
});
AccountSchema.plugin(encrypt, {
encryptionKey: process.env.ENC_KEY,
signingKey: process.env.SIG_KEY
});
export const Account = model<IAccount>("accounts", AccountSchema);