perimeterx-js-core 0.5.1 → 0.6.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 (664) hide show
  1. package/README.md +20 -15
  2. package/lib/action/Action.d.ts +6 -0
  3. package/lib/action/Action.js +7 -0
  4. package/lib/action/ActionData.d.ts +11 -0
  5. package/lib/action/ActionData.js +1 -0
  6. package/lib/action/ActionPriorityOrder.d.ts +2 -0
  7. package/lib/action/ActionPriorityOrder.js +7 -0
  8. package/lib/action/Decision.d.ts +6 -0
  9. package/lib/action/Decision.js +1 -0
  10. package/lib/action/index.d.ts +4 -0
  11. package/lib/action/index.js +4 -0
  12. package/lib/activities/ActivityType.js +2 -5
  13. package/lib/activities/HttpActivityClient.d.ts +7 -7
  14. package/lib/activities/HttpActivityClient.js +46 -95
  15. package/lib/activities/HttpBatchedActivityClient.d.ts +2 -2
  16. package/lib/activities/HttpBatchedActivityClient.js +46 -115
  17. package/lib/activities/IActivityClient.d.ts +3 -3
  18. package/lib/activities/IActivityClient.js +1 -2
  19. package/lib/activities/constants.js +1 -4
  20. package/lib/activities/index.d.ts +7 -6
  21. package/lib/activities/index.js +7 -9
  22. package/lib/activities/model/Activity.js +1 -2
  23. package/lib/activities/model/ActivityDetails.d.ts +9 -7
  24. package/lib/activities/model/ActivityDetails.js +1 -2
  25. package/lib/activities/model/index.d.ts +2 -0
  26. package/lib/activities/model/index.js +2 -0
  27. package/lib/activities/utils.d.ts +11 -8
  28. package/lib/activities/utils.js +65 -43
  29. package/lib/additional_activity_handler/AdditionalActivityHandler.d.ts +2 -2
  30. package/lib/additional_activity_handler/AdditionalActivityHandler.js +1 -2
  31. package/lib/additional_activity_handler/AdditionalActivityHandlerUtils.d.ts +2 -2
  32. package/lib/additional_activity_handler/AdditionalActivityHandlerUtils.js +11 -53
  33. package/lib/additional_activity_handler/index.d.ts +2 -2
  34. package/lib/additional_activity_handler/index.js +2 -5
  35. package/lib/{block_handler → blocker}/BlockAction.d.ts +0 -1
  36. package/lib/blocker/BlockAction.js +6 -0
  37. package/lib/blocker/BlockActionToProductMap.d.ts +3 -0
  38. package/lib/blocker/BlockActionToProductMap.js +7 -0
  39. package/lib/blocker/BlockActionToWordMap.d.ts +2 -0
  40. package/lib/blocker/BlockActionToWordMap.js +6 -0
  41. package/lib/blocker/IBlocker.d.ts +5 -0
  42. package/lib/blocker/IBlocker.js +1 -0
  43. package/lib/blocker/IConditionalBlocker.d.ts +9 -0
  44. package/lib/blocker/IConditionalBlocker.js +1 -0
  45. package/lib/blocker/index.d.ts +5 -0
  46. package/lib/blocker/index.js +5 -0
  47. package/lib/config/ConfigurationParams.d.ts +20 -12
  48. package/lib/config/ConfigurationParams.js +1 -2
  49. package/lib/config/DefaultConfigurations.d.ts +1 -1
  50. package/lib/config/DefaultConfigurations.js +15 -13
  51. package/lib/config/IConfiguration.d.ts +103 -10
  52. package/lib/config/IConfiguration.js +1 -2
  53. package/lib/config/StaticConfigurationBase.d.ts +29 -6
  54. package/lib/config/StaticConfigurationBase.js +244 -394
  55. package/lib/config/index.js +2 -7
  56. package/lib/context/DefaultContext.d.ts +46 -0
  57. package/lib/context/DefaultContext.js +82 -0
  58. package/lib/context/index.d.ts +2 -4
  59. package/lib/context/index.js +2 -20
  60. package/lib/context/interfaces/IContext.d.ts +111 -0
  61. package/lib/context/interfaces/IContext.js +1 -0
  62. package/lib/context/interfaces/MobileData.d.ts +23 -0
  63. package/lib/context/interfaces/MobileData.js +1 -0
  64. package/lib/context/interfaces/ReadonlyContext.d.ts +3 -0
  65. package/lib/context/interfaces/ReadonlyContext.js +1 -0
  66. package/lib/context/interfaces/RequestData.d.ts +41 -0
  67. package/lib/context/interfaces/RequestData.js +1 -0
  68. package/lib/context/interfaces/RiskApiData.d.ts +27 -0
  69. package/lib/context/interfaces/RiskApiData.js +1 -0
  70. package/lib/context/interfaces/ServerData.d.ts +18 -0
  71. package/lib/context/interfaces/ServerData.js +1 -0
  72. package/lib/context/interfaces/TlsData.d.ts +30 -0
  73. package/lib/context/interfaces/TlsData.js +1 -0
  74. package/lib/context/interfaces/TokenData.d.ts +16 -0
  75. package/lib/context/interfaces/TokenData.js +1 -0
  76. package/lib/context/interfaces/index.d.ts +8 -0
  77. package/lib/context/interfaces/index.js +8 -0
  78. package/lib/cors/CustomBlockResponseHeadersHandler.d.ts +2 -2
  79. package/lib/cors/CustomBlockResponseHeadersHandler.js +1 -2
  80. package/lib/cors/CustomPreflightHandler.d.ts +2 -2
  81. package/lib/cors/CustomPreflightHandler.js +1 -2
  82. package/lib/cors/DefaultCors.d.ts +9 -9
  83. package/lib/cors/DefaultCors.js +39 -87
  84. package/lib/cors/ICors.d.ts +7 -7
  85. package/lib/cors/ICors.js +1 -2
  86. package/lib/cors/constants.js +2 -5
  87. package/lib/cors/index.js +2 -20
  88. package/lib/custom_parameters/CustomParameters.js +1 -2
  89. package/lib/custom_parameters/CustomParametersFunction.d.ts +1 -2
  90. package/lib/custom_parameters/CustomParametersFunction.js +1 -2
  91. package/lib/custom_parameters/CustomParametersUtils.d.ts +2 -2
  92. package/lib/custom_parameters/CustomParametersUtils.js +18 -60
  93. package/lib/custom_parameters/index.js +1 -5
  94. package/lib/enforcer/EnforcerBase.d.ts +43 -85
  95. package/lib/enforcer/EnforcerBase.js +120 -411
  96. package/lib/enforcer/IEnforcer.js +1 -2
  97. package/lib/enforcer/index.d.ts +2 -1
  98. package/lib/enforcer/index.js +2 -5
  99. package/lib/enforcer/options/EnforcerBaseOptions.d.ts +25 -0
  100. package/lib/enforcer/options/EnforcerBaseOptions.js +1 -0
  101. package/lib/enforcer/options/EnforcerOptionsType.d.ts +4 -0
  102. package/lib/enforcer/options/EnforcerOptionsType.js +1 -0
  103. package/lib/enforcer/options/EnforcerV2Options.d.ts +5 -0
  104. package/lib/enforcer/options/EnforcerV2Options.js +1 -0
  105. package/lib/enforcer/options/EnforcerV3Options.d.ts +7 -0
  106. package/lib/enforcer/options/EnforcerV3Options.js +1 -0
  107. package/lib/enforcer/options/index.d.ts +4 -0
  108. package/lib/enforcer/options/index.js +4 -0
  109. package/lib/filter/FilterReason.d.ts +2 -1
  110. package/lib/filter/FilterReason.js +3 -5
  111. package/lib/filter/IFilter.d.ts +4 -4
  112. package/lib/filter/IFilter.js +1 -2
  113. package/lib/filter/index.d.ts +2 -3
  114. package/lib/filter/index.js +2 -7
  115. package/lib/first_party/FirstPartyData.d.ts +5 -0
  116. package/lib/first_party/FirstPartyData.js +1 -0
  117. package/lib/first_party/IFirstParty.d.ts +5 -5
  118. package/lib/first_party/IFirstParty.js +1 -2
  119. package/lib/first_party/index.d.ts +2 -4
  120. package/lib/first_party/index.js +2 -21
  121. package/lib/graphql/DefaultGraphQLParser.d.ts +6 -5
  122. package/lib/graphql/DefaultGraphQLParser.js +77 -133
  123. package/lib/graphql/IGraphQLParser.d.ts +5 -4
  124. package/lib/graphql/IGraphQLParser.js +1 -2
  125. package/lib/graphql/index.d.ts +3 -5
  126. package/lib/graphql/index.js +3 -7
  127. package/lib/graphql/model/GraphQLData.js +1 -2
  128. package/lib/graphql/model/GraphQLOperation.js +1 -2
  129. package/lib/graphql/model/GraphQLOperationType.js +2 -5
  130. package/lib/graphql/model/index.d.ts +3 -0
  131. package/lib/graphql/model/index.js +3 -0
  132. package/lib/http/impl/FormDataImpl.d.ts +12 -0
  133. package/lib/http/impl/FormDataImpl.js +36 -0
  134. package/lib/http/impl/MinimalResponseImpl.d.ts +3 -3
  135. package/lib/http/impl/MinimalResponseImpl.js +3 -8
  136. package/lib/http/impl/OutgoingRequestImpl.d.ts +3 -3
  137. package/lib/http/impl/OutgoingRequestImpl.js +5 -10
  138. package/lib/http/impl/index.d.ts +1 -0
  139. package/lib/http/impl/index.js +4 -19
  140. package/lib/http/impl/phin/PhinHttpClient.js +30 -70
  141. package/lib/http/impl/phin/PhinIncomingResponse.d.ts +4 -5
  142. package/lib/http/impl/phin/PhinIncomingResponse.js +22 -70
  143. package/lib/http/impl/phin/index.js +2 -18
  144. package/lib/http/index.js +3 -19
  145. package/lib/http/interfaces/IBody.d.ts +10 -12
  146. package/lib/http/interfaces/IBody.js +1 -2
  147. package/lib/http/interfaces/IFormData.d.ts +9 -0
  148. package/lib/http/interfaces/IFormData.js +1 -0
  149. package/lib/http/interfaces/IHeaders.js +1 -2
  150. package/lib/http/interfaces/IHttpClient.js +1 -2
  151. package/lib/http/interfaces/IIncomingRequest.d.ts +10 -6
  152. package/lib/http/interfaces/IIncomingRequest.js +1 -2
  153. package/lib/http/interfaces/IIncomingResponse.d.ts +2 -2
  154. package/lib/http/interfaces/IIncomingResponse.js +1 -2
  155. package/lib/http/interfaces/IMinimalResponse.d.ts +2 -2
  156. package/lib/http/interfaces/IMinimalResponse.js +1 -2
  157. package/lib/http/interfaces/IOutgoingRequest.d.ts +2 -2
  158. package/lib/http/interfaces/IOutgoingRequest.js +1 -2
  159. package/lib/http/interfaces/IOutgoingResponse.d.ts +5 -1
  160. package/lib/http/interfaces/IOutgoingResponse.js +1 -2
  161. package/lib/http/interfaces/IURL.d.ts +6 -0
  162. package/lib/http/interfaces/IURL.js +1 -0
  163. package/lib/http/interfaces/ReadonlyHeaders.d.ts +6 -0
  164. package/lib/http/interfaces/ReadonlyHeaders.js +14 -0
  165. package/lib/http/interfaces/index.d.ts +3 -1
  166. package/lib/http/interfaces/index.js +11 -25
  167. package/lib/http/utils/ContentType.js +2 -5
  168. package/lib/http/utils/HttpMethod.js +2 -5
  169. package/lib/http/utils/MinimalResponseUtils.d.ts +6 -6
  170. package/lib/http/utils/MinimalResponseUtils.js +31 -48
  171. package/lib/http/utils/MultipartFormDataUtils.d.ts +6 -0
  172. package/lib/http/utils/MultipartFormDataUtils.js +45 -0
  173. package/lib/http/utils/constants.js +9 -12
  174. package/lib/http/utils/index.d.ts +3 -1
  175. package/lib/http/utils/index.js +5 -21
  176. package/lib/index.d.ts +4 -1
  177. package/lib/index.js +22 -35
  178. package/lib/logger/DefaultLogger.js +7 -28
  179. package/lib/logger/ILogger.js +1 -2
  180. package/lib/logger/LoggerBase.d.ts +2 -0
  181. package/lib/logger/LoggerBase.js +24 -22
  182. package/lib/logger/LoggerSeverity.js +2 -5
  183. package/lib/logger/index.js +3 -9
  184. package/lib/phase/IPhase.d.ts +5 -0
  185. package/lib/phase/IPhase.js +1 -0
  186. package/lib/phase/PhaseResult.d.ts +5 -0
  187. package/lib/phase/PhaseResult.js +1 -0
  188. package/lib/phase/flow/EnforceFlow.d.ts +6 -0
  189. package/lib/phase/flow/EnforceFlow.js +15 -0
  190. package/lib/phase/flow/FilterFlow.d.ts +6 -0
  191. package/lib/phase/flow/FilterFlow.js +12 -0
  192. package/lib/phase/flow/PostEnforceFlow.d.ts +6 -0
  193. package/lib/phase/flow/PostEnforceFlow.js +10 -0
  194. package/lib/phase/flow/index.d.ts +3 -0
  195. package/lib/phase/flow/index.js +3 -0
  196. package/lib/phase/impl/AdditionalActivityHandlerPhase.d.ts +9 -0
  197. package/lib/phase/impl/AdditionalActivityHandlerPhase.js +22 -0
  198. package/lib/phase/impl/CompositePhase.d.ts +8 -0
  199. package/lib/phase/impl/CompositePhase.js +26 -0
  200. package/lib/phase/impl/CreateBlockResponsePhase.d.ts +17 -0
  201. package/lib/phase/impl/CreateBlockResponsePhase.js +60 -0
  202. package/lib/phase/impl/DecideActionPhase.d.ts +19 -0
  203. package/lib/phase/impl/DecideActionPhase.js +56 -0
  204. package/lib/phase/impl/EnrichContextFromRequestPhase.d.ts +18 -0
  205. package/lib/phase/impl/EnrichContextFromRequestPhase.js +59 -0
  206. package/lib/phase/impl/EnrichContextFromResponsePhase.d.ts +10 -0
  207. package/lib/phase/impl/EnrichContextFromResponsePhase.js +29 -0
  208. package/lib/phase/impl/FilterPhase.d.ts +9 -0
  209. package/lib/phase/impl/FilterPhase.js +19 -0
  210. package/lib/phase/impl/FirstPartyPhase.d.ts +12 -0
  211. package/lib/phase/impl/FirstPartyPhase.js +42 -0
  212. package/lib/phase/impl/ModifyIncomingRequestPhase.d.ts +9 -0
  213. package/lib/phase/impl/ModifyIncomingRequestPhase.js +20 -0
  214. package/lib/phase/impl/ModifyOutgoingResponsePhase.d.ts +9 -0
  215. package/lib/phase/impl/ModifyOutgoingResponsePhase.js +25 -0
  216. package/lib/phase/impl/ParseTokenPhase.d.ts +10 -0
  217. package/lib/phase/impl/ParseTokenPhase.js +37 -0
  218. package/lib/phase/impl/PreflightPhase.d.ts +12 -0
  219. package/lib/phase/impl/PreflightPhase.js +28 -0
  220. package/lib/phase/impl/RiskApiPhase.d.ts +17 -0
  221. package/lib/phase/impl/RiskApiPhase.js +76 -0
  222. package/lib/phase/impl/SendAsyncActivitiesOnRequestPhase.d.ts +10 -0
  223. package/lib/phase/impl/SendAsyncActivitiesOnRequestPhase.js +28 -0
  224. package/lib/phase/impl/SendAsyncActivitiesOnResponsePhase.d.ts +9 -0
  225. package/lib/phase/impl/SendAsyncActivitiesOnResponsePhase.js +20 -0
  226. package/lib/phase/impl/TelemetryPhase.d.ts +10 -0
  227. package/lib/phase/impl/TelemetryPhase.js +29 -0
  228. package/lib/phase/impl/index.d.ts +16 -0
  229. package/lib/phase/impl/index.js +16 -0
  230. package/lib/phase/index.d.ts +4 -0
  231. package/lib/phase/index.js +4 -0
  232. package/lib/products/account_defender/AccountDefender.d.ts +23 -0
  233. package/lib/products/account_defender/AccountDefender.js +98 -0
  234. package/lib/products/account_defender/AccountDefenderData.d.ts +6 -0
  235. package/lib/products/account_defender/AccountDefenderData.js +1 -0
  236. package/lib/products/account_defender/IAccountDefender.d.ts +4 -0
  237. package/lib/products/account_defender/IAccountDefender.js +1 -0
  238. package/lib/products/account_defender/JwtData.d.ts +4 -0
  239. package/lib/products/account_defender/JwtData.js +1 -0
  240. package/lib/products/account_defender/constants.d.ts +1 -0
  241. package/lib/products/account_defender/constants.js +1 -0
  242. package/lib/products/account_defender/index.d.ts +5 -0
  243. package/lib/products/account_defender/index.js +5 -0
  244. package/lib/products/bot_defender/BotDefender.d.ts +47 -0
  245. package/lib/products/bot_defender/BotDefender.js +135 -0
  246. package/lib/products/bot_defender/BotDefenderActionData.d.ts +7 -0
  247. package/lib/products/bot_defender/BotDefenderActionData.js +6 -0
  248. package/lib/products/bot_defender/BotDefenderData.d.ts +13 -0
  249. package/lib/products/bot_defender/BotDefenderData.js +1 -0
  250. package/lib/products/bot_defender/BotDefenderUtils.d.ts +5 -0
  251. package/lib/products/bot_defender/BotDefenderUtils.js +19 -0
  252. package/lib/products/bot_defender/IBotDefender.d.ts +7 -0
  253. package/lib/products/bot_defender/IBotDefender.js +1 -0
  254. package/lib/products/bot_defender/block/DefaultBotDefenderBlocker.d.ts +14 -0
  255. package/lib/products/bot_defender/block/DefaultBotDefenderBlocker.js +39 -0
  256. package/lib/products/bot_defender/block/captcha/CaptchaBlocker.d.ts +13 -0
  257. package/lib/products/bot_defender/block/captcha/CaptchaBlocker.js +20 -0
  258. package/lib/products/bot_defender/block/captcha/HtmlCaptchaBlocker.d.ts +9 -0
  259. package/lib/products/bot_defender/block/captcha/HtmlCaptchaBlocker.js +20 -0
  260. package/lib/products/bot_defender/block/captcha/JsonCaptchaBlocker.d.ts +10 -0
  261. package/lib/products/bot_defender/block/captcha/JsonCaptchaBlocker.js +38 -0
  262. package/lib/products/bot_defender/block/captcha/MobileCaptchaBlocker.d.ts +12 -0
  263. package/lib/products/bot_defender/block/captcha/MobileCaptchaBlocker.js +34 -0
  264. package/lib/products/bot_defender/block/captcha/index.d.ts +4 -0
  265. package/lib/products/bot_defender/block/captcha/index.js +4 -0
  266. package/lib/products/bot_defender/block/index.d.ts +5 -0
  267. package/lib/products/bot_defender/block/index.js +5 -0
  268. package/lib/{block_handler → products/bot_defender/block}/model/BlockData.d.ts +1 -1
  269. package/lib/products/bot_defender/block/model/BlockData.js +1 -0
  270. package/lib/products/bot_defender/block/model/JsonBlockPayload.js +1 -0
  271. package/lib/products/bot_defender/block/model/MobileBlockPayload.js +1 -0
  272. package/lib/products/bot_defender/block/model/index.d.ts +3 -0
  273. package/lib/products/bot_defender/block/model/index.js +3 -0
  274. package/lib/products/bot_defender/block/templates/captcha_template.js +50 -0
  275. package/lib/products/bot_defender/block/templates/index.d.ts +2 -0
  276. package/lib/products/bot_defender/block/templates/index.js +2 -0
  277. package/lib/products/bot_defender/block/templates/rate_limit_template.js +10 -0
  278. package/lib/products/bot_defender/block/utils.d.ts +5 -0
  279. package/lib/products/bot_defender/block/utils.js +43 -0
  280. package/lib/products/bot_defender/filter/DefaultBotDefenderFilter.d.ts +16 -0
  281. package/lib/products/bot_defender/filter/DefaultBotDefenderFilter.js +51 -0
  282. package/lib/products/bot_defender/filter/index.d.ts +1 -0
  283. package/lib/products/bot_defender/filter/index.js +1 -0
  284. package/lib/products/bot_defender/first_party/DefaultBotDefenderFirstParty.d.ts +20 -0
  285. package/lib/products/bot_defender/first_party/DefaultBotDefenderFirstParty.js +129 -0
  286. package/lib/products/bot_defender/first_party/FirstPartySuffix.d.ts +5 -0
  287. package/lib/products/bot_defender/first_party/FirstPartySuffix.js +6 -0
  288. package/lib/{first_party → products/bot_defender/first_party}/constants.d.ts +5 -2
  289. package/lib/products/bot_defender/first_party/constants.js +36 -0
  290. package/lib/products/bot_defender/first_party/index.d.ts +4 -0
  291. package/lib/products/bot_defender/first_party/index.js +4 -0
  292. package/lib/products/bot_defender/first_party/utils.d.ts +11 -0
  293. package/lib/products/bot_defender/first_party/utils.js +46 -0
  294. package/lib/products/bot_defender/index.d.ts +9 -0
  295. package/lib/products/bot_defender/index.js +9 -0
  296. package/lib/{block_handler/BlockReason.d.ts → products/bot_defender/reasons/BotDefenderBlockReason.d.ts} +1 -1
  297. package/lib/products/bot_defender/reasons/BotDefenderBlockReason.js +5 -0
  298. package/lib/{utils/PassReason.d.ts → products/bot_defender/reasons/BotDefenderPassReason.d.ts} +1 -1
  299. package/lib/products/bot_defender/reasons/BotDefenderPassReason.js +7 -0
  300. package/lib/products/bot_defender/reasons/BotDefenderReasonType.d.ts +5 -0
  301. package/lib/products/bot_defender/reasons/BotDefenderReasonType.js +1 -0
  302. package/lib/{risk_api/S2SCallReason.d.ts → products/bot_defender/reasons/BotDefenderS2SCallReason.d.ts} +1 -1
  303. package/lib/products/bot_defender/reasons/BotDefenderS2SCallReason.js +13 -0
  304. package/lib/products/bot_defender/reasons/index.d.ts +4 -0
  305. package/lib/products/bot_defender/reasons/index.js +4 -0
  306. package/lib/products/credential_intelligence/CredentialIntelligence.d.ts +22 -0
  307. package/lib/products/credential_intelligence/CredentialIntelligence.js +96 -0
  308. package/lib/products/credential_intelligence/ICredentialIntelligence.d.ts +4 -0
  309. package/lib/products/credential_intelligence/ICredentialIntelligence.js +1 -0
  310. package/lib/products/credential_intelligence/constants.d.ts +4 -0
  311. package/lib/products/credential_intelligence/constants.js +4 -0
  312. package/lib/products/credential_intelligence/endpoint/CredentialEndpoint.d.ts +21 -0
  313. package/lib/products/credential_intelligence/endpoint/CredentialEndpoint.js +37 -0
  314. package/lib/products/credential_intelligence/endpoint/CredentialEndpointConfiguration.d.ts +74 -0
  315. package/lib/products/credential_intelligence/endpoint/CredentialEndpointConfiguration.js +1 -0
  316. package/lib/products/credential_intelligence/endpoint/CredentialEndpointManager.d.ts +12 -0
  317. package/lib/products/credential_intelligence/endpoint/CredentialEndpointManager.js +32 -0
  318. package/lib/products/credential_intelligence/endpoint/ICredentialEndpoint.d.ts +9 -0
  319. package/lib/products/credential_intelligence/endpoint/ICredentialEndpoint.js +1 -0
  320. package/lib/products/credential_intelligence/endpoint/extractor/BodyCredentialExtractor.d.ts +15 -0
  321. package/lib/products/credential_intelligence/endpoint/extractor/BodyCredentialExtractor.js +64 -0
  322. package/lib/products/credential_intelligence/endpoint/extractor/CredentialExtractorFactory.d.ts +5 -0
  323. package/lib/products/credential_intelligence/endpoint/extractor/CredentialExtractorFactory.js +21 -0
  324. package/lib/products/credential_intelligence/endpoint/extractor/CustomCredentialExtractor.d.ts +9 -0
  325. package/lib/products/credential_intelligence/endpoint/extractor/CustomCredentialExtractor.js +24 -0
  326. package/lib/products/credential_intelligence/endpoint/extractor/HeaderCredentialExtractor.d.ts +10 -0
  327. package/lib/products/credential_intelligence/endpoint/extractor/HeaderCredentialExtractor.js +22 -0
  328. package/lib/products/credential_intelligence/endpoint/extractor/ICredentialExtractor.d.ts +6 -0
  329. package/lib/products/credential_intelligence/endpoint/extractor/ICredentialExtractor.js +1 -0
  330. package/lib/products/credential_intelligence/endpoint/extractor/QueryParamCredentialExtractor.d.ts +10 -0
  331. package/lib/products/credential_intelligence/endpoint/extractor/QueryParamCredentialExtractor.js +23 -0
  332. package/lib/products/credential_intelligence/endpoint/extractor/SentThrough.d.ts +6 -0
  333. package/lib/products/credential_intelligence/endpoint/extractor/SentThrough.js +7 -0
  334. package/lib/products/credential_intelligence/endpoint/extractor/index.d.ts +5 -0
  335. package/lib/products/credential_intelligence/endpoint/extractor/index.js +5 -0
  336. package/lib/products/credential_intelligence/endpoint/hash_protocol/CredentialIntelligenceHashProtocolFactory.d.ts +6 -0
  337. package/lib/products/credential_intelligence/endpoint/hash_protocol/CredentialIntelligenceHashProtocolFactory.js +17 -0
  338. package/lib/products/credential_intelligence/endpoint/hash_protocol/CredentialIntelligenceVersion.d.ts +5 -0
  339. package/lib/products/credential_intelligence/endpoint/hash_protocol/CredentialIntelligenceVersion.js +6 -0
  340. package/lib/products/credential_intelligence/endpoint/hash_protocol/ICredentialIntelligenceHashProtocol.d.ts +5 -0
  341. package/lib/products/credential_intelligence/endpoint/hash_protocol/ICredentialIntelligenceHashProtocol.js +1 -0
  342. package/lib/products/credential_intelligence/endpoint/hash_protocol/MultistepHashProtocol.d.ts +8 -0
  343. package/lib/products/credential_intelligence/endpoint/hash_protocol/MultistepHashProtocol.js +30 -0
  344. package/lib/products/credential_intelligence/endpoint/hash_protocol/SingleStepAndMultistepHashProtocol.d.ts +8 -0
  345. package/lib/products/credential_intelligence/endpoint/hash_protocol/SingleStepAndMultistepHashProtocol.js +25 -0
  346. package/lib/products/credential_intelligence/endpoint/hash_protocol/SingleStepHashProtocol.d.ts +10 -0
  347. package/lib/products/credential_intelligence/endpoint/hash_protocol/SingleStepHashProtocol.js +49 -0
  348. package/lib/products/credential_intelligence/endpoint/hash_protocol/SsoStep.d.ts +4 -0
  349. package/lib/products/credential_intelligence/endpoint/hash_protocol/SsoStep.js +5 -0
  350. package/lib/products/credential_intelligence/endpoint/hash_protocol/index.d.ts +7 -0
  351. package/lib/products/credential_intelligence/endpoint/hash_protocol/index.js +7 -0
  352. package/lib/products/credential_intelligence/endpoint/index.d.ts +8 -0
  353. package/lib/products/credential_intelligence/endpoint/index.js +8 -0
  354. package/lib/products/credential_intelligence/endpoint/login_successful/BodyLoginSuccessfulParser.d.ts +7 -0
  355. package/lib/products/credential_intelligence/endpoint/login_successful/BodyLoginSuccessfulParser.js +20 -0
  356. package/lib/products/credential_intelligence/endpoint/login_successful/CustomLoginSuccessfulCallback.d.ts +1 -0
  357. package/lib/products/credential_intelligence/endpoint/login_successful/CustomLoginSuccessfulCallback.js +1 -0
  358. package/lib/products/credential_intelligence/endpoint/login_successful/CustomLoginSuccessfulParser.d.ts +8 -0
  359. package/lib/products/credential_intelligence/endpoint/login_successful/CustomLoginSuccessfulParser.js +26 -0
  360. package/lib/products/credential_intelligence/endpoint/login_successful/HeaderLoginSuccessfulParser.d.ts +8 -0
  361. package/lib/products/credential_intelligence/endpoint/login_successful/HeaderLoginSuccessfulParser.js +23 -0
  362. package/lib/products/credential_intelligence/endpoint/login_successful/ILoginSuccessfulParser.d.ts +4 -0
  363. package/lib/products/credential_intelligence/endpoint/login_successful/ILoginSuccessfulParser.js +1 -0
  364. package/lib/products/credential_intelligence/endpoint/login_successful/LoginSuccessfulParserFactory.d.ts +6 -0
  365. package/lib/products/credential_intelligence/endpoint/login_successful/LoginSuccessfulParserFactory.js +26 -0
  366. package/lib/products/credential_intelligence/endpoint/login_successful/LoginSuccessfulReportingMethod.d.ts +6 -0
  367. package/lib/products/credential_intelligence/endpoint/login_successful/LoginSuccessfulReportingMethod.js +7 -0
  368. package/lib/products/credential_intelligence/endpoint/login_successful/StatusLoginSuccessfulParser.d.ts +7 -0
  369. package/lib/products/credential_intelligence/endpoint/login_successful/StatusLoginSuccessfulParser.js +19 -0
  370. package/lib/products/credential_intelligence/endpoint/login_successful/index.d.ts +8 -0
  371. package/lib/products/credential_intelligence/endpoint/login_successful/index.js +8 -0
  372. package/lib/products/credential_intelligence/endpoint/matcher/CredentialIntelligenceEndpointMatcherFactory.d.ts +5 -0
  373. package/lib/products/credential_intelligence/endpoint/matcher/CredentialIntelligenceEndpointMatcherFactory.js +14 -0
  374. package/lib/products/credential_intelligence/endpoint/matcher/ExactPathEndpointMatcher.d.ts +10 -0
  375. package/lib/products/credential_intelligence/endpoint/matcher/ExactPathEndpointMatcher.js +9 -0
  376. package/lib/products/credential_intelligence/endpoint/matcher/ICredentialIntelligenceEndpointMatcher.d.ts +5 -0
  377. package/lib/products/credential_intelligence/endpoint/matcher/ICredentialIntelligenceEndpointMatcher.js +1 -0
  378. package/lib/products/credential_intelligence/endpoint/matcher/PathType.d.ts +4 -0
  379. package/lib/products/credential_intelligence/endpoint/matcher/PathType.js +5 -0
  380. package/lib/products/credential_intelligence/endpoint/matcher/RegexPathEndpointMatcher.d.ts +10 -0
  381. package/lib/products/credential_intelligence/endpoint/matcher/RegexPathEndpointMatcher.js +9 -0
  382. package/lib/products/credential_intelligence/endpoint/matcher/index.d.ts +5 -0
  383. package/lib/products/credential_intelligence/endpoint/matcher/index.js +5 -0
  384. package/lib/products/credential_intelligence/index.d.ts +5 -0
  385. package/lib/products/credential_intelligence/index.js +5 -0
  386. package/lib/products/credential_intelligence/model/CredentialData.d.ts +8 -0
  387. package/lib/products/credential_intelligence/model/CredentialData.js +1 -0
  388. package/lib/products/credential_intelligence/model/CredentialIntelligenceData.d.ts +7 -0
  389. package/lib/products/credential_intelligence/model/CredentialIntelligenceData.js +1 -0
  390. package/lib/products/credential_intelligence/model/Credentials.d.ts +4 -0
  391. package/lib/products/credential_intelligence/model/Credentials.js +1 -0
  392. package/lib/products/credential_intelligence/model/CustomExtractionCallback.d.ts +2 -0
  393. package/lib/products/credential_intelligence/model/CustomExtractionCallback.js +1 -0
  394. package/lib/products/credential_intelligence/model/index.d.ts +4 -0
  395. package/lib/products/credential_intelligence/model/index.js +4 -0
  396. package/lib/products/index.d.ts +5 -0
  397. package/lib/products/index.js +5 -0
  398. package/lib/products/interfaces/IProduct.d.ts +10 -0
  399. package/lib/products/interfaces/IProduct.js +1 -0
  400. package/lib/products/interfaces/ProductData.d.ts +5 -0
  401. package/lib/products/interfaces/ProductData.js +1 -0
  402. package/lib/products/interfaces/ProductDataType.d.ts +5 -0
  403. package/lib/products/interfaces/ProductDataType.js +1 -0
  404. package/lib/products/interfaces/ProductType.d.ts +5 -0
  405. package/lib/products/interfaces/ProductType.js +1 -0
  406. package/lib/products/interfaces/Products.d.ts +5 -0
  407. package/lib/products/interfaces/Products.js +1 -0
  408. package/lib/products/interfaces/index.d.ts +5 -0
  409. package/lib/products/interfaces/index.js +5 -0
  410. package/lib/products/utils/ProductName.d.ts +7 -0
  411. package/lib/products/utils/ProductName.js +8 -0
  412. package/lib/products/utils/ProductPriorityOrder.d.ts +2 -0
  413. package/lib/products/utils/ProductPriorityOrder.js +8 -0
  414. package/lib/products/utils/index.d.ts +3 -0
  415. package/lib/products/utils/index.js +3 -0
  416. package/lib/products/utils/utils.d.ts +5 -0
  417. package/lib/products/utils/utils.js +12 -0
  418. package/lib/pxde/DefaultDataEnrichment.d.ts +7 -6
  419. package/lib/pxde/DefaultDataEnrichment.js +57 -116
  420. package/lib/pxde/IDataEnrichment.d.ts +5 -4
  421. package/lib/pxde/IDataEnrichment.js +1 -2
  422. package/lib/pxde/constants.js +4 -7
  423. package/lib/pxde/index.d.ts +3 -3
  424. package/lib/pxde/index.js +4 -20
  425. package/lib/pxde/model/PXDE.js +1 -2
  426. package/lib/pxde/model/PxdeData.d.ts +5 -0
  427. package/lib/pxde/model/PxdeData.js +1 -0
  428. package/lib/pxde/model/index.d.ts +2 -0
  429. package/lib/pxde/model/index.js +2 -0
  430. package/lib/pxhd/PXHDUtils.d.ts +3 -4
  431. package/lib/pxhd/PXHDUtils.js +15 -26
  432. package/lib/pxhd/index.js +2 -20
  433. package/lib/pxhd/model/PXHD.js +1 -2
  434. package/lib/pxhd/model/PXHDSource.js +2 -5
  435. package/lib/pxhd/model/index.js +2 -18
  436. package/lib/risk_api/client/IRiskApiClient.d.ts +4 -0
  437. package/lib/risk_api/client/IRiskApiClient.js +1 -0
  438. package/lib/risk_api/client/PostRiskApiClientBase.d.ts +44 -0
  439. package/lib/risk_api/client/PostRiskApiClientBase.js +235 -0
  440. package/lib/risk_api/client/PostRiskApiClientV2.d.ts +8 -0
  441. package/lib/risk_api/client/PostRiskApiClientV2.js +10 -0
  442. package/lib/risk_api/client/PostRiskApiClientV3.d.ts +8 -0
  443. package/lib/risk_api/client/PostRiskApiClientV3.js +10 -0
  444. package/lib/risk_api/client/index.d.ts +4 -0
  445. package/lib/risk_api/client/index.js +4 -0
  446. package/lib/risk_api/constants.js +1 -4
  447. package/lib/risk_api/index.d.ts +3 -12
  448. package/lib/risk_api/index.js +4 -34
  449. package/lib/risk_api/model/RiskActivity.d.ts +6 -2
  450. package/lib/risk_api/model/RiskActivity.js +1 -2
  451. package/lib/risk_api/model/RiskApiCallResult.d.ts +6 -0
  452. package/lib/risk_api/model/RiskApiCallResult.js +7 -0
  453. package/lib/risk_api/model/RiskStatus.js +2 -5
  454. package/lib/risk_api/{S2SErrorReason.js → model/S2SErrorReason.js} +2 -5
  455. package/lib/risk_api/model/index.d.ts +4 -0
  456. package/lib/risk_api/model/index.js +4 -0
  457. package/lib/risk_api/risk_response/IRiskResponse.d.ts +15 -0
  458. package/lib/risk_api/risk_response/IRiskResponse.js +1 -0
  459. package/lib/risk_api/risk_response/RiskResponseBase.d.ts +22 -0
  460. package/lib/risk_api/risk_response/RiskResponseBase.js +54 -0
  461. package/lib/risk_api/risk_response/RiskResponsePayloadType.d.ts +4 -0
  462. package/lib/risk_api/risk_response/RiskResponsePayloadType.js +1 -0
  463. package/lib/risk_api/risk_response/index.d.ts +4 -0
  464. package/lib/risk_api/risk_response/index.js +4 -0
  465. package/lib/risk_api/risk_response/v2/DefaultRiskResponseV2.d.ts +8 -0
  466. package/lib/risk_api/risk_response/v2/DefaultRiskResponseV2.js +18 -0
  467. package/lib/risk_api/{model/RiskResponseV2.d.ts → risk_response/v2/RiskResponseV2Payload.d.ts} +4 -4
  468. package/lib/risk_api/risk_response/v2/RiskResponseV2Payload.js +1 -0
  469. package/lib/risk_api/risk_response/v2/index.d.ts +2 -0
  470. package/lib/risk_api/risk_response/v2/index.js +2 -0
  471. package/lib/risk_api/risk_response/v3/DefaultRiskResponseV3.d.ts +8 -0
  472. package/lib/risk_api/risk_response/v3/DefaultRiskResponseV3.js +14 -0
  473. package/lib/risk_api/{model/RiskResponseV3.d.ts → risk_response/v3/RiskResponseV3Payload.d.ts} +4 -4
  474. package/lib/risk_api/risk_response/v3/RiskResponseV3Payload.js +1 -0
  475. package/lib/risk_api/risk_response/v3/index.d.ts +2 -0
  476. package/lib/risk_api/risk_response/v3/index.js +2 -0
  477. package/lib/risk_token/MobileError.js +2 -5
  478. package/lib/risk_token/TokenOrigin.js +2 -5
  479. package/lib/risk_token/{TokenVerificationResult.d.ts → TokenParseResult.d.ts} +2 -2
  480. package/lib/risk_token/TokenParseResult.js +7 -0
  481. package/lib/risk_token/TokenVersion.js +2 -5
  482. package/lib/risk_token/constants.js +9 -12
  483. package/lib/risk_token/index.d.ts +2 -3
  484. package/lib/risk_token/index.js +8 -32
  485. package/lib/risk_token/parser/DefaultTokenV2Parser.d.ts +13 -0
  486. package/lib/risk_token/parser/DefaultTokenV2Parser.js +14 -0
  487. package/lib/risk_token/parser/DefaultTokenV3Parser.d.ts +13 -0
  488. package/lib/risk_token/parser/DefaultTokenV3Parser.js +14 -0
  489. package/lib/risk_token/parser/ITokenParser.d.ts +4 -0
  490. package/lib/risk_token/parser/ITokenParser.js +1 -0
  491. package/lib/risk_token/parser/TokenParserBase.d.ts +19 -0
  492. package/lib/risk_token/parser/TokenParserBase.js +94 -0
  493. package/lib/risk_token/parser/TokenParserOptions.d.ts +4 -0
  494. package/lib/risk_token/parser/TokenParserOptions.js +1 -0
  495. package/lib/risk_token/parser/index.d.ts +5 -0
  496. package/lib/risk_token/parser/index.js +5 -0
  497. package/lib/risk_token/token/{IBotDefenderToken.d.ts → IToken.d.ts} +10 -9
  498. package/lib/risk_token/token/IToken.js +1 -0
  499. package/lib/risk_token/token/TokenBase.d.ts +32 -0
  500. package/lib/risk_token/token/TokenBase.js +50 -0
  501. package/lib/risk_token/token/TokenPayloadType.d.ts +4 -0
  502. package/lib/risk_token/token/TokenPayloadType.js +1 -0
  503. package/lib/risk_token/token/index.d.ts +6 -6
  504. package/lib/risk_token/token/index.js +4 -11
  505. package/lib/risk_token/token/v2/DefaultTokenV2.d.ts +27 -0
  506. package/lib/risk_token/token/v2/DefaultTokenV2.js +112 -0
  507. package/lib/risk_token/token/v2/{BotDefenderTokenV2Payload.d.ts → TokenV2Payload.d.ts} +1 -1
  508. package/lib/risk_token/token/v2/TokenV2Payload.js +1 -0
  509. package/lib/risk_token/token/v3/DefaultTokenV3.d.ts +30 -0
  510. package/lib/risk_token/token/v3/DefaultTokenV3.js +137 -0
  511. package/lib/risk_token/token/v3/TokenSignField.js +2 -5
  512. package/lib/risk_token/token/v3/TokenV3Payload.d.ts +9 -0
  513. package/lib/risk_token/token/v3/TokenV3Payload.js +1 -0
  514. package/lib/risk_token/utils.js +7 -11
  515. package/lib/telemetry/DefaultTelemetry.d.ts +8 -8
  516. package/lib/telemetry/DefaultTelemetry.js +86 -152
  517. package/lib/telemetry/ITelemetry.d.ts +4 -4
  518. package/lib/telemetry/ITelemetry.js +1 -2
  519. package/lib/telemetry/constants.js +7 -10
  520. package/lib/telemetry/index.js +2 -20
  521. package/lib/telemetry/model/TelemetryActivity.d.ts +1 -1
  522. package/lib/telemetry/model/TelemetryActivity.js +1 -2
  523. package/lib/utils/Algorithm.js +2 -5
  524. package/lib/utils/ModuleMode.js +2 -5
  525. package/lib/utils/VidSource.js +2 -5
  526. package/lib/utils/base64/AtobBase64Utils.js +6 -13
  527. package/lib/utils/base64/BufferBase64Utils.js +9 -16
  528. package/lib/utils/base64/IBase64Utils.js +1 -2
  529. package/lib/utils/base64/JSBase64Base64Utils.js +8 -15
  530. package/lib/utils/base64/index.js +4 -20
  531. package/lib/utils/cipher/CryptoCipherUtils.d.ts +1 -3
  532. package/lib/utils/cipher/CryptoCipherUtils.js +16 -53
  533. package/lib/utils/cipher/ICipherUtils.d.ts +2 -1
  534. package/lib/utils/cipher/ICipherUtils.js +1 -2
  535. package/lib/utils/cipher/SubtleCryptoCipherUtils.js +31 -78
  536. package/lib/utils/cipher/index.js +2 -18
  537. package/lib/utils/constants.d.ts +2 -1
  538. package/lib/utils/constants.js +11 -13
  539. package/lib/utils/cookie_parser/ICookieParser.js +1 -2
  540. package/lib/utils/cookie_parser/{DefaultCookieParser.d.ts → StringSplitCookieParser.d.ts} +2 -1
  541. package/lib/utils/cookie_parser/StringSplitCookieParser.js +28 -0
  542. package/lib/utils/cookie_parser/index.d.ts +2 -2
  543. package/lib/utils/cookie_parser/index.js +2 -5
  544. package/lib/utils/error/EnforcerError.js +6 -28
  545. package/lib/utils/error/EnforcerErrorName.js +2 -5
  546. package/lib/utils/error/EnforcerTimeoutError.js +7 -29
  547. package/lib/utils/error/index.js +3 -9
  548. package/lib/utils/hash/CryptoHashUtils.d.ts +11 -0
  549. package/lib/utils/hash/CryptoHashUtils.js +20 -0
  550. package/lib/utils/hash/IHashUtils.d.ts +2 -1
  551. package/lib/utils/hash/IHashUtils.js +1 -2
  552. package/lib/utils/hash/SubtleCryptoHashUtils.d.ts +8 -0
  553. package/lib/utils/hash/SubtleCryptoHashUtils.js +31 -0
  554. package/lib/utils/hash/index.d.ts +2 -2
  555. package/lib/utils/hash/index.js +3 -19
  556. package/lib/utils/{hash → hmac}/CryptoHmacUtils.d.ts +2 -2
  557. package/lib/utils/hmac/CryptoHmacUtils.js +19 -0
  558. package/lib/utils/{hash → hmac}/CryptoJSHmacUtils.d.ts +2 -2
  559. package/lib/utils/hmac/CryptoJSHmacUtils.js +12 -0
  560. package/lib/utils/hmac/IHmacUtils.d.ts +4 -0
  561. package/lib/utils/hmac/IHmacUtils.js +1 -0
  562. package/lib/utils/hmac/index.d.ts +3 -0
  563. package/lib/utils/hmac/index.js +3 -0
  564. package/lib/utils/index.d.ts +5 -6
  565. package/lib/utils/index.js +13 -34
  566. package/lib/utils/ip_range_checker/DefaultIpRangeChecker.js +5 -12
  567. package/lib/utils/ip_range_checker/IIpRangeChecker.js +1 -2
  568. package/lib/utils/ip_range_checker/index.js +1 -5
  569. package/lib/utils/request_id_generator/IRequestIdGenerator.d.ts +3 -0
  570. package/lib/utils/request_id_generator/IRequestIdGenerator.js +1 -0
  571. package/lib/utils/request_id_generator/UuidRequestIdGenerator.d.ts +4 -0
  572. package/lib/utils/request_id_generator/UuidRequestIdGenerator.js +6 -0
  573. package/lib/utils/request_id_generator/index.d.ts +2 -0
  574. package/lib/utils/request_id_generator/index.js +1 -0
  575. package/lib/utils/utils.d.ts +5 -2
  576. package/lib/utils/utils.js +52 -97
  577. package/package.json +5 -2
  578. package/lib/block_handler/BlockAction.js +0 -21
  579. package/lib/block_handler/BlockReason.js +0 -8
  580. package/lib/block_handler/DefaultBlockResponseGenerator.d.ts +0 -14
  581. package/lib/block_handler/DefaultBlockResponseGenerator.js +0 -55
  582. package/lib/block_handler/IBlockResponseGenerator.d.ts +0 -14
  583. package/lib/block_handler/IBlockResponseGenerator.js +0 -2
  584. package/lib/block_handler/captcha/CaptchaBlockResponseGenerator.d.ts +0 -14
  585. package/lib/block_handler/captcha/CaptchaBlockResponseGenerator.js +0 -30
  586. package/lib/block_handler/captcha/HtmlCaptchaResponseGenerator.d.ts +0 -10
  587. package/lib/block_handler/captcha/HtmlCaptchaResponseGenerator.js +0 -29
  588. package/lib/block_handler/captcha/JsonCaptchaResponseGenerator.d.ts +0 -10
  589. package/lib/block_handler/captcha/JsonCaptchaResponseGenerator.js +0 -47
  590. package/lib/block_handler/captcha/MobileCaptchaResponseGenerator.d.ts +0 -12
  591. package/lib/block_handler/captcha/MobileCaptchaResponseGenerator.js +0 -41
  592. package/lib/block_handler/index.d.ts +0 -13
  593. package/lib/block_handler/index.js +0 -21
  594. package/lib/block_handler/model/BlockData.js +0 -2
  595. package/lib/block_handler/model/JsonBlockPayload.js +0 -2
  596. package/lib/block_handler/model/MobileBlockPayload.js +0 -2
  597. package/lib/block_handler/templates/captcha_template.js +0 -4
  598. package/lib/block_handler/templates/rate_limit_template.js +0 -4
  599. package/lib/block_handler/utils.d.ts +0 -5
  600. package/lib/block_handler/utils.js +0 -48
  601. package/lib/context/ContextBase.d.ts +0 -57
  602. package/lib/context/ContextBase.js +0 -147
  603. package/lib/context/DefaultTokenV2Context.d.ts +0 -13
  604. package/lib/context/DefaultTokenV2Context.js +0 -35
  605. package/lib/context/DefaultTokenV3Context.d.ts +0 -13
  606. package/lib/context/DefaultTokenV3Context.js +0 -35
  607. package/lib/context/IContext.d.ts +0 -264
  608. package/lib/context/IContext.js +0 -2
  609. package/lib/filter/DefaultFilter.d.ts +0 -16
  610. package/lib/filter/DefaultFilter.js +0 -59
  611. package/lib/first_party/DefaultFirstParty.d.ts +0 -22
  612. package/lib/first_party/DefaultFirstParty.js +0 -227
  613. package/lib/first_party/constants.js +0 -37
  614. package/lib/first_party/utils.d.ts +0 -9
  615. package/lib/first_party/utils.js +0 -29
  616. package/lib/http/interfaces/ReadOnlyHeaders.d.ts +0 -4
  617. package/lib/http/interfaces/ReadOnlyHeaders.js +0 -19
  618. package/lib/risk_api/PostRiskApiClient.d.ts +0 -43
  619. package/lib/risk_api/PostRiskApiClient.js +0 -265
  620. package/lib/risk_api/S2SCallReason.js +0 -16
  621. package/lib/risk_api/S2SErrorHandler.d.ts +0 -9
  622. package/lib/risk_api/S2SErrorHandler.js +0 -121
  623. package/lib/risk_api/model/RiskResponseV2.js +0 -2
  624. package/lib/risk_api/model/RiskResponseV3.js +0 -2
  625. package/lib/risk_api/risk_response_handler/IRiskResponseHandler.d.ts +0 -5
  626. package/lib/risk_api/risk_response_handler/IRiskResponseHandler.js +0 -2
  627. package/lib/risk_api/risk_response_handler/RiskResponseHandlerBase.d.ts +0 -16
  628. package/lib/risk_api/risk_response_handler/RiskResponseHandlerBase.js +0 -73
  629. package/lib/risk_api/risk_response_handler/RiskResponseV2Handler.d.ts +0 -10
  630. package/lib/risk_api/risk_response_handler/RiskResponseV2Handler.js +0 -55
  631. package/lib/risk_api/risk_response_handler/RiskResponseV3Handler.d.ts +0 -10
  632. package/lib/risk_api/risk_response_handler/RiskResponseV3Handler.js +0 -57
  633. package/lib/risk_token/MobileErrorHandler.d.ts +0 -9
  634. package/lib/risk_token/MobileErrorHandler.js +0 -100
  635. package/lib/risk_token/RiskTokenScoreRetriever.d.ts +0 -14
  636. package/lib/risk_token/RiskTokenScoreRetriever.js +0 -148
  637. package/lib/risk_token/TokenVerificationResult.js +0 -10
  638. package/lib/risk_token/token/BotDefenderTokenBase.d.ts +0 -29
  639. package/lib/risk_token/token/BotDefenderTokenBase.js +0 -95
  640. package/lib/risk_token/token/IBotDefenderToken.js +0 -2
  641. package/lib/risk_token/token/v2/BotDefenderTokenV2Payload.js +0 -2
  642. package/lib/risk_token/token/v2/DefaultBotDefenderTokenV2.d.ts +0 -26
  643. package/lib/risk_token/token/v2/DefaultBotDefenderTokenV2.js +0 -206
  644. package/lib/risk_token/token/v3/BotDefenderTokenV3Payload.d.ts +0 -9
  645. package/lib/risk_token/token/v3/BotDefenderTokenV3Payload.js +0 -2
  646. package/lib/risk_token/token/v3/DefaultBotDefenderTokenV3.d.ts +0 -29
  647. package/lib/risk_token/token/v3/DefaultBotDefenderTokenV3.js +0 -231
  648. package/lib/utils/IScoreRetriever.d.ts +0 -14
  649. package/lib/utils/IScoreRetriever.js +0 -2
  650. package/lib/utils/PassReason.js +0 -10
  651. package/lib/utils/cookie_parser/DefaultCookieParser.js +0 -13
  652. package/lib/utils/hash/CryptoHmacUtils.js +0 -25
  653. package/lib/utils/hash/CryptoJSHmacUtils.js +0 -19
  654. package/lib/utils/uuid_generator/DefaultUuidGenerator.d.ts +0 -4
  655. package/lib/utils/uuid_generator/DefaultUuidGenerator.js +0 -13
  656. package/lib/utils/uuid_generator/IUuidGenerator.d.ts +0 -3
  657. package/lib/utils/uuid_generator/IUuidGenerator.js +0 -2
  658. package/lib/utils/uuid_generator/index.d.ts +0 -2
  659. package/lib/utils/uuid_generator/index.js +0 -5
  660. /package/lib/{block_handler → products/bot_defender/block}/model/JsonBlockPayload.d.ts +0 -0
  661. /package/lib/{block_handler → products/bot_defender/block}/model/MobileBlockPayload.d.ts +0 -0
  662. /package/lib/{block_handler → products/bot_defender/block}/templates/captcha_template.d.ts +0 -0
  663. /package/lib/{block_handler → products/bot_defender/block}/templates/rate_limit_template.d.ts +0 -0
  664. /package/lib/risk_api/{S2SErrorReason.d.ts → model/S2SErrorReason.d.ts} +0 -0
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
2
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
3
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -8,178 +7,113 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
8
  });
10
9
  };
11
- var __generator = (this && this.__generator) || function (thisArg, body) {
12
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
- function verb(n) { return function (v) { return step([n, v]); }; }
15
- function step(op) {
16
- if (f) throw new TypeError("Generator is already executing.");
17
- while (_) try {
18
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
- if (y = 0, t) op = [op[0] & 2, t.value];
20
- switch (op[0]) {
21
- case 0: case 1: t = op; break;
22
- case 4: _.label++; return { value: op[1], done: false };
23
- case 5: _.label++; y = op[1]; op = [0]; continue;
24
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
- default:
26
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
- if (t[2]) _.ops.pop();
31
- _.trys.pop(); continue;
32
- }
33
- op = body.call(thisArg, _);
34
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
- }
37
- };
38
- Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.DefaultTelemetry = void 0;
40
- var http_1 = require("../http");
41
- var activities_1 = require("../activities");
42
- var utils_1 = require("../utils");
43
- var constants_1 = require("./constants");
44
- var __1 = require("..");
45
- var __2 = require("..");
46
- var DefaultTelemetry = /** @class */ (function () {
47
- function DefaultTelemetry(config, httpClient, base64Utils, hashUtils) {
10
+ import { AUTHORIZATION_HEADER_NAME, CONTENT_TYPE_HEADER_NAME, ContentType, HttpMethod, OutgoingRequestImpl, } from '../http';
11
+ import { ActivityType } from '../activities';
12
+ import { getAuthorizationHeader, Algorithm, removeSensitiveFields, transferExistingProperties, } from '../utils';
13
+ import { TELEMETRY_ENDPOINT, TELEMETRY_HEADER_DELIMITER, TELEMETRY_HEADER_HMAC_INDEX, TELEMETRY_HEADER_NAME, TELEMETRY_HEADER_PART_COUNT, TELEMETRY_HEADER_TIMESTAMP_INDEX, TELEMETRY_UPDATE_REASON, } from './constants';
14
+ export class DefaultTelemetry {
15
+ constructor(config, httpClient, base64Utils, hmacUtils) {
48
16
  this.config = config;
49
17
  this.httpClient = httpClient;
50
18
  this.base64Utils = base64Utils;
51
- this.hashUtils = hashUtils;
19
+ this.hmacUtils = hmacUtils;
52
20
  }
53
- DefaultTelemetry.prototype.isValidTelemetryRequest = function (context) {
54
- return __awaiter(this, void 0, void 0, function () {
55
- var telemetryHeader, _a, e_1;
56
- return __generator(this, function (_b) {
57
- switch (_b.label) {
58
- case 0:
59
- _b.trys.push([0, 3, , 4]);
60
- telemetryHeader = this.getTelemetryHeader(context);
61
- _a = !!telemetryHeader;
62
- if (!_a) return [3 /*break*/, 2];
63
- return [4 /*yield*/, this.isTelemetryHeaderValid(telemetryHeader)];
64
- case 1:
65
- _a = (_b.sent());
66
- _b.label = 2;
67
- case 2: return [2 /*return*/, _a];
68
- case 3:
69
- e_1 = _b.sent();
70
- this.config.logger.debug("error validating telemetry - ".concat(e_1));
71
- return [2 /*return*/, false];
72
- case 4: return [2 /*return*/];
73
- }
74
- });
21
+ isValidTelemetryRequest(context) {
22
+ return __awaiter(this, void 0, void 0, function* () {
23
+ try {
24
+ const telemetryHeader = this.getTelemetryHeader(context);
25
+ return !!telemetryHeader && (yield this.isTelemetryHeaderValid(telemetryHeader));
26
+ }
27
+ catch (e) {
28
+ this.config.logger.debug(`error validating telemetry - ${e}`);
29
+ return false;
30
+ }
75
31
  });
76
- };
77
- DefaultTelemetry.prototype.sendTelemetry = function (context) {
78
- return __awaiter(this, void 0, void 0, function () {
79
- var e_2;
80
- return __generator(this, function (_a) {
81
- switch (_a.label) {
82
- case 0:
83
- _a.trys.push([0, 2, , 3]);
84
- return [4 /*yield*/, this.sendTelemetryActivity(context)];
85
- case 1:
86
- _a.sent();
87
- return [3 /*break*/, 3];
88
- case 2:
89
- e_2 = _a.sent();
90
- this.config.logger.debug("error sending telemetry - ".concat(e_2));
91
- return [3 /*break*/, 3];
92
- case 3: return [2 /*return*/];
93
- }
94
- });
32
+ }
33
+ sendTelemetry(context) {
34
+ return __awaiter(this, void 0, void 0, function* () {
35
+ try {
36
+ yield this.sendTelemetryActivity(context);
37
+ }
38
+ catch (e) {
39
+ this.config.logger.debug(`error sending telemetry - ${e}`);
40
+ }
95
41
  });
96
- };
97
- DefaultTelemetry.prototype.getTelemetryHeader = function (context) {
98
- return context.requestData.request.headers.get(constants_1.TELEMETRY_HEADER_NAME) || '';
99
- };
100
- DefaultTelemetry.prototype.isTelemetryHeaderValid = function (headerValue) {
101
- return __awaiter(this, void 0, void 0, function () {
102
- var decodedValue, splitValue, timestamp, givenHmac, curUnixTime, timestampNumber;
103
- return __generator(this, function (_a) {
104
- this.config.logger.debug('received command to send enforcer telemetry');
105
- decodedValue = this.base64Utils.base64Decode(headerValue);
106
- splitValue = decodedValue.split(constants_1.TELEMETRY_HEADER_DELIMITER);
107
- if (splitValue.length !== constants_1.TELEMETRY_HEADER_PART_COUNT) {
108
- this.config.logger.debug("malformed ".concat(constants_1.TELEMETRY_HEADER_NAME, " header: ").concat(decodedValue));
109
- return [2 /*return*/, false];
110
- }
111
- timestamp = splitValue[constants_1.TELEMETRY_HEADER_TIMESTAMP_INDEX];
112
- givenHmac = splitValue[constants_1.TELEMETRY_HEADER_HMAC_INDEX];
113
- if (!this.isTelemetryHmacValid(givenHmac, timestamp)) {
114
- this.config.logger.debug("".concat(constants_1.TELEMETRY_HEADER_NAME, " hmac validation failed. original hmac: ").concat(givenHmac, ", timestamp: ").concat(timestamp, "."));
115
- return [2 /*return*/, false];
116
- }
117
- curUnixTime = +new Date();
118
- timestampNumber = parseInt ? parseInt(timestamp) : Number(timestamp);
119
- if (isNaN(timestampNumber) || timestampNumber < curUnixTime) {
120
- this.config.logger.debug("".concat(constants_1.TELEMETRY_HEADER_NAME, " timestamp expired: ").concat(timestamp, " < ").concat(curUnixTime));
121
- return [2 /*return*/, false];
122
- }
123
- return [2 /*return*/, true];
124
- });
42
+ }
43
+ getTelemetryHeader(context) {
44
+ return context.requestData.request.headers.get(TELEMETRY_HEADER_NAME) || '';
45
+ }
46
+ isTelemetryHeaderValid(headerValue) {
47
+ return __awaiter(this, void 0, void 0, function* () {
48
+ this.config.logger.debug('received command to send enforcer telemetry');
49
+ const decodedValue = this.base64Utils.base64Decode(headerValue);
50
+ const splitValue = decodedValue.split(TELEMETRY_HEADER_DELIMITER);
51
+ if (splitValue.length !== TELEMETRY_HEADER_PART_COUNT) {
52
+ this.config.logger.debug(`malformed ${TELEMETRY_HEADER_NAME} header: ${decodedValue}`);
53
+ return false;
54
+ }
55
+ const timestamp = splitValue[TELEMETRY_HEADER_TIMESTAMP_INDEX];
56
+ const givenHmac = splitValue[TELEMETRY_HEADER_HMAC_INDEX];
57
+ if (!this.isTelemetryHmacValid(givenHmac, timestamp)) {
58
+ this.config.logger.debug(`${TELEMETRY_HEADER_NAME} hmac validation failed. original hmac: ${givenHmac}, timestamp: ${timestamp}.`);
59
+ return false;
60
+ }
61
+ const curUnixTime = +new Date();
62
+ const timestampNumber = parseInt ? parseInt(timestamp) : Number(timestamp);
63
+ if (isNaN(timestampNumber) || timestampNumber < curUnixTime) {
64
+ this.config.logger.debug(`${TELEMETRY_HEADER_NAME} timestamp expired: ${timestamp} < ${curUnixTime}`);
65
+ return false;
66
+ }
67
+ return true;
125
68
  });
126
- };
127
- DefaultTelemetry.prototype.isTelemetryHmacValid = function (givenHmac, timestamp) {
69
+ }
70
+ isTelemetryHmacValid(givenHmac, timestamp) {
128
71
  try {
129
- return givenHmac === this.hashUtils.createHmac(utils_1.Algorithm.SHA256, timestamp, this.config.cookieSecret);
72
+ return givenHmac === this.hmacUtils.createHmac(Algorithm.SHA256, timestamp, this.config.cookieSecret);
130
73
  }
131
74
  catch (e) {
132
- this.config.logger.debug("caught error validating telemetry hmac: ".concat(e));
75
+ this.config.logger.debug(`caught error validating telemetry hmac: ${e}`);
133
76
  return false;
134
77
  }
135
- };
136
- DefaultTelemetry.prototype.sendTelemetryActivity = function (context) {
137
- return __awaiter(this, void 0, void 0, function () {
138
- var telemetryRequest;
139
- return __generator(this, function (_a) {
140
- switch (_a.label) {
141
- case 0:
142
- telemetryRequest = this.createTelemetryRequest(context);
143
- this.config.logger.debug("sending telemetry to ".concat(telemetryRequest.url));
144
- return [4 /*yield*/, this.httpClient.send(telemetryRequest)];
145
- case 1:
146
- _a.sent();
147
- return [2 /*return*/];
148
- }
149
- });
78
+ }
79
+ sendTelemetryActivity(context) {
80
+ return __awaiter(this, void 0, void 0, function* () {
81
+ const telemetryRequest = this.createTelemetryRequest(context);
82
+ this.config.logger.debug(`sending telemetry to ${telemetryRequest.url}`);
83
+ yield this.httpClient.send(telemetryRequest);
150
84
  });
151
- };
152
- DefaultTelemetry.prototype.createTelemetryRequest = function (context) {
153
- var _a;
154
- var url = "".concat(this.config.backendScoreApiUrl).concat(constants_1.TELEMETRY_ENDPOINT);
155
- var method = __1.HttpMethod.POST;
156
- var headers = (_a = {},
157
- _a[http_1.CONTENT_TYPE_HEADER_NAME] = [http_1.ContentType.APPLICATION_JSON],
158
- _a[http_1.AUTHORIZATION_HEADER_NAME] = [(0, utils_1.getAuthorizationHeader)(this.config.authToken)],
159
- _a);
160
- var activity = this.createTelemetryActivity(context);
161
- return new __2.OutgoingRequestImpl({ url: url, method: method, headers: headers, body: JSON.stringify(activity) });
162
- };
163
- DefaultTelemetry.prototype.createTelemetryActivity = function (context) {
164
- var SENSITIVE_CONFIG_FIELDS = ['px_auth_token', 'px_cookie_secret'];
165
- var config = this.config.toParams();
166
- config = (0, utils_1.removeSensitiveFields)(config, SENSITIVE_CONFIG_FIELDS);
167
- var activity = {
168
- type: activities_1.ActivityType.ENFORCER_TELEMETRY,
85
+ }
86
+ createTelemetryRequest(context) {
87
+ const url = `${this.config.backendScoreApiUrl}${TELEMETRY_ENDPOINT}`;
88
+ const method = HttpMethod.POST;
89
+ const headers = {
90
+ [CONTENT_TYPE_HEADER_NAME]: [ContentType.APPLICATION_JSON],
91
+ [AUTHORIZATION_HEADER_NAME]: [getAuthorizationHeader(this.config.authToken)],
92
+ };
93
+ const activity = this.createTelemetryActivity(context);
94
+ return new OutgoingRequestImpl({ url: url, method: method, headers: headers, body: JSON.stringify(activity) });
95
+ }
96
+ createTelemetryActivity(context) {
97
+ const SENSITIVE_CONFIG_FIELDS = [
98
+ 'px_auth_token',
99
+ 'px_cookie_secret',
100
+ ];
101
+ let config = this.config.toParams();
102
+ config = removeSensitiveFields(config, SENSITIVE_CONFIG_FIELDS);
103
+ const activity = {
104
+ type: ActivityType.ENFORCER_TELEMETRY,
169
105
  timestamp: Date.now(),
170
106
  px_app_id: this.config.appId,
171
107
  details: {
172
- update_reason: constants_1.TELEMETRY_UPDATE_REASON,
108
+ update_reason: TELEMETRY_UPDATE_REASON,
173
109
  module_version: this.config.moduleVersion,
174
110
  enforcer_configs: config,
175
111
  },
176
112
  };
177
- (0, utils_1.transferExistingProperties)(context.serverData, activity.details, {
113
+ transferExistingProperties(context.serverData, activity.details, {
178
114
  osName: 'os_name',
179
115
  nodeName: 'node_name',
180
116
  });
181
117
  return activity;
182
- };
183
- return DefaultTelemetry;
184
- }());
185
- exports.DefaultTelemetry = DefaultTelemetry;
118
+ }
119
+ }
@@ -1,13 +1,13 @@
1
- import { IContext } from '../context';
2
- export interface ITelemetry {
1
+ import { ReadonlyContext } from '../context';
2
+ export interface ITelemetry<Req, Res> {
3
3
  /**
4
4
  * @param context - The request context.
5
5
  * @returns Promise<boolean> - A Promise resolving to a boolean that indicates whether the request is a valid telemetry request.
6
6
  */
7
- isValidTelemetryRequest(context: IContext): Promise<boolean>;
7
+ isValidTelemetryRequest(context: ReadonlyContext<Req, Res>): Promise<boolean>;
8
8
  /**
9
9
  * @param context - The request context.
10
10
  * @returns void
11
11
  */
12
- sendTelemetry(context: IContext): Promise<void>;
12
+ sendTelemetry(context: ReadonlyContext<Req, Res>): Promise<void>;
13
13
  }
@@ -1,2 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
@@ -1,10 +1,7 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TELEMETRY_UPDATE_REASON = exports.TELEMETRY_ENDPOINT = exports.TELEMETRY_HEADER_NAME = exports.TELEMETRY_HEADER_PART_COUNT = exports.TELEMETRY_HEADER_HMAC_INDEX = exports.TELEMETRY_HEADER_TIMESTAMP_INDEX = exports.TELEMETRY_HEADER_DELIMITER = void 0;
4
- exports.TELEMETRY_HEADER_DELIMITER = ':';
5
- exports.TELEMETRY_HEADER_TIMESTAMP_INDEX = 0;
6
- exports.TELEMETRY_HEADER_HMAC_INDEX = 1;
7
- exports.TELEMETRY_HEADER_PART_COUNT = 2;
8
- exports.TELEMETRY_HEADER_NAME = 'x-px-enforcer-telemetry';
9
- exports.TELEMETRY_ENDPOINT = '/api/v2/risk/telemetry';
10
- exports.TELEMETRY_UPDATE_REASON = 'command';
1
+ export const TELEMETRY_HEADER_DELIMITER = ':';
2
+ export const TELEMETRY_HEADER_TIMESTAMP_INDEX = 0;
3
+ export const TELEMETRY_HEADER_HMAC_INDEX = 1;
4
+ export const TELEMETRY_HEADER_PART_COUNT = 2;
5
+ export const TELEMETRY_HEADER_NAME = 'x-px-enforcer-telemetry';
6
+ export const TELEMETRY_ENDPOINT = '/api/v2/risk/telemetry';
7
+ export const TELEMETRY_UPDATE_REASON = 'command';
@@ -1,20 +1,2 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.DefaultTelemetry = void 0;
18
- var DefaultTelemetry_1 = require("./DefaultTelemetry");
19
- Object.defineProperty(exports, "DefaultTelemetry", { enumerable: true, get: function () { return DefaultTelemetry_1.DefaultTelemetry; } });
20
- __exportStar(require("./constants"), exports);
1
+ export { DefaultTelemetry } from './DefaultTelemetry';
2
+ export * from './constants';
@@ -1,7 +1,7 @@
1
1
  import { ActivityType } from '../../activities';
2
2
  import { ConfigurationParams } from '../../config';
3
3
  export declare type TelemetryActivityDetails = {
4
- enforcer_configs: ConfigurationParams;
4
+ enforcer_configs: ConfigurationParams<unknown, unknown>;
5
5
  module_version: string;
6
6
  update_reason: 'command';
7
7
  node_name?: string;
@@ -1,2 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
@@ -1,8 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Algorithm = void 0;
4
- var Algorithm;
1
+ export var Algorithm;
5
2
  (function (Algorithm) {
6
3
  Algorithm["SHA256"] = "sha256";
7
4
  Algorithm["AES_CBC"] = "aes_cbc";
8
- })(Algorithm = exports.Algorithm || (exports.Algorithm = {}));
5
+ })(Algorithm || (Algorithm = {}));
@@ -1,8 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ModuleMode = void 0;
4
- var ModuleMode;
1
+ export var ModuleMode;
5
2
  (function (ModuleMode) {
6
3
  ModuleMode["MONITOR"] = "monitor";
7
4
  ModuleMode["ACTIVE_BLOCKING"] = "active_blocking";
8
- })(ModuleMode = exports.ModuleMode || (exports.ModuleMode = {}));
5
+ })(ModuleMode || (ModuleMode = {}));
@@ -1,8 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.VidSource = void 0;
4
- var VidSource;
1
+ export var VidSource;
5
2
  (function (VidSource) {
6
3
  VidSource["VID_COOKIE"] = "vid_cookie";
7
4
  VidSource["RISK_COOKIE"] = "risk_cookie";
8
- })(VidSource = exports.VidSource || (exports.VidSource = {}));
5
+ })(VidSource || (VidSource = {}));
@@ -1,15 +1,8 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AtobBase64Utils = void 0;
4
- var AtobBase64Utils = /** @class */ (function () {
5
- function AtobBase64Utils() {
6
- }
7
- AtobBase64Utils.prototype.base64Decode = function (stringToDecode) {
1
+ export class AtobBase64Utils {
2
+ base64Decode(stringToDecode) {
8
3
  return atob(stringToDecode);
9
- };
10
- AtobBase64Utils.prototype.base64Encode = function (stringToEncode) {
4
+ }
5
+ base64Encode(stringToEncode) {
11
6
  return btoa(stringToEncode);
12
- };
13
- return AtobBase64Utils;
14
- }());
15
- exports.AtobBase64Utils = AtobBase64Utils;
7
+ }
8
+ }
@@ -1,18 +1,11 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BufferBase64Utils = void 0;
4
- var BufferBase64Utils = /** @class */ (function () {
5
- function BufferBase64Utils() {
1
+ export class BufferBase64Utils {
2
+ base64Decode(stringToDecode) {
3
+ const buffer = Buffer.from(stringToDecode, BufferBase64Utils.BASE_64_ENCODING);
4
+ return buffer.toString('utf8');
6
5
  }
7
- BufferBase64Utils.prototype.base64Decode = function (stringToDecode) {
8
- var buffer = Buffer.from(stringToDecode, BufferBase64Utils.BASE_64_ENCODING);
9
- return buffer.toString();
10
- };
11
- BufferBase64Utils.prototype.base64Encode = function (stringToEncode) {
12
- var buffer = Buffer.from(stringToEncode);
6
+ base64Encode(stringToEncode) {
7
+ const buffer = Buffer.from(stringToEncode, 'utf8');
13
8
  return buffer.toString(BufferBase64Utils.BASE_64_ENCODING);
14
- };
15
- BufferBase64Utils.BASE_64_ENCODING = 'base64';
16
- return BufferBase64Utils;
17
- }());
18
- exports.BufferBase64Utils = BufferBase64Utils;
9
+ }
10
+ }
11
+ BufferBase64Utils.BASE_64_ENCODING = 'base64';
@@ -1,2 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
@@ -1,16 +1,9 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.JSBase64Base64Utils = void 0;
4
- var js_base64_1 = require("js-base64");
5
- var JSBase64Base64Utils = /** @class */ (function () {
6
- function JSBase64Base64Utils() {
1
+ import { encode, decode } from 'js-base64';
2
+ export class JSBase64Base64Utils {
3
+ base64Encode(stringToEncode) {
4
+ return encode(stringToEncode);
7
5
  }
8
- JSBase64Base64Utils.prototype.base64Encode = function (stringToEncode) {
9
- return (0, js_base64_1.encode)(stringToEncode);
10
- };
11
- JSBase64Base64Utils.prototype.base64Decode = function (stringToDecode) {
12
- return (0, js_base64_1.decode)(stringToDecode);
13
- };
14
- return JSBase64Base64Utils;
15
- }());
16
- exports.JSBase64Base64Utils = JSBase64Base64Utils;
6
+ base64Decode(stringToDecode) {
7
+ return decode(stringToDecode);
8
+ }
9
+ }
@@ -1,20 +1,4 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./IBase64Utils"), exports);
18
- __exportStar(require("./JSBase64Base64Utils"), exports);
19
- __exportStar(require("./BufferBase64Utils"), exports);
20
- __exportStar(require("./AtobBase64Utils"), exports);
1
+ export * from './IBase64Utils';
2
+ export * from './JSBase64Base64Utils';
3
+ export * from './BufferBase64Utils';
4
+ export * from './AtobBase64Utils';
@@ -1,12 +1,10 @@
1
1
  /// <reference types="node" />
2
2
  import * as crypto from 'crypto';
3
- import { IBase64Utils } from '../base64';
4
3
  import { ICipherUtils, Pbkdf2DecryptOptions } from './ICipherUtils';
5
4
  declare type CryptoModule = typeof crypto;
6
5
  export declare class CryptoCipherUtils implements ICipherUtils {
7
6
  private crypto;
8
- private base64Utils;
9
- constructor(base64Utils: IBase64Utils, cryptoModule?: CryptoModule);
7
+ constructor(cryptoModule?: CryptoModule);
10
8
  pbkdf2Decrypt(secret: string, encryptedString: string, iterations: number, salt: string, options?: Pbkdf2DecryptOptions): Promise<string>;
11
9
  }
12
10
  export {};
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
2
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
3
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -8,58 +7,22 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
8
  });
10
9
  };
11
- var __generator = (this && this.__generator) || function (thisArg, body) {
12
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
- function verb(n) { return function (v) { return step([n, v]); }; }
15
- function step(op) {
16
- if (f) throw new TypeError("Generator is already executing.");
17
- while (_) try {
18
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
- if (y = 0, t) op = [op[0] & 2, t.value];
20
- switch (op[0]) {
21
- case 0: case 1: t = op; break;
22
- case 4: _.label++; return { value: op[1], done: false };
23
- case 5: _.label++; y = op[1]; op = [0]; continue;
24
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
- default:
26
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
- if (t[2]) _.ops.pop();
31
- _.trys.pop(); continue;
32
- }
33
- op = body.call(thisArg, _);
34
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
- }
37
- };
38
- Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.CryptoCipherUtils = void 0;
40
- var crypto = require("crypto");
41
- var CryptoCipherUtils = /** @class */ (function () {
42
- function CryptoCipherUtils(base64Utils, cryptoModule) {
43
- if (cryptoModule === void 0) { cryptoModule = crypto; }
10
+ import * as crypto from 'crypto';
11
+ export class CryptoCipherUtils {
12
+ constructor(cryptoModule = crypto) {
44
13
  this.crypto = cryptoModule;
45
- this.base64Utils = base64Utils;
46
14
  }
47
- CryptoCipherUtils.prototype.pbkdf2Decrypt = function (secret, encryptedString, iterations, salt, options) {
48
- return __awaiter(this, void 0, void 0, function () {
49
- var keylen, ivlen, derivation, key, iv, cipher, decrypted;
50
- return __generator(this, function (_a) {
51
- keylen = (options === null || options === void 0 ? void 0 : options.keylen) || 32;
52
- ivlen = (options === null || options === void 0 ? void 0 : options.ivlen) || 16;
53
- derivation = this.crypto.pbkdf2Sync(secret, this.base64Utils.base64Decode(salt), iterations, keylen + ivlen, 'sha256');
54
- key = derivation.subarray(0, keylen);
55
- iv = derivation.subarray(keylen);
56
- cipher = this.crypto.createDecipheriv('aes-256-cbc', key, iv);
57
- decrypted = cipher.update(encryptedString, 'base64', 'utf8');
58
- decrypted += cipher.final('utf8');
59
- return [2 /*return*/, decrypted];
60
- });
15
+ pbkdf2Decrypt(secret, encryptedString, iterations, salt, options) {
16
+ return __awaiter(this, void 0, void 0, function* () {
17
+ const keylen = (options === null || options === void 0 ? void 0 : options.keylen) || 32;
18
+ const ivlen = (options === null || options === void 0 ? void 0 : options.ivlen) || 16;
19
+ const derivation = this.crypto.pbkdf2Sync(secret, Buffer.from(salt, 'base64'), iterations, keylen + ivlen, 'sha256');
20
+ const key = derivation.subarray(0, keylen);
21
+ const iv = derivation.subarray(keylen);
22
+ const cipher = this.crypto.createDecipheriv('aes-256-cbc', key, iv);
23
+ let decrypted = cipher.update(encryptedString, 'base64', 'utf8');
24
+ decrypted += cipher.final('utf8');
25
+ return decrypted;
61
26
  });
62
- };
63
- return CryptoCipherUtils;
64
- }());
65
- exports.CryptoCipherUtils = CryptoCipherUtils;
27
+ }
28
+ }
@@ -1,7 +1,8 @@
1
+ import { AsyncOrSync } from 'ts-essentials';
1
2
  export declare type Pbkdf2DecryptOptions = {
2
3
  keylen?: number;
3
4
  ivlen?: number;
4
5
  };
5
6
  export interface ICipherUtils {
6
- pbkdf2Decrypt(secret: string, encryptedString: string, iterations: number, salt: string, options?: Pbkdf2DecryptOptions): string | Promise<string>;
7
+ pbkdf2Decrypt(secret: string, encryptedString: string, iterations: number, salt: string, options?: Pbkdf2DecryptOptions): AsyncOrSync<string>;
7
8
  }
@@ -1,2 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};