cmi-node 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.
Files changed (197) hide show
  1. package/LICENSE +21 -0
  2. package/dist/constants/confirmationModes.cjs +19 -0
  3. package/dist/constants/confirmationModes.d.ts +5 -0
  4. package/dist/constants/confirmationModes.d.ts.map +1 -0
  5. package/dist/constants/confirmationModes.js.map +1 -0
  6. package/dist/constants/confirmationModes.mjs +15 -0
  7. package/dist/constants/currencies.cjs +73 -0
  8. package/dist/constants/currencies.d.ts +219 -0
  9. package/dist/constants/currencies.d.ts.map +1 -0
  10. package/dist/constants/currencies.js.map +1 -0
  11. package/dist/constants/currencies.mjs +66 -0
  12. package/dist/constants/fields.cjs +54 -0
  13. package/dist/constants/fields.d.ts +9 -0
  14. package/dist/constants/fields.d.ts.map +1 -0
  15. package/dist/constants/fields.js.map +1 -0
  16. package/dist/constants/fields.mjs +48 -0
  17. package/dist/constants/index.cjs +7 -0
  18. package/dist/constants/index.d.ts +7 -0
  19. package/dist/constants/index.d.ts.map +1 -0
  20. package/dist/constants/index.js.map +1 -0
  21. package/dist/constants/index.mjs +7 -0
  22. package/dist/constants/languages.cjs +56 -0
  23. package/dist/constants/languages.d.ts +5 -0
  24. package/dist/constants/languages.d.ts.map +1 -0
  25. package/dist/constants/languages.js.map +1 -0
  26. package/dist/constants/languages.mjs +52 -0
  27. package/dist/constants/storeTypes.cjs +26 -0
  28. package/dist/constants/storeTypes.d.ts +5 -0
  29. package/dist/constants/storeTypes.d.ts.map +1 -0
  30. package/dist/constants/storeTypes.js.map +1 -0
  31. package/dist/constants/storeTypes.mjs +22 -0
  32. package/dist/constants/tranTypes.cjs +22 -0
  33. package/dist/constants/tranTypes.d.ts +5 -0
  34. package/dist/constants/tranTypes.d.ts.map +1 -0
  35. package/dist/constants/tranTypes.js.map +1 -0
  36. package/dist/constants/tranTypes.mjs +18 -0
  37. package/dist/core/CMIPaymentGateway.cjs +94 -0
  38. package/dist/core/CMIPaymentGateway.d.ts +29 -0
  39. package/dist/core/CMIPaymentGateway.d.ts.map +1 -0
  40. package/dist/core/CMIPaymentGateway.js.map +1 -0
  41. package/dist/core/CMIPaymentGateway.mjs +92 -0
  42. package/dist/core/CallbackHandler.cjs +92 -0
  43. package/dist/core/CallbackHandler.d.ts +16 -0
  44. package/dist/core/CallbackHandler.d.ts.map +1 -0
  45. package/dist/core/CallbackHandler.js.map +1 -0
  46. package/dist/core/CallbackHandler.mjs +90 -0
  47. package/dist/core/CallbackVerifier.cjs +92 -0
  48. package/dist/core/CallbackVerifier.d.ts +12 -0
  49. package/dist/core/CallbackVerifier.d.ts.map +1 -0
  50. package/dist/core/CallbackVerifier.js.map +1 -0
  51. package/dist/core/CallbackVerifier.mjs +90 -0
  52. package/dist/core/FormGenerator.cjs +44 -0
  53. package/dist/core/FormGenerator.d.ts +7 -0
  54. package/dist/core/FormGenerator.d.ts.map +1 -0
  55. package/dist/core/FormGenerator.js.map +1 -0
  56. package/dist/core/FormGenerator.mjs +42 -0
  57. package/dist/core/PaymentBuilder.cjs +63 -0
  58. package/dist/core/PaymentBuilder.d.ts +17 -0
  59. package/dist/core/PaymentBuilder.d.ts.map +1 -0
  60. package/dist/core/PaymentBuilder.js.map +1 -0
  61. package/dist/core/PaymentBuilder.mjs +61 -0
  62. package/dist/core/index.cjs +12 -0
  63. package/dist/core/index.d.ts +7 -0
  64. package/dist/core/index.d.ts.map +1 -0
  65. package/dist/core/index.js.map +1 -0
  66. package/dist/core/index.mjs +6 -0
  67. package/dist/index.cjs +44 -0
  68. package/dist/index.d.ts +12 -0
  69. package/dist/index.d.ts.map +1 -0
  70. package/dist/index.js.map +1 -0
  71. package/dist/index.mjs +11 -0
  72. package/dist/logger/index.cjs +55 -0
  73. package/dist/logger/index.d.ts +16 -0
  74. package/dist/logger/index.d.ts.map +1 -0
  75. package/dist/logger/index.js.map +1 -0
  76. package/dist/logger/index.mjs +51 -0
  77. package/dist/middleware/express.middleware.cjs +12 -0
  78. package/dist/middleware/express.middleware.d.ts +5 -0
  79. package/dist/middleware/express.middleware.d.ts.map +1 -0
  80. package/dist/middleware/express.middleware.js.map +1 -0
  81. package/dist/middleware/express.middleware.mjs +9 -0
  82. package/dist/middleware/fastify.helper.cjs +25 -0
  83. package/dist/middleware/fastify.helper.d.ts +6 -0
  84. package/dist/middleware/fastify.helper.d.ts.map +1 -0
  85. package/dist/middleware/fastify.helper.js.map +1 -0
  86. package/dist/middleware/fastify.helper.mjs +22 -0
  87. package/dist/middleware/hono.helper.cjs +32 -0
  88. package/dist/middleware/hono.helper.d.ts +6 -0
  89. package/dist/middleware/hono.helper.d.ts.map +1 -0
  90. package/dist/middleware/hono.helper.js.map +1 -0
  91. package/dist/middleware/hono.helper.mjs +29 -0
  92. package/dist/middleware/index.cjs +6 -0
  93. package/dist/middleware/index.d.ts +6 -0
  94. package/dist/middleware/index.d.ts.map +1 -0
  95. package/dist/middleware/index.js.map +1 -0
  96. package/dist/middleware/index.mjs +6 -0
  97. package/dist/middleware/nestjs.helper.cjs +33 -0
  98. package/dist/middleware/nestjs.helper.d.ts +10 -0
  99. package/dist/middleware/nestjs.helper.d.ts.map +1 -0
  100. package/dist/middleware/nestjs.helper.js.map +1 -0
  101. package/dist/middleware/nestjs.helper.mjs +30 -0
  102. package/dist/middleware/nextjs.helper.cjs +44 -0
  103. package/dist/middleware/nextjs.helper.d.ts +4 -0
  104. package/dist/middleware/nextjs.helper.d.ts.map +1 -0
  105. package/dist/middleware/nextjs.helper.js.map +1 -0
  106. package/dist/middleware/nextjs.helper.mjs +42 -0
  107. package/dist/types/callback-handler.types.cjs +2 -0
  108. package/dist/types/callback-handler.types.d.ts +28 -0
  109. package/dist/types/callback-handler.types.d.ts.map +1 -0
  110. package/dist/types/callback-handler.types.js.map +1 -0
  111. package/dist/types/callback-handler.types.mjs +2 -0
  112. package/dist/types/callback.types.cjs +2 -0
  113. package/dist/types/callback.types.d.ts +14 -0
  114. package/dist/types/callback.types.d.ts.map +1 -0
  115. package/dist/types/callback.types.js.map +1 -0
  116. package/dist/types/callback.types.mjs +2 -0
  117. package/dist/types/config.types.cjs +2 -0
  118. package/dist/types/config.types.d.ts +11 -0
  119. package/dist/types/config.types.d.ts.map +1 -0
  120. package/dist/types/config.types.js.map +1 -0
  121. package/dist/types/config.types.mjs +2 -0
  122. package/dist/types/confirmation-mode.types.cjs +2 -0
  123. package/dist/types/confirmation-mode.types.d.ts +2 -0
  124. package/dist/types/confirmation-mode.types.d.ts.map +1 -0
  125. package/dist/types/confirmation-mode.types.js.map +1 -0
  126. package/dist/types/confirmation-mode.types.mjs +2 -0
  127. package/dist/types/gateway.types.cjs +2 -0
  128. package/dist/types/gateway.types.d.ts +16 -0
  129. package/dist/types/gateway.types.d.ts.map +1 -0
  130. package/dist/types/gateway.types.js.map +1 -0
  131. package/dist/types/gateway.types.mjs +2 -0
  132. package/dist/types/index.cjs +6 -0
  133. package/dist/types/index.d.ts +6 -0
  134. package/dist/types/index.d.ts.map +1 -0
  135. package/dist/types/index.js.map +1 -0
  136. package/dist/types/index.mjs +6 -0
  137. package/dist/types/payment.types.cjs +2 -0
  138. package/dist/types/payment.types.d.ts +29 -0
  139. package/dist/types/payment.types.d.ts.map +1 -0
  140. package/dist/types/payment.types.js.map +1 -0
  141. package/dist/types/payment.types.mjs +2 -0
  142. package/dist/utils/crypto/index.cjs +2 -0
  143. package/dist/utils/crypto/index.d.ts +2 -0
  144. package/dist/utils/crypto/index.d.ts.map +1 -0
  145. package/dist/utils/crypto/index.js.map +1 -0
  146. package/dist/utils/crypto/index.mjs +2 -0
  147. package/dist/utils/crypto/timing-safe.util.cjs +23 -0
  148. package/dist/utils/crypto/timing-safe.util.d.ts +3 -0
  149. package/dist/utils/crypto/timing-safe.util.d.ts.map +1 -0
  150. package/dist/utils/crypto/timing-safe.util.js.map +1 -0
  151. package/dist/utils/crypto/timing-safe.util.mjs +20 -0
  152. package/dist/utils/formatter.util.cjs +42 -0
  153. package/dist/utils/formatter.util.d.ts +9 -0
  154. package/dist/utils/formatter.util.d.ts.map +1 -0
  155. package/dist/utils/formatter.util.js.map +1 -0
  156. package/dist/utils/formatter.util.mjs +40 -0
  157. package/dist/utils/generator.util.cjs +14 -0
  158. package/dist/utils/generator.util.d.ts +5 -0
  159. package/dist/utils/generator.util.d.ts.map +1 -0
  160. package/dist/utils/generator.util.js.map +1 -0
  161. package/dist/utils/generator.util.mjs +12 -0
  162. package/dist/utils/hash.util.cjs +42 -0
  163. package/dist/utils/hash.util.d.ts +4 -0
  164. package/dist/utils/hash.util.d.ts.map +1 -0
  165. package/dist/utils/hash.util.js.map +1 -0
  166. package/dist/utils/hash.util.mjs +40 -0
  167. package/dist/utils/index.cjs +6 -0
  168. package/dist/utils/index.d.ts +6 -0
  169. package/dist/utils/index.d.ts.map +1 -0
  170. package/dist/utils/index.js.map +1 -0
  171. package/dist/utils/index.mjs +6 -0
  172. package/dist/utils/sanitization.util.cjs +26 -0
  173. package/dist/utils/sanitization.util.d.ts +6 -0
  174. package/dist/utils/sanitization.util.d.ts.map +1 -0
  175. package/dist/utils/sanitization.util.js.map +1 -0
  176. package/dist/utils/sanitization.util.mjs +24 -0
  177. package/dist/validators/config.validator.cjs +53 -0
  178. package/dist/validators/config.validator.d.ts +8 -0
  179. package/dist/validators/config.validator.d.ts.map +1 -0
  180. package/dist/validators/config.validator.js.map +1 -0
  181. package/dist/validators/config.validator.mjs +51 -0
  182. package/dist/validators/index.cjs +4 -0
  183. package/dist/validators/index.d.ts +4 -0
  184. package/dist/validators/index.d.ts.map +1 -0
  185. package/dist/validators/index.js.map +1 -0
  186. package/dist/validators/index.mjs +4 -0
  187. package/dist/validators/payment.validator.cjs +161 -0
  188. package/dist/validators/payment.validator.d.ts +7 -0
  189. package/dist/validators/payment.validator.d.ts.map +1 -0
  190. package/dist/validators/payment.validator.js.map +1 -0
  191. package/dist/validators/payment.validator.mjs +159 -0
  192. package/dist/validators/validator.cjs +50 -0
  193. package/dist/validators/validator.d.ts +10 -0
  194. package/dist/validators/validator.d.ts.map +1 -0
  195. package/dist/validators/validator.js.map +1 -0
  196. package/dist/validators/validator.mjs +48 -0
  197. package/package.json +88 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"callback.types.js","sourceRoot":"","sources":["../../src/types/callback.types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=callback.types.js.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=config.types.js.map
@@ -0,0 +1,11 @@
1
+ import { StoreType } from "../constants/index.js";
2
+ export interface PaymentConfig {
3
+ storeKey: string;
4
+ clientId: string;
5
+ gatewayUrl: string;
6
+ storetype: StoreType;
7
+ trantype: string;
8
+ shopUrl: string;
9
+ callbackUrl?: string;
10
+ }
11
+ //# sourceMappingURL=config.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.types.d.ts","sourceRoot":"","sources":["../../src/types/config.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAgBvC,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,SAAS,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.types.js","sourceRoot":"","sources":["../../src/types/config.types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=config.types.js.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=confirmation-mode.types.js.map
@@ -0,0 +1,2 @@
1
+ export type { ConfirmationMode, CallbackMiddleware, CMIPaymentGatewayOptions } from './gateway.types.js';
2
+ //# sourceMappingURL=confirmation-mode.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"confirmation-mode.types.d.ts","sourceRoot":"","sources":["../../src/types/confirmation-mode.types.ts"],"names":[],"mappings":"AAUA,YAAY,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"confirmation-mode.types.js","sourceRoot":"","sources":["../../src/types/confirmation-mode.types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=confirmation-mode.types.js.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=gateway.types.js.map
@@ -0,0 +1,16 @@
1
+ import { CallbackResult } from './callback.types.js';
2
+ export type ConfirmationMode = 'auto' | 'manual';
3
+ export type CallbackMiddleware = (req: any, res: any, next?: any) => Promise<void>;
4
+ export interface CMIPaymentGatewayOptions {
5
+ app?: any;
6
+ callbackPath?: string;
7
+ callbackConfig?: {
8
+ onSuccess?: (result: CallbackResult) => Promise<void> | void;
9
+ onFailure?: (result: CallbackResult) => Promise<void> | void;
10
+ autoRespond?: boolean;
11
+ successResponse?: string;
12
+ failureResponse?: string;
13
+ supportGetMethod?: boolean;
14
+ };
15
+ }
16
+ //# sourceMappingURL=gateway.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gateway.types.d.ts","sourceRoot":"","sources":["../../src/types/gateway.types.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAQlD,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,QAAQ,CAAC;AAYjD,MAAM,MAAM,kBAAkB,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,CAAC,EAAE,GAAG,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AAKnF,MAAM,WAAW,wBAAwB;IAOrC,GAAG,CAAC,EAAE,GAAG,CAAC;IAMV,YAAY,CAAC,EAAE,MAAM,CAAC;IAKtB,cAAc,CAAC,EAAE;QAIb,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,cAAc,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;QAK7D,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,cAAc,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;QAM7D,WAAW,CAAC,EAAE,OAAO,CAAC;QAMtB,eAAe,CAAC,EAAE,MAAM,CAAC;QAMzB,eAAe,CAAC,EAAE,MAAM,CAAC;QAMzB,gBAAgB,CAAC,EAAE,OAAO,CAAC;KAC9B,CAAC;CACL"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gateway.types.js","sourceRoot":"","sources":["../../src/types/gateway.types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=gateway.types.js.map
@@ -0,0 +1,6 @@
1
+ Object.assign(module.exports, require("./callback.types.cjs"));;
2
+ Object.assign(module.exports, require("./callback-handler.types.cjs"));;
3
+ Object.assign(module.exports, require("./config.types.cjs"));;
4
+ Object.assign(module.exports, require("./payment.types.cjs"));;
5
+ Object.assign(module.exports, require("./gateway.types.cjs"));;
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,6 @@
1
+ export * from "./callback.types.js";
2
+ export * from "./callback-handler.types.js";
3
+ export * from "./config.types.js";
4
+ export * from "./payment.types.js";
5
+ export * from "./gateway.types.js";
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAEA,cAAc,kBAAkB,CAAC;AACjC,cAAc,0BAA0B,CAAC;AACzC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAEA,cAAc,kBAAkB,CAAC;AACjC,cAAc,0BAA0B,CAAC;AACzC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC"}
@@ -0,0 +1,6 @@
1
+ export * from './callback.types.mjs';
2
+ export * from './callback-handler.types.mjs';
3
+ export * from './config.types.mjs';
4
+ export * from './payment.types.mjs';
5
+ export * from './gateway.types.mjs';
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=payment.types.js.map
@@ -0,0 +1,29 @@
1
+ import { CurrencyCode } from "../constants/index.js";
2
+ import { Language } from "../constants/index.js";
3
+ export type CurrencyInput = CurrencyCode | string;
4
+ export interface PaymentRequest {
5
+ amount: number | string;
6
+ oid?: string;
7
+ okUrl: string;
8
+ failUrl: string;
9
+ shopUrl: string;
10
+ email: string;
11
+ BillToName: string;
12
+ currency: CurrencyInput;
13
+ lang?: Language;
14
+ hashAlgorithm?: string;
15
+ tel?: string;
16
+ rnd?: string;
17
+ encoding?: string;
18
+ AutoRedirect?: boolean;
19
+ BillToCity?: string;
20
+ BillToCountry?: string;
21
+ BillToStreet1?: string;
22
+ BillToStateProv?: string;
23
+ BillToPostalCode?: string;
24
+ BillToTelVoice?: string;
25
+ amountCur?: number;
26
+ symbolCur?: string;
27
+ [key: string]: any;
28
+ }
29
+ //# sourceMappingURL=payment.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"payment.types.d.ts","sourceRoot":"","sources":["../../src/types/payment.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,MAAM,MAAM,aAAa,GAAG,YAAY,GAAG,MAAM,CAAC;AAElD,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,aAAa,CAAC;IACxB,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"payment.types.js","sourceRoot":"","sources":["../../src/types/payment.types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=payment.types.js.map
@@ -0,0 +1,2 @@
1
+ Object.assign(module.exports, require("./timing-safe.util.cjs"));;
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,2 @@
1
+ export * from './timing-safe.util.js';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/crypto/index.ts"],"names":[],"mappings":"AAMA,cAAc,oBAAoB,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/crypto/index.ts"],"names":[],"mappings":"AAMA,cAAc,oBAAoB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './timing-safe.util.mjs';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,23 @@
1
+ import crypto from 'crypto';
2
+ function timingSafeCompare(a, b) {
3
+ try {
4
+ const bufA = Buffer.from(a, 'utf8');
5
+ const bufB = Buffer.from(b, 'utf8');
6
+ if (bufA.length !== bufB.length) {
7
+ crypto.timingSafeEqual(bufA, bufA);
8
+ return false;
9
+ }
10
+ return crypto.timingSafeEqual(bufA, bufB);
11
+ }
12
+ catch {
13
+ return false;
14
+ }
15
+ }
16
+ function sha512Base64(data) {
17
+ const hash = crypto.createHash('sha512').update(data, 'utf8').digest('hex');
18
+ return Buffer.from(hash, 'hex').toString('base64');
19
+ }
20
+ //# sourceMappingURL=timing-safe.util.js.map
21
+
22
+ module.exports.timingSafeCompare = timingSafeCompare;
23
+ module.exports.sha512Base64 = sha512Base64;
@@ -0,0 +1,3 @@
1
+ export declare function timingSafeCompare(a: string, b: string): boolean;
2
+ export declare function sha512Base64(data: string): string;
3
+ //# sourceMappingURL=timing-safe.util.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"timing-safe.util.d.ts","sourceRoot":"","sources":["../../../src/utils/crypto/timing-safe.util.ts"],"names":[],"mappings":"AAqBA,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,OAAO,CAgB/D;AAQD,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAGjD"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"timing-safe.util.js","sourceRoot":"","sources":["../../../src/utils/crypto/timing-safe.util.ts"],"names":[],"mappings":"AAMA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAe5B,MAAM,UAAU,iBAAiB,CAAC,CAAS,EAAE,CAAS;IAClD,IAAI,CAAC;QACD,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;QACpC,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;QAGpC,IAAI,IAAI,CAAC,MAAM,KAAK,IAAI,CAAC,MAAM,EAAE,CAAC;YAE9B,MAAM,CAAC,eAAe,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;YACnC,OAAO,KAAK,CAAC;QACjB,CAAC;QAED,OAAO,MAAM,CAAC,eAAe,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAC9C,CAAC;IAAC,MAAM,CAAC;QACL,OAAO,KAAK,CAAC;IACjB,CAAC;AACL,CAAC;AAQD,MAAM,UAAU,YAAY,CAAC,IAAY;IACrC,MAAM,IAAI,GAAG,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAC5E,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;AACvD,CAAC"}
@@ -0,0 +1,20 @@
1
+ import crypto from 'crypto';
2
+ export function timingSafeCompare(a, b) {
3
+ try {
4
+ const bufA = Buffer.from(a, 'utf8');
5
+ const bufB = Buffer.from(b, 'utf8');
6
+ if (bufA.length !== bufB.length) {
7
+ crypto.timingSafeEqual(bufA, bufA);
8
+ return false;
9
+ }
10
+ return crypto.timingSafeEqual(bufA, bufB);
11
+ }
12
+ catch {
13
+ return false;
14
+ }
15
+ }
16
+ export function sha512Base64(data) {
17
+ const hash = crypto.createHash('sha512').update(data, 'utf8').digest('hex');
18
+ return Buffer.from(hash, 'hex').toString('base64');
19
+ }
20
+ //# sourceMappingURL=timing-safe.util.js.map
@@ -0,0 +1,42 @@
1
+ const { normalizeCurrency, normalizeCurrencyCode } = require("../constants/currencies.cjs");
2
+ class FormatterUtil {
3
+ static formatAmount(amount) {
4
+ if (typeof amount === 'number') {
5
+ if (isNaN(amount) || !isFinite(amount)) {
6
+ throw new Error('Amount must be a valid finite number');
7
+ }
8
+ return amount.toFixed(2);
9
+ }
10
+ const trimmedAmount = amount.trim();
11
+ if (!/^-?\d*\.?\d+$/.test(trimmedAmount)) {
12
+ throw new Error(`Invalid amount format: "${amount}". Amount must contain only numeric characters (e.g., "220" or "220.50")`);
13
+ }
14
+ const parsedAmount = parseFloat(trimmedAmount);
15
+ if (isNaN(parsedAmount) || !isFinite(parsedAmount)) {
16
+ throw new Error(`Invalid amount: "${amount}". Could not parse as a valid number.`);
17
+ }
18
+ return parsedAmount.toFixed(2);
19
+ }
20
+ static formatAutoRedirect(autoRedirect) {
21
+ if (autoRedirect === undefined)
22
+ return "false";
23
+ return autoRedirect ? "true" : "false";
24
+ }
25
+ static formatStoreType(storeType) {
26
+ return storeType.toLowerCase();
27
+ }
28
+ static formatCurrencyCode(currencyCode) {
29
+ return normalizeCurrencyCode(currencyCode) || "";
30
+ }
31
+ static formatCurrencyNumeric(currencyNumeric) {
32
+ return normalizeCurrency(currencyNumeric) || "";
33
+ }
34
+ static formatLanguage(lang) {
35
+ if (!lang)
36
+ return "fr";
37
+ return lang.toLowerCase();
38
+ }
39
+ }
40
+ //# sourceMappingURL=formatter.util.js.map
41
+
42
+ module.exports.FormatterUtil = FormatterUtil;
@@ -0,0 +1,9 @@
1
+ export declare class FormatterUtil {
2
+ static formatAmount(amount: number | string): string;
3
+ static formatAutoRedirect(autoRedirect: boolean | undefined): string;
4
+ static formatStoreType(storeType: string): string;
5
+ static formatCurrencyCode(currencyCode: string): string;
6
+ static formatCurrencyNumeric(currencyNumeric: string): string;
7
+ static formatLanguage(lang: string | undefined): string;
8
+ }
9
+ //# sourceMappingURL=formatter.util.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formatter.util.d.ts","sourceRoot":"","sources":["../../src/utils/formatter.util.ts"],"names":[],"mappings":"AAEA,qBAAa,aAAa;IAQxB,MAAM,CAAC,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM;IA6BpD,MAAM,CAAC,kBAAkB,CAAC,YAAY,EAAE,OAAO,GAAG,SAAS,GAAG,MAAM;IAKpE,MAAM,CAAC,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM;IAIjD,MAAM,CAAC,kBAAkB,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM;IAIvD,MAAM,CAAC,qBAAqB,CAAC,eAAe,EAAE,MAAM,GAAG,MAAM;IAI7D,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM;CAIxD"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formatter.util.js","sourceRoot":"","sources":["../../src/utils/formatter.util.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAEjF,MAAM,OAAO,aAAa;IAQxB,MAAM,CAAC,YAAY,CAAC,MAAuB;QAEzC,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;YAC/B,IAAI,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;gBACvC,MAAM,IAAI,KAAK,CAAC,sCAAsC,CAAC,CAAC;YAC1D,CAAC;YACD,OAAO,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QAC3B,CAAC;QAGD,MAAM,aAAa,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC;QAGpC,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,aAAa,CAAC,EAAE,CAAC;YACzC,MAAM,IAAI,KAAK,CACb,2BAA2B,MAAM,0EAA0E,CAC5G,CAAC;QACJ,CAAC;QAGD,MAAM,YAAY,GAAG,UAAU,CAAC,aAAa,CAAC,CAAC;QAE/C,IAAI,KAAK,CAAC,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC;YACnD,MAAM,IAAI,KAAK,CAAC,oBAAoB,MAAM,uCAAuC,CAAC,CAAC;QACrF,CAAC;QAED,OAAO,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IACjC,CAAC;IAED,MAAM,CAAC,kBAAkB,CAAC,YAAiC;QACzD,IAAI,YAAY,KAAK,SAAS;YAAE,OAAO,OAAO,CAAC;QAC/C,OAAO,YAAY,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC;IACzC,CAAC;IAED,MAAM,CAAC,eAAe,CAAC,SAAiB;QACtC,OAAO,SAAS,CAAC,WAAW,EAAE,CAAC;IACjC,CAAC;IAED,MAAM,CAAC,kBAAkB,CAAC,YAAoB;QAC5C,OAAO,qBAAqB,CAAC,YAAY,CAAC,IAAI,EAAE,CAAC;IACnD,CAAC;IAED,MAAM,CAAC,qBAAqB,CAAC,eAAuB;QAClD,OAAO,iBAAiB,CAAC,eAAe,CAAC,IAAI,EAAE,CAAC;IAClD,CAAC;IAED,MAAM,CAAC,cAAc,CAAC,IAAwB;QAC5C,IAAI,CAAC,IAAI;YAAE,OAAO,IAAI,CAAC;QACvB,OAAO,IAAI,CAAC,WAAW,EAAE,CAAC;IAC5B,CAAC;CACF"}
@@ -0,0 +1,40 @@
1
+ import { normalizeCurrency, normalizeCurrencyCode } from '../constants/currencies.mjs';
2
+ export class FormatterUtil {
3
+ static formatAmount(amount) {
4
+ if (typeof amount === 'number') {
5
+ if (isNaN(amount) || !isFinite(amount)) {
6
+ throw new Error('Amount must be a valid finite number');
7
+ }
8
+ return amount.toFixed(2);
9
+ }
10
+ const trimmedAmount = amount.trim();
11
+ if (!/^-?\d*\.?\d+$/.test(trimmedAmount)) {
12
+ throw new Error(`Invalid amount format: "${amount}". Amount must contain only numeric characters (e.g., "220" or "220.50")`);
13
+ }
14
+ const parsedAmount = parseFloat(trimmedAmount);
15
+ if (isNaN(parsedAmount) || !isFinite(parsedAmount)) {
16
+ throw new Error(`Invalid amount: "${amount}". Could not parse as a valid number.`);
17
+ }
18
+ return parsedAmount.toFixed(2);
19
+ }
20
+ static formatAutoRedirect(autoRedirect) {
21
+ if (autoRedirect === undefined)
22
+ return "false";
23
+ return autoRedirect ? "true" : "false";
24
+ }
25
+ static formatStoreType(storeType) {
26
+ return storeType.toLowerCase();
27
+ }
28
+ static formatCurrencyCode(currencyCode) {
29
+ return normalizeCurrencyCode(currencyCode) || "";
30
+ }
31
+ static formatCurrencyNumeric(currencyNumeric) {
32
+ return normalizeCurrency(currencyNumeric) || "";
33
+ }
34
+ static formatLanguage(lang) {
35
+ if (!lang)
36
+ return "fr";
37
+ return lang.toLowerCase();
38
+ }
39
+ }
40
+ //# sourceMappingURL=formatter.util.js.map
@@ -0,0 +1,14 @@
1
+ import crypto from "crypto";
2
+ class GeneratorUtil {
3
+ static generateOrderId() {
4
+ const timestamp = Date.now();
5
+ const random = crypto.randomBytes(4).toString('hex').toUpperCase();
6
+ return `ORD-${timestamp}-${random}`;
7
+ }
8
+ static generateRandom() {
9
+ return crypto.randomBytes(16).toString('hex');
10
+ }
11
+ }
12
+ //# sourceMappingURL=generator.util.js.map
13
+
14
+ module.exports.GeneratorUtil = GeneratorUtil;
@@ -0,0 +1,5 @@
1
+ export declare class GeneratorUtil {
2
+ static generateOrderId(): string;
3
+ static generateRandom(): string;
4
+ }
5
+ //# sourceMappingURL=generator.util.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generator.util.d.ts","sourceRoot":"","sources":["../../src/utils/generator.util.ts"],"names":[],"mappings":"AAEA,qBAAa,aAAa;IACxB,MAAM,CAAC,eAAe,IAAI,MAAM;IAMhC,MAAM,CAAC,cAAc,IAAI,MAAM;CAGhC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generator.util.js","sourceRoot":"","sources":["../../src/utils/generator.util.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,MAAM,OAAO,aAAa;IACxB,MAAM,CAAC,eAAe;QACpB,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QAC7B,MAAM,MAAM,GAAG,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,WAAW,EAAE,CAAC;QACnE,OAAO,OAAO,SAAS,IAAI,MAAM,EAAE,CAAC;IACtC,CAAC;IAED,MAAM,CAAC,cAAc;QACnB,OAAO,MAAM,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAChD,CAAC;CACF"}
@@ -0,0 +1,12 @@
1
+ import crypto from "crypto";
2
+ export class GeneratorUtil {
3
+ static generateOrderId() {
4
+ const timestamp = Date.now();
5
+ const random = crypto.randomBytes(4).toString('hex').toUpperCase();
6
+ return `ORD-${timestamp}-${random}`;
7
+ }
8
+ static generateRandom() {
9
+ return crypto.randomBytes(16).toString('hex');
10
+ }
11
+ }
12
+ //# sourceMappingURL=generator.util.js.map
@@ -0,0 +1,42 @@
1
+ import crypto from "crypto";
2
+ const { SanitizationUtil } = require("./index.cjs");
3
+ const { HASH_SANITIZE_FIELDS } = require("../constants/fields.cjs");
4
+ class HashUtil {
5
+ static generate(params, storeKey) {
6
+ try {
7
+ const sortedKeys = Object.keys(params).sort((a, b) => a.toLowerCase().localeCompare(b.toLowerCase()));
8
+ const sanitizeFields = new Set(HASH_SANITIZE_FIELDS);
9
+ let hashval = "";
10
+ const hashParts = [];
11
+ for (const key of sortedKeys) {
12
+ const lowerKey = key.toLowerCase();
13
+ if (lowerKey !== "hash" && lowerKey !== "encoding") {
14
+ let paramValue = String(params[key] ?? "").trim();
15
+ if (sanitizeFields.has(key)) {
16
+ paramValue = SanitizationUtil.sanitizeString(paramValue);
17
+ }
18
+ const escapedValue = paramValue
19
+ .replace(/\\/g, "\\\\")
20
+ .replace(/\|/g, "\\|");
21
+ hashval += escapedValue + "|";
22
+ hashParts.push(`${key}=${escapedValue}`);
23
+ }
24
+ }
25
+ const escapedStoreKey = storeKey
26
+ .replace(/\\/g, "\\\\")
27
+ .replace(/\|/g, "\\|");
28
+ hashval += escapedStoreKey;
29
+ const calculatedHash = crypto
30
+ .createHash("sha512")
31
+ .update(hashval, "utf8")
32
+ .digest("hex");
33
+ return Buffer.from(calculatedHash, "hex").toString("base64");
34
+ }
35
+ catch (error) {
36
+ throw new Error(`Hash generation failed: ${error instanceof Error ? error.message : "Unknown error"}`);
37
+ }
38
+ }
39
+ }
40
+ //# sourceMappingURL=hash.util.js.map
41
+
42
+ module.exports.HashUtil = HashUtil;
@@ -0,0 +1,4 @@
1
+ export declare class HashUtil {
2
+ static generate(params: Record<string, any>, storeKey: string): string;
3
+ }
4
+ //# sourceMappingURL=hash.util.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hash.util.d.ts","sourceRoot":"","sources":["../../src/utils/hash.util.ts"],"names":[],"mappings":"AAIA,qBAAa,QAAQ;IAEnB,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM;CAoDvE"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hash.util.js","sourceRoot":"","sources":["../../src/utils/hash.util.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AAC1C,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAEzD,MAAM,OAAO,QAAQ;IAEnB,MAAM,CAAC,QAAQ,CAAC,MAA2B,EAAE,QAAgB;QAC3D,IAAI,CAAC;YACH,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CACnD,CAAC,CAAC,WAAW,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,CAC/C,CAAC;YAGF,MAAM,cAAc,GAAgB,IAAI,GAAG,CAAC,oBAAoB,CAAC,CAAC;YAElE,IAAI,OAAO,GAAG,EAAE,CAAC;YACjB,MAAM,SAAS,GAAa,EAAE,CAAC;YAE/B,KAAK,MAAM,GAAG,IAAI,UAAU,EAAE,CAAC;gBAC7B,MAAM,QAAQ,GAAG,GAAG,CAAC,WAAW,EAAE,CAAC;gBACnC,IAAI,QAAQ,KAAK,MAAM,IAAI,QAAQ,KAAK,UAAU,EAAE,CAAC;oBACnD,IAAI,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;oBAGlD,IAAI,cAAc,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;wBAC5B,UAAU,GAAG,gBAAgB,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC;oBAC3D,CAAC;oBAED,MAAM,YAAY,GAAG,UAAU;yBAC5B,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC;yBACtB,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;oBACzB,OAAO,IAAI,YAAY,GAAG,GAAG,CAAC;oBAC9B,SAAS,CAAC,IAAI,CAAC,GAAG,GAAG,IAAI,YAAY,EAAE,CAAC,CAAC;gBAC3C,CAAC;YACH,CAAC;YAED,MAAM,eAAe,GAAG,QAAQ;iBAC7B,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC;iBACtB,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;YACzB,OAAO,IAAI,eAAe,CAAC;YAI3B,MAAM,cAAc,GAAG,MAAM;iBAC1B,UAAU,CAAC,QAAQ,CAAC;iBACpB,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC;iBACvB,MAAM,CAAC,KAAK,CAAC,CAAC;YAIjB,OAAO,MAAM,CAAC,IAAI,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;QAC/D,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,IAAI,KAAK,CACb,2BAA2B,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,EAAE,CACtF,CAAC;QACJ,CAAC;IACH,CAAC;CAEF"}
@@ -0,0 +1,40 @@
1
+ import crypto from "crypto";
2
+ import { SanitizationUtil } from './index.mjs';
3
+ import { HASH_SANITIZE_FIELDS } from '../constants/fields.mjs';
4
+ export class HashUtil {
5
+ static generate(params, storeKey) {
6
+ try {
7
+ const sortedKeys = Object.keys(params).sort((a, b) => a.toLowerCase().localeCompare(b.toLowerCase()));
8
+ const sanitizeFields = new Set(HASH_SANITIZE_FIELDS);
9
+ let hashval = "";
10
+ const hashParts = [];
11
+ for (const key of sortedKeys) {
12
+ const lowerKey = key.toLowerCase();
13
+ if (lowerKey !== "hash" && lowerKey !== "encoding") {
14
+ let paramValue = String(params[key] ?? "").trim();
15
+ if (sanitizeFields.has(key)) {
16
+ paramValue = SanitizationUtil.sanitizeString(paramValue);
17
+ }
18
+ const escapedValue = paramValue
19
+ .replace(/\\/g, "\\\\")
20
+ .replace(/\|/g, "\\|");
21
+ hashval += escapedValue + "|";
22
+ hashParts.push(`${key}=${escapedValue}`);
23
+ }
24
+ }
25
+ const escapedStoreKey = storeKey
26
+ .replace(/\\/g, "\\\\")
27
+ .replace(/\|/g, "\\|");
28
+ hashval += escapedStoreKey;
29
+ const calculatedHash = crypto
30
+ .createHash("sha512")
31
+ .update(hashval, "utf8")
32
+ .digest("hex");
33
+ return Buffer.from(calculatedHash, "hex").toString("base64");
34
+ }
35
+ catch (error) {
36
+ throw new Error(`Hash generation failed: ${error instanceof Error ? error.message : "Unknown error"}`);
37
+ }
38
+ }
39
+ }
40
+ //# sourceMappingURL=hash.util.js.map
@@ -0,0 +1,6 @@
1
+ Object.assign(module.exports, require("./hash.util.cjs"));;
2
+ Object.assign(module.exports, require("./sanitization.util.cjs"));;
3
+ Object.assign(module.exports, require("./formatter.util.cjs"));;
4
+ Object.assign(module.exports, require("./generator.util.cjs"));;
5
+ Object.assign(module.exports, require("./crypto/index.cjs"));;
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,6 @@
1
+ export * from './hash.util.js';
2
+ export * from './sanitization.util.js';
3
+ export * from './formatter.util.js';
4
+ export * from './generator.util.js';
5
+ export * from './crypto/index.js';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,UAAU,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,UAAU,CAAC"}
@@ -0,0 +1,6 @@
1
+ export * from './hash.util.mjs';
2
+ export * from './sanitization.util.mjs';
3
+ export * from './formatter.util.mjs';
4
+ export * from './generator.util.mjs';
5
+ export * from './crypto/index.mjs';
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,26 @@
1
+ class SanitizationUtil {
2
+ static sanitizeString(str, maxLength = 255) {
3
+ if (!str)
4
+ return "";
5
+ return String(str)
6
+ .trim()
7
+ .replace(/[<>'"]/g, "")
8
+ .substring(0, maxLength);
9
+ }
10
+ static sanitizeEmail(email) {
11
+ return email.trim().toLowerCase().substring(0, 100);
12
+ }
13
+ static escapeHtml(str) {
14
+ const htmlEscapeMap = {
15
+ '&': '&amp;',
16
+ '<': '&lt;',
17
+ '>': '&gt;',
18
+ '"': '&quot;',
19
+ "'": '&#39;'
20
+ };
21
+ return str.replace(/[&<>"']/g, (char) => htmlEscapeMap[char] || char);
22
+ }
23
+ }
24
+ //# sourceMappingURL=sanitization.util.js.map
25
+
26
+ module.exports.SanitizationUtil = SanitizationUtil;
@@ -0,0 +1,6 @@
1
+ export declare class SanitizationUtil {
2
+ static sanitizeString(str: string | undefined, maxLength?: number): string;
3
+ static sanitizeEmail(email: string): string;
4
+ static escapeHtml(str: string): string;
5
+ }
6
+ //# sourceMappingURL=sanitization.util.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sanitization.util.d.ts","sourceRoot":"","sources":["../../src/utils/sanitization.util.ts"],"names":[],"mappings":"AAAA,qBAAa,gBAAgB;IAC3B,MAAM,CAAC,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,EAAE,SAAS,GAAE,MAAY,GAAG,MAAM;IAQ/E,MAAM,CAAC,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAI3C,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM;CAUvC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sanitization.util.js","sourceRoot":"","sources":["../../src/utils/sanitization.util.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,gBAAgB;IAC3B,MAAM,CAAC,cAAc,CAAC,GAAuB,EAAE,YAAoB,GAAG;QACpE,IAAI,CAAC,GAAG;YAAE,OAAO,EAAE,CAAC;QACpB,OAAO,MAAM,CAAC,GAAG,CAAC;aACf,IAAI,EAAE;aACN,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC;aACtB,SAAS,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC;IAC7B,CAAC;IAED,MAAM,CAAC,aAAa,CAAC,KAAa;QAChC,OAAO,KAAK,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,SAAS,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IACtD,CAAC;IAED,MAAM,CAAC,UAAU,CAAC,GAAW;QAC3B,MAAM,aAAa,GAA2B;YAC5C,GAAG,EAAE,OAAO;YACZ,GAAG,EAAE,MAAM;YACX,GAAG,EAAE,MAAM;YACX,GAAG,EAAE,QAAQ;YACb,GAAG,EAAE,OAAO;SACb,CAAC;QACF,OAAO,GAAG,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,CAAC;IACxE,CAAC;CACF"}
@@ -0,0 +1,24 @@
1
+ export class SanitizationUtil {
2
+ static sanitizeString(str, maxLength = 255) {
3
+ if (!str)
4
+ return "";
5
+ return String(str)
6
+ .trim()
7
+ .replace(/[<>'"]/g, "")
8
+ .substring(0, maxLength);
9
+ }
10
+ static sanitizeEmail(email) {
11
+ return email.trim().toLowerCase().substring(0, 100);
12
+ }
13
+ static escapeHtml(str) {
14
+ const htmlEscapeMap = {
15
+ '&': '&amp;',
16
+ '<': '&lt;',
17
+ '>': '&gt;',
18
+ '"': '&quot;',
19
+ "'": '&#39;'
20
+ };
21
+ return str.replace(/[&<>"']/g, (char) => htmlEscapeMap[char] || char);
22
+ }
23
+ }
24
+ //# sourceMappingURL=sanitization.util.js.map