Skip to content

Instantly share code, notes, and snippets.

@warner
Created March 13, 2014 18:59
Show Gist options
  • Select an option

  • Save warner/9534612 to your computer and use it in GitHub Desktop.

Select an option

Save warner/9534612 to your computer and use it in GitHub Desktop.
FxAccountClient.prototype._passwordChangeFinish = function(email, newPassword, oldCreds) {
var self = this;
var newWrapKb;
var authPW;
var oldWrapKB;
var p1 = this.accountKeys(oldCreds.keyFetchToken, oldCreds.oldUnwrapBKey);
var p2 = credentials.setup(email, newPassword);
var p3 = hawkCredentials(oldCreds.passwordChangeToken, 'passwordChangeToken', 2 * 32);
Promise.all([p1, p2, p3])
.then(function(results) {
var keys = results[0];
var newCreds = results[1];
var hawkCreds = results[2];
var newWrapKb = sjcl.codec.hex.fromBits(
credentials.xor(keys.kB, newCreds.unwrapBKey)
);
return self.request.send('/password/change/finish', 'POST', hawkCreds, {
wrapKb: newWrapKb,
authPW: sjcl.codec.hex.fromBits(newCreds.authPW)
});
});
};
@vladikoff
Copy link
Copy Markdown

Promise.all([p1, p2, p3]) -> P.all([p1, p2, p3])

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment