Last active
December 13, 2015 03:24
-
-
Save lettergram/d23617ff44df65e9290d to your computer and use it in GitHub Desktop.
Get salt for keybase
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
// Step One: Salt | |
$.ajax({ | |
async: true, | |
type: 'GET', | |
url: "https://keybase.io/_/api/1.0/getsalt.json", | |
async: false, | |
data: {"email_or_username": username}, | |
success: function(salt) { | |
if(salt && salt.status && salt.status.name == "OK"){ | |
var scrypt = scrypt_module_factory(67108864); | |
var pwh = scrypt.crypto_scrypt(scrypt.encode_utf8(user_passphrase), | |
hex2bin(salt.salt), | |
Math.pow(2,15), 8, 1, 224).slice(192, 224); | |
var login_session = CryptoJS.enc.Base64.parse(salt.login_session); | |
var parsed_pwh = CryptoJS.enc.u8array.parse(pwh); | |
var hmac_pwh = CryptoJS.HmacSHA512(login_session, parsed_pwh); | |
hmac_pwh = CryptoJS.enc.Hex.stringify(hmac_pwh); | |
} | |
}, | |
error { | |
console.log(err + status); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment