mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-08 19:04:45 +00:00
Bug 1027595 - TypeError: deriveHawkCredentials is not a function after bug 1020859. r=jedp
This commit is contained in:
parent
5ca0b3c938
commit
fce1090b0d
@ -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) {
|
||||
|
@ -106,7 +106,7 @@ this.MobileIdentityClient.prototype = {
|
||||
*/
|
||||
_deriveHawkCredentials: function(aSessionToken) {
|
||||
return deriveHawkCredentials(aSessionToken, CREDENTIALS_DERIVATION_INFO,
|
||||
CREDENTIALS_DERIVATION_SIZE);
|
||||
CREDENTIALS_DERIVATION_SIZE, true /*hexKey*/);
|
||||
},
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user