@zap-studio/webhooks 0.4.0 → 1.0.0
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/CHANGELOG.md +43 -28
- package/LICENSE +1 -1
- package/README.md +57 -142
- package/dist/errors.d.ts +16 -0
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +16 -0
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +3 -4
- package/dist/index.js +1 -2
- package/dist/router.d.ts +82 -25
- package/dist/router.d.ts.map +1 -1
- package/dist/router.js +103 -49
- package/dist/router.js.map +1 -1
- package/dist/types.d.ts +130 -6
- package/dist/types.d.ts.map +1 -1
- package/dist/verify.d.ts +5 -1
- package/dist/verify.d.ts.map +1 -1
- package/dist/verify.js +26 -6
- package/dist/verify.js.map +1 -1
- package/package.json +9 -10
- package/dist/utils.d.ts +0 -18
- package/dist/utils.d.ts.map +0 -1
- package/dist/utils.js +0 -24
- package/dist/utils.js.map +0 -1
package/dist/utils.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
//#region src/utils.d.ts
|
|
2
|
-
/**
|
|
3
|
-
* Utility helpers for webhook internals.
|
|
4
|
-
*
|
|
5
|
-
* @module @zap-studio/webhooks/utils
|
|
6
|
-
*/
|
|
7
|
-
/**
|
|
8
|
-
* Compares two strings in constant time to prevent timing attacks.
|
|
9
|
-
*
|
|
10
|
-
* @example
|
|
11
|
-
* ```ts
|
|
12
|
-
* const isEqual = constantTimeEquals("string1", "string2"); // returns false
|
|
13
|
-
* ```
|
|
14
|
-
*/
|
|
15
|
-
declare const constantTimeEquals: (a: string, b: string) => boolean;
|
|
16
|
-
//#endregion
|
|
17
|
-
export { constantTimeEquals };
|
|
18
|
-
//# sourceMappingURL=utils.d.ts.map
|
package/dist/utils.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","names":[],"sources":["../src/utils.ts"],"mappings":";;;;;;;;;;;;;;cAca,qBAAsB,WAAW"}
|
package/dist/utils.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
//#region src/utils.ts
|
|
2
|
-
/**
|
|
3
|
-
* Utility helpers for webhook internals.
|
|
4
|
-
*
|
|
5
|
-
* @module @zap-studio/webhooks/utils
|
|
6
|
-
*/
|
|
7
|
-
/**
|
|
8
|
-
* Compares two strings in constant time to prevent timing attacks.
|
|
9
|
-
*
|
|
10
|
-
* @example
|
|
11
|
-
* ```ts
|
|
12
|
-
* const isEqual = constantTimeEquals("string1", "string2"); // returns false
|
|
13
|
-
* ```
|
|
14
|
-
*/
|
|
15
|
-
const constantTimeEquals = (a, b) => {
|
|
16
|
-
if (a.length !== b.length) return false;
|
|
17
|
-
let result = 0;
|
|
18
|
-
for (let i = 0; i < a.length; i += 1) result |= a.charCodeAt(i) ^ b.charCodeAt(i);
|
|
19
|
-
return result === 0;
|
|
20
|
-
};
|
|
21
|
-
//#endregion
|
|
22
|
-
export { constantTimeEquals };
|
|
23
|
-
|
|
24
|
-
//# sourceMappingURL=utils.js.map
|
package/dist/utils.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","names":[],"sources":["../src/utils.ts"],"sourcesContent":["/**\n * Utility helpers for webhook internals.\n *\n * @module @zap-studio/webhooks/utils\n */\n\n/**\n * Compares two strings in constant time to prevent timing attacks.\n *\n * @example\n * ```ts\n * const isEqual = constantTimeEquals(\"string1\", \"string2\"); // returns false\n * ```\n */\nexport const constantTimeEquals = (a: string, b: string): boolean => {\n if (a.length !== b.length) {\n return false;\n }\n\n let result = 0;\n for (let i = 0; i < a.length; i += 1) {\n // oxlint-disable-next-line no-bitwise, unicorn/prefer-code-point -- XOR is the constant-time compare trick; charCodeAt reads each char with the same cost, and inputs are plain ASCII hex.\n result |= a.charCodeAt(i) ^ b.charCodeAt(i);\n }\n\n return result === 0;\n};\n"],"mappings":";;;;;;;;;;;;;;AAcA,MAAa,sBAAsB,GAAW,MAAuB;CACnE,IAAI,EAAE,WAAW,EAAE,QACjB,OAAO;CAGT,IAAI,SAAS;CACb,KAAK,IAAI,IAAI,GAAG,IAAI,EAAE,QAAQ,KAAK,GAEjC,UAAU,EAAE,WAAW,CAAC,IAAI,EAAE,WAAW,CAAC;CAG5C,OAAO,WAAW;AACpB"}
|