I'm trying to encrypt my data in mongodb. I'm using mongoose-encryption plugin, but i have an error like this :
"throw new Error('must provide either options.secret or both options.encryptionKey and options.signingKey');"
here's my code:
var UserSchema = new mongoose.Schema({
profile: ProfileSchema,
timeStamp: Date,
created: Date,
email: {
type: String,
sparse: true
},
username: {
type: String,
},
password: {
type: String,
}
})
var encKey = process.env.SOME_32BYTE_BASE64_STRING
var sigKey = process.env.SOME_64BYTE_BASE64_STRING
UserSchema.plugin(encrypt, { encryptionKey: encKey, signingKey: sigKey , encryptedFields: ['email']})
so, what i'm missing in my code? i have no idea with this error. because i just following steps in here but failed. i'm new in node and mongoose. please help me... thanks anyway...