Skip to content

Instantly share code, notes, and snippets.

@TimHeckel
Last active July 17, 2017 20:02
Show Gist options
  • Save TimHeckel/ead3a62da4b75f5383f6b9e90efed9b7 to your computer and use it in GitHub Desktop.
Save TimHeckel/ead3a62da4b75f5383f6b9e90efed9b7 to your computer and use it in GitHub Desktop.

Revisions

  1. TimHeckel revised this gist Jul 17, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion sif-3-authentication.js
    Original file line number Diff line number Diff line change
    @@ -5,5 +5,5 @@

    const _valToHash = _sessionToken + ":" + _timestamp;
    const _hash = CryptoJS.HmacSHA256(_valToHash, _secretKey).toString(CryptoJS.enc.Base64);
    const _authToken = CryptoJS.enc.Base64.stringify(CryptoJS.enc.Utf8.parse(_sessionKey + ":" + _hash));
    const _authToken = CryptoJS.enc.Base64.stringify(CryptoJS.enc.Utf8.parse(_sessionToken + ":" + _hash));
    return "SIF_HMACSHA256 " + _authToken;
  2. TimHeckel revised this gist Jul 17, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion sif-3-authentication.js
    Original file line number Diff line number Diff line change
    @@ -4,6 +4,6 @@
    const _secretKey = "YOUR_SECRET_KEY_HERE";

    const _valToHash = _sessionToken + ":" + _timestamp;
    const _hash = CryptoJS.HmacSHA256(_valToHash, _env.secretKey).toString(CryptoJS.enc.Base64);
    const _hash = CryptoJS.HmacSHA256(_valToHash, _secretKey).toString(CryptoJS.enc.Base64);
    const _authToken = CryptoJS.enc.Base64.stringify(CryptoJS.enc.Utf8.parse(_sessionKey + ":" + _hash));
    return "SIF_HMACSHA256 " + _authToken;
  3. TimHeckel created this gist Jul 17, 2017.
    9 changes: 9 additions & 0 deletions sif-3-authentication.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,9 @@
    const CryptoJS = require("CryptoJS");
    const _timestamp = new Date().toISOString();
    const _sessionToken = "YOUR_SESSION_TOKEN_HERE";
    const _secretKey = "YOUR_SECRET_KEY_HERE";

    const _valToHash = _sessionToken + ":" + _timestamp;
    const _hash = CryptoJS.HmacSHA256(_valToHash, _env.secretKey).toString(CryptoJS.enc.Base64);
    const _authToken = CryptoJS.enc.Base64.stringify(CryptoJS.enc.Utf8.parse(_sessionKey + ":" + _hash));
    return "SIF_HMACSHA256 " + _authToken;