Bug 1027595 - TypeError: deriveHawkCredentials is not a function after bug 1020859. r=jedp

This commit is contained in:
Fernando Jiménez 2014-06-21 07:43:39 +01:00
parent 4924bb2340
commit 7746ac6a1d
2 changed files with 6 additions and 3 deletions

View File

@ -117,13 +117,16 @@ HAWKAuthenticatedRESTRequest.prototype = {
* extra: size - 64 extra bytes (if size > 64)
* }
*/
function deriveHawkCredentials(tokenHex, context, size=96) {
this.deriveHawkCredentials = function deriveHawkCredentials(tokenHex,
context,
size = 96,
hexKey = false) {
let token = CommonUtils.hexToBytes(tokenHex);
let out = CryptoUtils.hkdf(token, undefined, Credentials.keyWord(context), size);
let result = {
algorithm: "sha256",
key: out.slice(32, 64),
key: hexKey ? CommonUtils.bytesAsHex(out.slice(32, 64)) : out.slice(32, 64),
id: CommonUtils.bytesAsHex(out.slice(0, 32))
};
if (size > 64) {

View File

@ -106,7 +106,7 @@ this.MobileIdentityClient.prototype = {
*/
_deriveHawkCredentials: function(aSessionToken) {
return deriveHawkCredentials(aSessionToken, CREDENTIALS_DERIVATION_INFO,
CREDENTIALS_DERIVATION_SIZE);
CREDENTIALS_DERIVATION_SIZE, true /*hexKey*/);
},
/**