@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 +2 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +2 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1894,8 +1894,7 @@ function toHex(bytes) {
|
|
|
1894
1894
|
return out;
|
|
1895
1895
|
}
|
|
1896
1896
|
function sign(secret, domain, payload) {
|
|
1897
|
-
|
|
1898
|
-
return toHex(hmac(sha256, encoder.encode(secret), encoder.encode(message)));
|
|
1897
|
+
return toHex(hmac(sha256, encoder.encode(secret), encoder.encode(`${domain}.${payload}`)));
|
|
1899
1898
|
}
|
|
1900
1899
|
function constantTimeEquals(a, b) {
|
|
1901
1900
|
if (a.length !== b.length) return false;
|
|
@@ -1904,7 +1903,7 @@ function constantTimeEquals(a, b) {
|
|
|
1904
1903
|
return diff === 0;
|
|
1905
1904
|
}
|
|
1906
1905
|
function signatureMatches(secret, domain, payload, provided) {
|
|
1907
|
-
return constantTimeEquals(provided, sign(secret, domain, payload))
|
|
1906
|
+
return constantTimeEquals(provided, sign(secret, domain, payload));
|
|
1908
1907
|
}
|
|
1909
1908
|
function encodePayload(value) {
|
|
1910
1909
|
return base64urlnopad.encode(encoder.encode(JSON.stringify(value)));
|