@medialane/sdk 0.129.1 → 0.129.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1896,8 +1896,7 @@ function toHex(bytes) {
1896
1896
  return out;
1897
1897
  }
1898
1898
  function sign(secret, domain, payload) {
1899
- const message = domain === null ? payload : `${domain}.${payload}`;
1900
- return toHex(hmac_js.hmac(sha2_js.sha256, encoder.encode(secret), encoder.encode(message)));
1899
+ return toHex(hmac_js.hmac(sha2_js.sha256, encoder.encode(secret), encoder.encode(`${domain}.${payload}`)));
1901
1900
  }
1902
1901
  function constantTimeEquals(a, b) {
1903
1902
  if (a.length !== b.length) return false;
@@ -1906,7 +1905,7 @@ function constantTimeEquals(a, b) {
1906
1905
  return diff === 0;
1907
1906
  }
1908
1907
  function signatureMatches(secret, domain, payload, provided) {
1909
- return constantTimeEquals(provided, sign(secret, domain, payload)) || constantTimeEquals(provided, sign(secret, null, payload));
1908
+ return constantTimeEquals(provided, sign(secret, domain, payload));
1910
1909
  }
1911
1910
  function encodePayload(value) {
1912
1911
  return base.base64urlnopad.encode(encoder.encode(JSON.stringify(value)));