feature (admin): admin console

This commit is contained in:
Mickael KERJEAN
2018-12-07 12:54:28 +11:00
parent 1b591af5b3
commit ce6a228968
78 changed files with 2699 additions and 386 deletions

View File

@ -1,4 +1,6 @@
import crypto from 'crypto';
import bcrypt from 'bcryptjs';
const algorithm = 'aes-256-cbc';
export function encrypt(obj, key){
@ -11,3 +13,12 @@ export function decrypt(text, key){
var decipher = crypto.createDecipher(algorithm, key)
return JSON.parse(decipher.update(text,'base64','utf8') + decipher.final('utf8'));
}
export function bcrypt_password(password) {
return new Promise((done, error) => {
bcrypt.hash(password, 10, (err, hash) => {
if(err) return error(err)
done(hash);
})
});
}