@mtkruto/node 0.1.0 → 0.1.101

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 (241) hide show
  1. package/esm/0_deps.d.ts +4 -3
  2. package/esm/0_deps.js +4 -3
  3. package/esm/4_constants.d.ts +1 -1
  4. package/esm/4_constants.js +1 -1
  5. package/esm/client/0_message.js +3 -9
  6. package/esm/client/3_types.d.ts +2 -0
  7. package/esm/client/4_client.d.ts +19 -3
  8. package/esm/client/4_client.js +209 -68
  9. package/esm/connection/1_connection_web_socket.js +5 -2
  10. package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_false.js +1 -0
  11. package/esm/deps/deno.land/std@0.203.0/crypto/_fnv/fnv32.d.ts +2 -0
  12. package/esm/deps/deno.land/std@0.203.0/crypto/_fnv/fnv32.js +24 -0
  13. package/esm/deps/deno.land/std@0.203.0/crypto/_fnv/fnv64.d.ts +2 -0
  14. package/esm/deps/deno.land/std@0.203.0/crypto/_fnv/fnv64.js +27 -0
  15. package/esm/deps/deno.land/std@0.203.0/crypto/_fnv/mod.d.ts +1 -0
  16. package/esm/deps/deno.land/std@0.203.0/crypto/_fnv/mod.js +21 -0
  17. package/esm/deps/deno.land/std@0.203.0/crypto/_fnv/util.d.ts +13 -0
  18. package/esm/deps/deno.land/std@0.203.0/crypto/_fnv/util.js +48 -0
  19. package/esm/deps/deno.land/std@0.203.0/crypto/_wasm/lib/deno_std_wasm_crypto.generated.d.ts +125 -0
  20. package/esm/deps/deno.land/std@0.203.0/crypto/_wasm/lib/deno_std_wasm_crypto.generated.js +3337 -0
  21. package/esm/deps/deno.land/std@0.203.0/crypto/_wasm/mod.d.ts +12 -0
  22. package/esm/deps/deno.land/std@0.203.0/crypto/_wasm/mod.js +39 -0
  23. package/esm/deps/deno.land/std@0.203.0/crypto/crypto.d.ts +157 -0
  24. package/esm/deps/deno.land/std@0.203.0/crypto/crypto.js +266 -0
  25. package/esm/deps/deno.land/std@0.203.0/crypto/keystack.d.ts +4 -0
  26. package/esm/deps/deno.land/std@0.203.0/crypto/keystack.js +6 -0
  27. package/esm/deps/deno.land/std@0.203.0/crypto/mod.d.ts +12 -0
  28. package/esm/deps/deno.land/std@0.203.0/crypto/mod.js +14 -0
  29. package/esm/deps/deno.land/std@0.203.0/crypto/timing_safe_equal.d.ts +28 -0
  30. package/esm/deps/deno.land/std@0.203.0/crypto/timing_safe_equal.js +54 -0
  31. package/esm/deps/deno.land/std@0.203.0/crypto/to_hash_string.d.ts +19 -0
  32. package/esm/deps/deno.land/std@0.203.0/crypto/to_hash_string.js +31 -0
  33. package/esm/deps/deno.land/std@0.203.0/crypto/unstable/keystack.d.ts +46 -0
  34. package/esm/deps/deno.land/std@0.203.0/crypto/unstable/keystack.js +149 -0
  35. package/esm/deps/deno.land/std@0.203.0/encoding/_util.d.ts +1 -0
  36. package/esm/deps/deno.land/std@0.203.0/encoding/_util.js +26 -0
  37. package/esm/deps/deno.land/std@0.203.0/encoding/base64.d.ts +23 -0
  38. package/{script/deps/deno.land/std@0.201.0 → esm/deps/deno.land/std@0.203.0}/encoding/base64.js +23 -18
  39. package/esm/deps/deno.land/std@0.203.0/encoding/base64url.d.ts +24 -0
  40. package/esm/deps/deno.land/std@0.203.0/encoding/base64url.js +80 -0
  41. package/esm/deps/deno.land/std@0.203.0/encoding/hex.d.ts +18 -0
  42. package/esm/deps/deno.land/std@0.203.0/encoding/hex.js +115 -0
  43. package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/fmt/colors.js +1 -1
  44. package/{script/deps/deno.land/x/tgcrypto@0.2.1 → esm/deps/deno.land/x/tgcrypto@0.3.3}/mod.d.ts +2 -6
  45. package/esm/deps/deno.land/x/tgcrypto@0.3.3/mod.js +164 -0
  46. package/esm/deps/deno.land/x/tgcrypto@0.3.3/tgcrypto.js +324 -0
  47. package/esm/transport/0_obfuscation.js +1 -1
  48. package/esm/transport/0_transport.js +2 -2
  49. package/esm/types/3_message.js +1 -1
  50. package/esm/utilities/0_bigint.d.ts +1 -0
  51. package/esm/utilities/0_bigint.js +1 -0
  52. package/esm/utilities/0_crypto.d.ts +1 -2
  53. package/esm/utilities/0_crypto.js +3 -12
  54. package/esm/utilities/0_queue.js +1 -1
  55. package/package.json +1 -1
  56. package/script/0_deps.d.ts +4 -3
  57. package/script/0_deps.js +7 -6
  58. package/script/4_constants.d.ts +1 -1
  59. package/script/4_constants.js +1 -1
  60. package/script/client/0_message.js +2 -8
  61. package/script/client/3_types.d.ts +2 -0
  62. package/script/client/4_client.d.ts +19 -3
  63. package/script/client/4_client.js +208 -66
  64. package/script/connection/1_connection_web_socket.js +5 -2
  65. package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_false.js +1 -0
  66. package/script/deps/deno.land/std@0.203.0/crypto/_fnv/fnv32.d.ts +2 -0
  67. package/script/deps/deno.land/std@0.203.0/crypto/_fnv/fnv32.js +29 -0
  68. package/script/deps/deno.land/std@0.203.0/crypto/_fnv/fnv64.d.ts +2 -0
  69. package/script/deps/deno.land/std@0.203.0/crypto/_fnv/fnv64.js +32 -0
  70. package/script/deps/deno.land/std@0.203.0/crypto/_fnv/mod.d.ts +1 -0
  71. package/script/deps/deno.land/std@0.203.0/crypto/_fnv/mod.js +25 -0
  72. package/script/deps/deno.land/std@0.203.0/crypto/_fnv/util.d.ts +13 -0
  73. package/script/deps/deno.land/std@0.203.0/crypto/_fnv/util.js +54 -0
  74. package/script/deps/deno.land/std@0.203.0/crypto/_wasm/lib/deno_std_wasm_crypto.generated.d.ts +125 -0
  75. package/script/deps/deno.land/std@0.203.0/crypto/_wasm/lib/deno_std_wasm_crypto.generated.js +3345 -0
  76. package/script/deps/deno.land/std@0.203.0/crypto/_wasm/mod.d.ts +12 -0
  77. package/script/deps/deno.land/std@0.203.0/crypto/_wasm/mod.js +44 -0
  78. package/script/deps/deno.land/std@0.203.0/crypto/crypto.d.ts +157 -0
  79. package/script/deps/deno.land/std@0.203.0/crypto/crypto.js +292 -0
  80. package/script/deps/deno.land/std@0.203.0/crypto/keystack.d.ts +4 -0
  81. package/script/deps/deno.land/std@0.203.0/crypto/keystack.js +22 -0
  82. package/script/deps/deno.land/std@0.203.0/crypto/mod.d.ts +12 -0
  83. package/script/deps/deno.land/std@0.203.0/crypto/mod.js +30 -0
  84. package/script/deps/deno.land/std@0.203.0/crypto/timing_safe_equal.d.ts +28 -0
  85. package/script/deps/deno.land/std@0.203.0/crypto/timing_safe_equal.js +58 -0
  86. package/script/deps/deno.land/std@0.203.0/crypto/to_hash_string.d.ts +19 -0
  87. package/script/deps/deno.land/std@0.203.0/crypto/to_hash_string.js +35 -0
  88. package/script/deps/deno.land/std@0.203.0/crypto/unstable/keystack.d.ts +46 -0
  89. package/script/deps/deno.land/std@0.203.0/crypto/unstable/keystack.js +176 -0
  90. package/script/deps/deno.land/std@0.203.0/encoding/_util.d.ts +1 -0
  91. package/script/deps/deno.land/std@0.203.0/encoding/_util.js +30 -0
  92. package/script/deps/deno.land/std@0.203.0/encoding/base64.d.ts +23 -0
  93. package/{esm/deps/deno.land/std@0.201.0 → script/deps/deno.land/std@0.203.0}/encoding/base64.js +28 -13
  94. package/script/deps/deno.land/std@0.203.0/encoding/base64url.d.ts +24 -0
  95. package/script/deps/deno.land/std@0.203.0/encoding/base64url.js +108 -0
  96. package/script/deps/deno.land/std@0.203.0/encoding/hex.d.ts +18 -0
  97. package/script/deps/deno.land/std@0.203.0/encoding/hex.js +122 -0
  98. package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/fmt/colors.js +1 -1
  99. package/{esm/deps/deno.land/x/tgcrypto@0.2.1 → script/deps/deno.land/x/tgcrypto@0.3.3}/mod.d.ts +2 -6
  100. package/script/deps/deno.land/x/tgcrypto@0.3.3/mod.js +177 -0
  101. package/script/deps/deno.land/x/tgcrypto@0.3.3/tgcrypto.js +326 -0
  102. package/script/transport/0_obfuscation.js +1 -1
  103. package/script/transport/0_transport.js +2 -2
  104. package/script/types/3_message.js +1 -1
  105. package/script/utilities/0_bigint.d.ts +1 -0
  106. package/script/utilities/0_bigint.js +1 -0
  107. package/script/utilities/0_crypto.d.ts +1 -2
  108. package/script/utilities/0_crypto.js +2 -11
  109. package/script/utilities/0_queue.js +1 -1
  110. package/esm/deps/deno.land/std@0.201.0/encoding/base64.d.ts +0 -11
  111. package/esm/deps/deno.land/x/tgcrypto@0.2.1/mod.js +0 -81
  112. package/esm/deps/deno.land/x/tgcrypto@0.2.1/tgcrypto.js +0 -991
  113. package/script/deps/deno.land/std@0.201.0/encoding/base64.d.ts +0 -11
  114. package/script/deps/deno.land/x/tgcrypto@0.2.1/mod.js +0 -95
  115. package/script/deps/deno.land/x/tgcrypto@0.2.1/tgcrypto.js +0 -993
  116. package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/_constants.d.ts +0 -0
  117. package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/_constants.js +0 -0
  118. package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/_diff.d.ts +0 -0
  119. package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/_diff.js +0 -0
  120. package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/_format.d.ts +0 -0
  121. package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/_format.js +0 -0
  122. package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert.d.ts +0 -0
  123. package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert.js +0 -0
  124. package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_almost_equals.d.ts +0 -0
  125. package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_almost_equals.js +0 -0
  126. package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_array_includes.d.ts +0 -0
  127. package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_array_includes.js +0 -0
  128. package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_equals.d.ts +0 -0
  129. package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_equals.js +0 -0
  130. package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_exists.d.ts +0 -0
  131. package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_exists.js +0 -0
  132. package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_false.d.ts +1 -1
  133. package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_greater.d.ts +0 -0
  134. package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_greater.js +0 -0
  135. package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_greater_or_equal.d.ts +0 -0
  136. package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_greater_or_equal.js +0 -0
  137. package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_instance_of.d.ts +0 -0
  138. package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_instance_of.js +0 -0
  139. package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_is_error.d.ts +0 -0
  140. package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_is_error.js +0 -0
  141. package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_less.d.ts +0 -0
  142. package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_less.js +0 -0
  143. package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_less_or_equal.d.ts +0 -0
  144. package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_less_or_equal.js +0 -0
  145. package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_match.d.ts +0 -0
  146. package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_match.js +0 -0
  147. package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_not_equals.d.ts +0 -0
  148. package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_not_equals.js +0 -0
  149. package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_not_instance_of.d.ts +0 -0
  150. package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_not_instance_of.js +0 -0
  151. package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_not_match.d.ts +0 -0
  152. package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_not_match.js +0 -0
  153. package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_not_strict_equals.d.ts +0 -0
  154. package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_not_strict_equals.js +0 -0
  155. package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_object_match.d.ts +0 -0
  156. package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_object_match.js +0 -0
  157. package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_rejects.d.ts +0 -0
  158. package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_rejects.js +0 -0
  159. package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_strict_equals.d.ts +0 -0
  160. package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_strict_equals.js +0 -0
  161. package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_string_includes.d.ts +0 -0
  162. package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_string_includes.js +0 -0
  163. package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_throws.d.ts +0 -0
  164. package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_throws.js +0 -0
  165. package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assertion_error.d.ts +0 -0
  166. package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assertion_error.js +0 -0
  167. package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/equal.d.ts +0 -0
  168. package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/equal.js +0 -0
  169. package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/fail.d.ts +0 -0
  170. package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/fail.js +0 -0
  171. package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/mod.d.ts +0 -0
  172. package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/mod.js +0 -0
  173. package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/unimplemented.d.ts +0 -0
  174. package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/unimplemented.js +0 -0
  175. package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/unreachable.d.ts +0 -0
  176. package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/unreachable.js +0 -0
  177. package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/fmt/colors.d.ts +0 -0
  178. package/esm/deps/deno.land/x/{tgcrypto@0.2.1 → tgcrypto@0.3.3}/tgcrypto.d.ts +0 -0
  179. package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/_constants.d.ts +0 -0
  180. package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/_constants.js +0 -0
  181. package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/_diff.d.ts +0 -0
  182. package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/_diff.js +0 -0
  183. package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/_format.d.ts +0 -0
  184. package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/_format.js +0 -0
  185. package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert.d.ts +0 -0
  186. package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert.js +0 -0
  187. package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_almost_equals.d.ts +0 -0
  188. package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_almost_equals.js +0 -0
  189. package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_array_includes.d.ts +0 -0
  190. package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_array_includes.js +0 -0
  191. package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_equals.d.ts +0 -0
  192. package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_equals.js +0 -0
  193. package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_exists.d.ts +0 -0
  194. package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_exists.js +0 -0
  195. package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_false.d.ts +1 -1
  196. /package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_greater.d.ts +0 -0
  197. /package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_greater.js +0 -0
  198. /package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_greater_or_equal.d.ts +0 -0
  199. /package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_greater_or_equal.js +0 -0
  200. /package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_instance_of.d.ts +0 -0
  201. /package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_instance_of.js +0 -0
  202. /package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_is_error.d.ts +0 -0
  203. /package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_is_error.js +0 -0
  204. /package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_less.d.ts +0 -0
  205. /package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_less.js +0 -0
  206. /package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_less_or_equal.d.ts +0 -0
  207. /package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_less_or_equal.js +0 -0
  208. /package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_match.d.ts +0 -0
  209. /package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_match.js +0 -0
  210. /package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_not_equals.d.ts +0 -0
  211. /package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_not_equals.js +0 -0
  212. /package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_not_instance_of.d.ts +0 -0
  213. /package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_not_instance_of.js +0 -0
  214. /package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_not_match.d.ts +0 -0
  215. /package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_not_match.js +0 -0
  216. /package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_not_strict_equals.d.ts +0 -0
  217. /package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_not_strict_equals.js +0 -0
  218. /package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_object_match.d.ts +0 -0
  219. /package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_object_match.js +0 -0
  220. /package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_rejects.d.ts +0 -0
  221. /package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_rejects.js +0 -0
  222. /package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_strict_equals.d.ts +0 -0
  223. /package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_strict_equals.js +0 -0
  224. /package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_string_includes.d.ts +0 -0
  225. /package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_string_includes.js +0 -0
  226. /package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_throws.d.ts +0 -0
  227. /package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_throws.js +0 -0
  228. /package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assertion_error.d.ts +0 -0
  229. /package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assertion_error.js +0 -0
  230. /package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/equal.d.ts +0 -0
  231. /package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/equal.js +0 -0
  232. /package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/fail.d.ts +0 -0
  233. /package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/fail.js +0 -0
  234. /package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/mod.d.ts +0 -0
  235. /package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/mod.js +0 -0
  236. /package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/unimplemented.d.ts +0 -0
  237. /package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/unimplemented.js +0 -0
  238. /package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/unreachable.d.ts +0 -0
  239. /package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/unreachable.js +0 -0
  240. /package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/fmt/colors.d.ts +0 -0
  241. /package/script/deps/deno.land/x/{tgcrypto@0.2.1 → tgcrypto@0.3.3}/tgcrypto.d.ts +0 -0
@@ -0,0 +1,19 @@
1
+ /**
2
+ * @deprecated (will be removed after 0.209.0) Use `std/encoding/hex.ts` or `std/encoding/base64.ts` instead.
3
+ *
4
+ * Converts a hash to a string with a given encoding.
5
+ * @example
6
+ * ```ts
7
+ * import { crypto } from "https://deno.land/std@$STD_VERSION/crypto/crypto.ts";
8
+ * import { toHashString } from "https://deno.land/std@$STD_VERSION/crypto/to_hash_string.ts"
9
+ *
10
+ * const hash = await crypto.subtle.digest("SHA-384", new TextEncoder().encode("You hear that Mr. Anderson?"));
11
+ *
12
+ * // Hex encoding by default
13
+ * console.log(toHashString(hash));
14
+ *
15
+ * // Or with base64 encoding
16
+ * console.log(toHashString(hash, "base64"));
17
+ * ```
18
+ */
19
+ export declare function toHashString(hash: ArrayBuffer, encoding?: "hex" | "base64"): string;
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
3
+ // This module is browser compatible.
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.toHashString = void 0;
6
+ const hex_js_1 = require("../encoding/hex.js");
7
+ const base64_js_1 = require("../encoding/base64.js");
8
+ const decoder = new TextDecoder();
9
+ /**
10
+ * @deprecated (will be removed after 0.209.0) Use `std/encoding/hex.ts` or `std/encoding/base64.ts` instead.
11
+ *
12
+ * Converts a hash to a string with a given encoding.
13
+ * @example
14
+ * ```ts
15
+ * import { crypto } from "https://deno.land/std@$STD_VERSION/crypto/crypto.ts";
16
+ * import { toHashString } from "https://deno.land/std@$STD_VERSION/crypto/to_hash_string.ts"
17
+ *
18
+ * const hash = await crypto.subtle.digest("SHA-384", new TextEncoder().encode("You hear that Mr. Anderson?"));
19
+ *
20
+ * // Hex encoding by default
21
+ * console.log(toHashString(hash));
22
+ *
23
+ * // Or with base64 encoding
24
+ * console.log(toHashString(hash, "base64"));
25
+ * ```
26
+ */
27
+ function toHashString(hash, encoding = "hex") {
28
+ switch (encoding) {
29
+ case "hex":
30
+ return decoder.decode((0, hex_js_1.encode)(new Uint8Array(hash)));
31
+ case "base64":
32
+ return (0, base64_js_1.encode)(hash);
33
+ }
34
+ }
35
+ exports.toHashString = toHashString;
@@ -0,0 +1,46 @@
1
+ /** Types of data that can be signed cryptographically. */
2
+ export type Data = string | number[] | ArrayBuffer | Uint8Array;
3
+ /** Types of keys that can be used to sign data. */
4
+ export type Key = string | number[] | ArrayBuffer | Uint8Array;
5
+ /** A cryptographic key chain which allows signing of data to prevent tampering,
6
+ * but also allows for easy key rotation without needing to re-sign the data.
7
+ *
8
+ * Data is signed as SHA256 HMAC.
9
+ *
10
+ * This was inspired by [keygrip](https://github.com/crypto-utils/keygrip/).
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * import { KeyStack } from "https://deno.land/std@$STD_VERSION/crypto/keystack.ts";
15
+ *
16
+ * const keyStack = new KeyStack(["hello", "world"]);
17
+ * const digest = await keyStack.sign("some data");
18
+ *
19
+ * const rotatedStack = new KeyStack(["deno", "says", "hello", "world"]);
20
+ * await rotatedStack.verify("some data", digest); // true
21
+ * ```
22
+ */
23
+ export declare class KeyStack {
24
+ #private;
25
+ get length(): number;
26
+ /** A class which accepts an array of keys that are used to sign and verify
27
+ * data and allows easy key rotation without invalidation of previously signed
28
+ * data.
29
+ *
30
+ * @param keys An iterable of keys, of which the index 0 will be used to sign
31
+ * data, but verification can happen against any key.
32
+ */
33
+ constructor(keys: Iterable<Key>);
34
+ /** Take `data` and return a SHA256 HMAC digest that uses the current 0 index
35
+ * of the `keys` passed to the constructor. This digest is in the form of a
36
+ * URL safe base64 encoded string. */
37
+ sign(data: Data): Promise<string>;
38
+ /** Given `data` and a `digest`, verify that one of the `keys` provided the
39
+ * constructor was used to generate the `digest`. Returns `true` if one of
40
+ * the keys was used, otherwise `false`. */
41
+ verify(data: Data, digest: string): Promise<boolean>;
42
+ /** Given `data` and a `digest`, return the current index of the key in the
43
+ * `keys` passed the constructor that was used to generate the digest. If no
44
+ * key can be found, the method returns `-1`. */
45
+ indexOf(data: Data, digest: string): Promise<number>;
46
+ }
@@ -0,0 +1,176 @@
1
+ "use strict";
2
+ // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
3
+ // This module is browser compatible.
4
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
5
+ if (k2 === undefined) k2 = k;
6
+ var desc = Object.getOwnPropertyDescriptor(m, k);
7
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
8
+ desc = { enumerable: true, get: function() { return m[k]; } };
9
+ }
10
+ Object.defineProperty(o, k2, desc);
11
+ }) : (function(o, m, k, k2) {
12
+ if (k2 === undefined) k2 = k;
13
+ o[k2] = m[k];
14
+ }));
15
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
16
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
17
+ }) : function(o, v) {
18
+ o["default"] = v;
19
+ });
20
+ var __importStar = (this && this.__importStar) || function (mod) {
21
+ if (mod && mod.__esModule) return mod;
22
+ var result = {};
23
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
24
+ __setModuleDefault(result, mod);
25
+ return result;
26
+ };
27
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
28
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
29
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
30
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
31
+ };
32
+ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
33
+ if (kind === "m") throw new TypeError("Private method is not writable");
34
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
35
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
36
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
37
+ };
38
+ var _KeyStack_instances, _KeyStack_cryptoKeys, _KeyStack_keys, _KeyStack_toCryptoKey;
39
+ Object.defineProperty(exports, "__esModule", { value: true });
40
+ exports.KeyStack = void 0;
41
+ /**
42
+ * Provides the {@linkcode KeyStack} class which implements the
43
+ * {@linkcode KeyRing} interface for managing rotatable keys.
44
+ *
45
+ * @module
46
+ */
47
+ const dntShim = __importStar(require("../../../../../_dnt.shims.js"));
48
+ const timing_safe_equal_js_1 = require("../timing_safe_equal.js");
49
+ const base64url = __importStar(require("../../encoding/base64url.js"));
50
+ const encoder = new TextEncoder();
51
+ function importKey(key) {
52
+ if (typeof key === "string") {
53
+ key = encoder.encode(key);
54
+ }
55
+ else if (Array.isArray(key)) {
56
+ key = new Uint8Array(key);
57
+ }
58
+ return dntShim.crypto.subtle.importKey("raw", key, {
59
+ name: "HMAC",
60
+ hash: { name: "SHA-256" },
61
+ }, true, ["sign", "verify"]);
62
+ }
63
+ function sign(data, key) {
64
+ if (typeof data === "string") {
65
+ data = encoder.encode(data);
66
+ }
67
+ else if (Array.isArray(data)) {
68
+ data = Uint8Array.from(data);
69
+ }
70
+ return dntShim.crypto.subtle.sign("HMAC", key, data);
71
+ }
72
+ /** Compare two strings, Uint8Arrays, ArrayBuffers, or arrays of numbers in a
73
+ * way that avoids timing based attacks on the comparisons on the values.
74
+ *
75
+ * The function will return `true` if the values match, or `false`, if they
76
+ * do not match.
77
+ *
78
+ * This was inspired by https://github.com/suryagh/tsscmp which provides a
79
+ * timing safe string comparison to avoid timing attacks as described in
80
+ * https://codahale.com/a-lesson-in-timing-attacks/.
81
+ */
82
+ async function compare(a, b) {
83
+ const key = new Uint8Array(32);
84
+ dntShim.dntGlobalThis.crypto.getRandomValues(key);
85
+ const cryptoKey = await importKey(key);
86
+ const ah = await sign(a, cryptoKey);
87
+ const bh = await sign(b, cryptoKey);
88
+ return (0, timing_safe_equal_js_1.timingSafeEqual)(ah, bh);
89
+ }
90
+ /** A cryptographic key chain which allows signing of data to prevent tampering,
91
+ * but also allows for easy key rotation without needing to re-sign the data.
92
+ *
93
+ * Data is signed as SHA256 HMAC.
94
+ *
95
+ * This was inspired by [keygrip](https://github.com/crypto-utils/keygrip/).
96
+ *
97
+ * @example
98
+ * ```ts
99
+ * import { KeyStack } from "https://deno.land/std@$STD_VERSION/crypto/keystack.ts";
100
+ *
101
+ * const keyStack = new KeyStack(["hello", "world"]);
102
+ * const digest = await keyStack.sign("some data");
103
+ *
104
+ * const rotatedStack = new KeyStack(["deno", "says", "hello", "world"]);
105
+ * await rotatedStack.verify("some data", digest); // true
106
+ * ```
107
+ */
108
+ class KeyStack {
109
+ get length() {
110
+ return __classPrivateFieldGet(this, _KeyStack_keys, "f").length;
111
+ }
112
+ /** A class which accepts an array of keys that are used to sign and verify
113
+ * data and allows easy key rotation without invalidation of previously signed
114
+ * data.
115
+ *
116
+ * @param keys An iterable of keys, of which the index 0 will be used to sign
117
+ * data, but verification can happen against any key.
118
+ */
119
+ constructor(keys) {
120
+ _KeyStack_instances.add(this);
121
+ _KeyStack_cryptoKeys.set(this, new Map());
122
+ _KeyStack_keys.set(this, void 0);
123
+ const values = Array.isArray(keys) ? keys : [...keys];
124
+ if (!(values.length)) {
125
+ throw new TypeError("keys must contain at least one value");
126
+ }
127
+ __classPrivateFieldSet(this, _KeyStack_keys, values, "f");
128
+ }
129
+ /** Take `data` and return a SHA256 HMAC digest that uses the current 0 index
130
+ * of the `keys` passed to the constructor. This digest is in the form of a
131
+ * URL safe base64 encoded string. */
132
+ async sign(data) {
133
+ const key = await __classPrivateFieldGet(this, _KeyStack_instances, "m", _KeyStack_toCryptoKey).call(this, __classPrivateFieldGet(this, _KeyStack_keys, "f")[0]);
134
+ return base64url.encode(await sign(data, key));
135
+ }
136
+ /** Given `data` and a `digest`, verify that one of the `keys` provided the
137
+ * constructor was used to generate the `digest`. Returns `true` if one of
138
+ * the keys was used, otherwise `false`. */
139
+ async verify(data, digest) {
140
+ return (await this.indexOf(data, digest)) > -1;
141
+ }
142
+ /** Given `data` and a `digest`, return the current index of the key in the
143
+ * `keys` passed the constructor that was used to generate the digest. If no
144
+ * key can be found, the method returns `-1`. */
145
+ async indexOf(data, digest) {
146
+ for (let i = 0; i < __classPrivateFieldGet(this, _KeyStack_keys, "f").length; i++) {
147
+ const cryptoKey = await __classPrivateFieldGet(this, _KeyStack_instances, "m", _KeyStack_toCryptoKey).call(this, __classPrivateFieldGet(this, _KeyStack_keys, "f")[i]);
148
+ if (await compare(digest, base64url.encode(await sign(data, cryptoKey)))) {
149
+ return i;
150
+ }
151
+ }
152
+ return -1;
153
+ }
154
+ [(_KeyStack_cryptoKeys = new WeakMap(), _KeyStack_keys = new WeakMap(), _KeyStack_instances = new WeakSet(), _KeyStack_toCryptoKey = async function _KeyStack_toCryptoKey(key) {
155
+ if (!__classPrivateFieldGet(this, _KeyStack_cryptoKeys, "f").has(key)) {
156
+ __classPrivateFieldGet(this, _KeyStack_cryptoKeys, "f").set(key, await importKey(key));
157
+ }
158
+ return __classPrivateFieldGet(this, _KeyStack_cryptoKeys, "f").get(key);
159
+ }, Symbol.for("Deno.customInspect"))](inspect) {
160
+ const { length } = this;
161
+ return `${this.constructor.name} ${inspect({ length })}`;
162
+ }
163
+ [Symbol.for("nodejs.util.inspect.custom")](depth,
164
+ // deno-lint-ignore no-explicit-any
165
+ options, inspect) {
166
+ if (depth < 0) {
167
+ return options.stylize(`[${this.constructor.name}]`, "special");
168
+ }
169
+ const newOptions = Object.assign({}, options, {
170
+ depth: options.depth === null ? null : options.depth - 1,
171
+ });
172
+ const { length } = this;
173
+ return `${options.stylize(this.constructor.name, "special")} ${inspect({ length }, newOptions)}`;
174
+ }
175
+ }
176
+ exports.KeyStack = KeyStack;
@@ -0,0 +1 @@
1
+ export declare function validateBinaryLike(source: unknown): Uint8Array;
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.validateBinaryLike = void 0;
5
+ const encoder = new TextEncoder();
6
+ function getTypeName(value) {
7
+ const type = typeof value;
8
+ if (type !== "object") {
9
+ return type;
10
+ }
11
+ else if (value === null) {
12
+ return "null";
13
+ }
14
+ else {
15
+ return value?.constructor?.name ?? "object";
16
+ }
17
+ }
18
+ function validateBinaryLike(source) {
19
+ if (typeof source === "string") {
20
+ return encoder.encode(source);
21
+ }
22
+ else if (source instanceof Uint8Array) {
23
+ return source;
24
+ }
25
+ else if (source instanceof ArrayBuffer) {
26
+ return new Uint8Array(source);
27
+ }
28
+ throw new TypeError(`The input must be a Uint8Array, a string, or an ArrayBuffer. Received a value of the type ${getTypeName(source)}.`);
29
+ }
30
+ exports.validateBinaryLike = validateBinaryLike;
@@ -0,0 +1,23 @@
1
+ /**
2
+ * @deprecated (will be removed in 0.210.0) Use a `encodeBase64` instead.
3
+ *
4
+ * CREDIT: https://gist.github.com/enepomnyaschih/72c423f727d395eeaa09697058238727
5
+ * Encodes a given Uint8Array, ArrayBuffer or string into RFC4648 base64 representation
6
+ * @param data
7
+ */
8
+ export declare const encode: typeof encodeBase64;
9
+ /**
10
+ * @deprecated (will be removed in 0.210.0) Use a `decodeBase64` instead.
11
+ *
12
+ * Decodes a given RFC4648 base64 encoded string
13
+ * @param b64
14
+ */
15
+ export declare const decode: typeof decodeBase64;
16
+ /**
17
+ * Encodes a given Uint8Array, ArrayBuffer or string into RFC4648 base64 representation
18
+ */
19
+ export declare function encodeBase64(data: ArrayBuffer | Uint8Array | string): string;
20
+ /**
21
+ * Decodes a given RFC4648 base64 encoded string
22
+ */
23
+ export declare function decodeBase64(b64: string): Uint8Array;
@@ -1,7 +1,11 @@
1
+ "use strict";
1
2
  // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
2
3
  // This module is browser compatible.
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.decodeBase64 = exports.encodeBase64 = exports.decode = exports.encode = void 0;
6
+ const _util_js_1 = require("./_util.js");
3
7
  /**
4
- * {@linkcode encode} and {@linkcode decode} for
8
+ * {@linkcode encodeBase64} and {@linkcode decodeBase64} for
5
9
  * [base64](https://en.wikipedia.org/wiki/Base64) encoding.
6
10
  *
7
11
  * This module is browser compatible.
@@ -9,17 +13,17 @@
9
13
  * @example
10
14
  * ```ts
11
15
  * import {
12
- * decode,
13
- * encode,
16
+ * decodeBase64,
17
+ * encodeBase64,
14
18
  * } from "https://deno.land/std@$STD_VERSION/encoding/base64.ts";
15
19
  *
16
20
  * const b64Repr = "Zm9vYg==";
17
21
  *
18
- * const binaryData = decode(b64Repr);
22
+ * const binaryData = decodeBase64(b64Repr);
19
23
  * console.log(binaryData);
20
24
  * // => Uint8Array [ 102, 111, 111, 98 ]
21
25
  *
22
- * console.log(encode(binaryData));
26
+ * console.log(encodeBase64(binaryData));
23
27
  * // => Zm9vYg==
24
28
  * ```
25
29
  *
@@ -92,16 +96,26 @@ const base64abc = [
92
96
  "/",
93
97
  ];
94
98
  /**
99
+ * @deprecated (will be removed in 0.210.0) Use a `encodeBase64` instead.
100
+ *
95
101
  * CREDIT: https://gist.github.com/enepomnyaschih/72c423f727d395eeaa09697058238727
96
102
  * Encodes a given Uint8Array, ArrayBuffer or string into RFC4648 base64 representation
97
103
  * @param data
98
104
  */
99
- export function encode(data) {
100
- const uint8 = typeof data === "string"
101
- ? new TextEncoder().encode(data)
102
- : data instanceof Uint8Array
103
- ? data
104
- : new Uint8Array(data);
105
+ exports.encode = encodeBase64;
106
+ /**
107
+ * @deprecated (will be removed in 0.210.0) Use a `decodeBase64` instead.
108
+ *
109
+ * Decodes a given RFC4648 base64 encoded string
110
+ * @param b64
111
+ */
112
+ exports.decode = decodeBase64;
113
+ /**
114
+ * Encodes a given Uint8Array, ArrayBuffer or string into RFC4648 base64 representation
115
+ */
116
+ function encodeBase64(data) {
117
+ // CREDIT: https://gist.github.com/enepomnyaschih/72c423f727d395eeaa09697058238727
118
+ const uint8 = (0, _util_js_1.validateBinaryLike)(data);
105
119
  let result = "", i;
106
120
  const l = uint8.length;
107
121
  for (i = 2; i < l; i += 3) {
@@ -125,11 +139,11 @@ export function encode(data) {
125
139
  }
126
140
  return result;
127
141
  }
142
+ exports.encodeBase64 = encodeBase64;
128
143
  /**
129
144
  * Decodes a given RFC4648 base64 encoded string
130
- * @param b64
131
145
  */
132
- export function decode(b64) {
146
+ function decodeBase64(b64) {
133
147
  const binString = atob(b64);
134
148
  const size = binString.length;
135
149
  const bytes = new Uint8Array(size);
@@ -138,3 +152,4 @@ export function decode(b64) {
138
152
  }
139
153
  return bytes;
140
154
  }
155
+ exports.decodeBase64 = decodeBase64;
@@ -0,0 +1,24 @@
1
+ /**
2
+ * @deprecated (will be removed in 0.210.0) Use a `encodeBase64Url` instead.
3
+ *
4
+ * Encodes a given ArrayBuffer or string into a base64url representation
5
+ * @param data
6
+ */
7
+ export declare const encode: typeof encodeBase64Url;
8
+ /**
9
+ * @deprecated (will be removed in 0.210.0) Use a `decodeBase64Url` instead.
10
+ *
11
+ * Converts given base64url encoded data back to original
12
+ * @param b64url
13
+ */
14
+ export declare const decode: typeof decodeBase64Url;
15
+ /**
16
+ * Encodes a given ArrayBuffer or string into a base64url representation
17
+ * @param data
18
+ */
19
+ export declare function encodeBase64Url(data: ArrayBuffer | Uint8Array | string): string;
20
+ /**
21
+ * Converts given base64url encoded data back to original
22
+ * @param b64url
23
+ */
24
+ export declare function decodeBase64Url(b64url: string): Uint8Array;
@@ -0,0 +1,108 @@
1
+ "use strict";
2
+ // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
3
+ // This module is browser compatible.
4
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
5
+ if (k2 === undefined) k2 = k;
6
+ var desc = Object.getOwnPropertyDescriptor(m, k);
7
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
8
+ desc = { enumerable: true, get: function() { return m[k]; } };
9
+ }
10
+ Object.defineProperty(o, k2, desc);
11
+ }) : (function(o, m, k, k2) {
12
+ if (k2 === undefined) k2 = k;
13
+ o[k2] = m[k];
14
+ }));
15
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
16
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
17
+ }) : function(o, v) {
18
+ o["default"] = v;
19
+ });
20
+ var __importStar = (this && this.__importStar) || function (mod) {
21
+ if (mod && mod.__esModule) return mod;
22
+ var result = {};
23
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
24
+ __setModuleDefault(result, mod);
25
+ return result;
26
+ };
27
+ Object.defineProperty(exports, "__esModule", { value: true });
28
+ exports.decodeBase64Url = exports.encodeBase64Url = exports.decode = exports.encode = void 0;
29
+ /**
30
+ * {@linkcode encodeBase64Url} and {@linkcode decodeBase64Url} for
31
+ * [base64 URL safe](https://en.wikipedia.org/wiki/Base64#URL_applications) encoding.
32
+ *
33
+ * This module is browser compatible.
34
+ *
35
+ * @example
36
+ * ```ts
37
+ * import {
38
+ * decodeBase64Url,
39
+ * encodeBase64Url,
40
+ * } from "https://deno.land/std@$STD_VERSION/encoding/base64url.ts";
41
+ *
42
+ * const binary = new TextEncoder().encode("foobar");
43
+ * const encoded = encodeBase64Url(binary);
44
+ * console.log(encoded);
45
+ * // => "Zm9vYmFy"
46
+ *
47
+ * console.log(decodeBase64Url(encoded));
48
+ * // => Uint8Array(6) [ 102, 111, 111, 98, 97, 114 ]
49
+ * ```
50
+ *
51
+ * @module
52
+ */
53
+ const base64 = __importStar(require("./base64.js"));
54
+ /*
55
+ * Some variants allow or require omitting the padding '=' signs:
56
+ * https://en.wikipedia.org/wiki/Base64#The_URL_applications
57
+ * @param base64url
58
+ */
59
+ function addPaddingToBase64url(base64url) {
60
+ if (base64url.length % 4 === 2)
61
+ return base64url + "==";
62
+ if (base64url.length % 4 === 3)
63
+ return base64url + "=";
64
+ if (base64url.length % 4 === 1) {
65
+ throw new TypeError("Illegal base64url string!");
66
+ }
67
+ return base64url;
68
+ }
69
+ function convertBase64urlToBase64(b64url) {
70
+ if (!/^[-_A-Z0-9]*?={0,2}$/i.test(b64url)) {
71
+ // Contains characters not part of base64url spec.
72
+ throw new TypeError("Failed to decode base64url: invalid character");
73
+ }
74
+ return addPaddingToBase64url(b64url).replace(/\-/g, "+").replace(/_/g, "/");
75
+ }
76
+ function convertBase64ToBase64url(b64) {
77
+ return b64.replace(/=/g, "").replace(/\+/g, "-").replace(/\//g, "_");
78
+ }
79
+ /**
80
+ * @deprecated (will be removed in 0.210.0) Use a `encodeBase64Url` instead.
81
+ *
82
+ * Encodes a given ArrayBuffer or string into a base64url representation
83
+ * @param data
84
+ */
85
+ exports.encode = encodeBase64Url;
86
+ /**
87
+ * @deprecated (will be removed in 0.210.0) Use a `decodeBase64Url` instead.
88
+ *
89
+ * Converts given base64url encoded data back to original
90
+ * @param b64url
91
+ */
92
+ exports.decode = decodeBase64Url;
93
+ /**
94
+ * Encodes a given ArrayBuffer or string into a base64url representation
95
+ * @param data
96
+ */
97
+ function encodeBase64Url(data) {
98
+ return convertBase64ToBase64url(base64.encodeBase64(data));
99
+ }
100
+ exports.encodeBase64Url = encodeBase64Url;
101
+ /**
102
+ * Converts given base64url encoded data back to original
103
+ * @param b64url
104
+ */
105
+ function decodeBase64Url(b64url) {
106
+ return base64.decodeBase64(convertBase64urlToBase64(b64url));
107
+ }
108
+ exports.decodeBase64Url = decodeBase64Url;
@@ -0,0 +1,18 @@
1
+ /**
2
+ * @deprecated (will be removed in 0.210.0) Use a `encodeHex` instead.
3
+ *
4
+ * Encodes `src` into `src.length * 2` bytes.
5
+ */
6
+ export declare function encode(src: Uint8Array): Uint8Array;
7
+ /** Encodes the source into hex string. */
8
+ export declare function encodeHex(src: string | Uint8Array | ArrayBuffer): string;
9
+ /**
10
+ * @deprecated (will be removed in 0.210.0) Use a `decodeHex` instead.
11
+ *
12
+ * Decodes `src` into `src.length / 2` bytes.
13
+ * If the input is malformed, an error will be thrown.
14
+ */
15
+ export declare function decode(src: Uint8Array): Uint8Array;
16
+ /** Decodes the given hex string to Uint8Array.
17
+ * If the input is malformed, an error will be thrown. */
18
+ export declare function decodeHex(src: string): Uint8Array;