Created
December 5, 2017 23:34
-
-
Save dnewcome/1fe3387ad86c7b4b28db928ff984646d to your computer and use it in GitHub Desktop.
Nordstrom request signing
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
var CryptoJS = require("crypto-js"); | |
function pad(number) { | |
if (number<=999) { number = ("00"+number).slice(-3); } | |
return number; | |
} | |
var timestamp = (Math.floor(new Date() / 1000)) + "." + pad(new Date() % 1000); | |
var deviceId = "8A6A3699-1527-4E52-8441-7AA9AAD529F4"; | |
var path = "/v2/authorizationservice/shopperauth"; | |
var salt = "NOR1"; | |
var step1 = CryptoJS.HmacSHA256(timestamp, salt); | |
var step2 = CryptoJS.HmacSHA256(deviceId, step1); | |
var step3 = CryptoJS.HmacSHA256(path, step2).toString(CryptoJS.enc.Base64); | |
console.log('ts: ', timestamp); | |
console.log(step3); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment