You choose a Mastercode of your choice, for example: 1234.
This Mastercode is hashed (transformed into an irreversible string) and securely stored in Clerk.
Every password you save is combined with your Mastercode before encryption, for example:
There is internal logic where the Mastercode may modify the password (e.g., add characters if the password has numbers).
This separation enhances security by distributing critical components.
To decrypt a password, the system securely retrieves 3 things:
Decryption only happens after you sign in and enter the correct Mastercode.
Lock remains closed...
const hashedCode = await bcrypt.hash(code, 10);
const raw = JSON.stringify( ...newPassword, password: form.mastercode + 'V@u|t!y' + form.password, user: User?.user?.id );
const secretSalt = process.env.SECRET_SALT; // Extra security layer
// we cant disclose key and iv for security reason but they are formed using the mastercode
const cipher = crypto.createCipheriv(algorithm, key, iv);
let encrypted = cipher.update(body.password, "utf8", "hex");
encrypted += cipher.final("hex");
//We are sorry we cant disclose key and iv for security reason but they are formed using the mastercode
const decipher = crypto.createDecipheriv(algorithm, storedKey, providedIv);
let decrypted = decipher.update(element.password, "hex", "utf8");
decrypted += decipher.final("utf8");
return ...element, password: decrypted ;
Wanna Contribute Us, We Will Be So Thankful From Your Contributions