Created
May 30, 2023 14:52
-
-
Save BorisOsipov/9a0390d79565ac58504e2b29723b3b68 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function generateAuthenticationString(password, salt, challenge) { | |
const step1 = password + salt; | |
const step2 = sha256(step1); // SHA256 binary hash | |
const base64Secret = Buffer.from(step2, 'hex').toString('base64'); | |
const step3 = base64Secret + challenge; | |
const step4 = sha256(step3); // SHA256 binary hash | |
const authenticationString = Buffer.from(step4, 'hex').toString('base64'); | |
return authenticationString; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment