current stand

This commit is contained in:
Myzel394 2022-12-28 18:51:52 +01:00
parent d3276e7e6e
commit e942740004

View File

@ -0,0 +1,16 @@
import * as CryptoJS from "crypto-js"
const SALT_SUFFIX = "accessing_data_you_are_not_allowed_to_is_a_crime"
export default async function getEncryptionPassword(
email: string,
password: string,
salt: string,
): Promise<CryptoJS.lib.WordArray> {
const cryptoSalt = `${salt}-${SALT_SUFFIX}`
const cryptoPassword = `${password}-${email}`
return CryptoJS.PBKDF2(cryptoPassword, cryptoSalt, {
keySize: 512 / 32,
})
}