Encrypted the Account.ts

This commit is contained in:
Mathias Wagner 2023-01-15 00:23:40 +01:00
parent 00c00d40a2
commit 0aff108ada
Signed by: Mathias
GPG Key ID: B8DC354B0A1F5B44

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);