@mtkruto/node 0.1.101 → 0.1.103

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 (257) hide show
  1. package/esm/0_deps.d.ts +2 -3
  2. package/esm/0_deps.js +2 -3
  3. package/esm/4_constants.d.ts +1 -1
  4. package/esm/4_constants.js +1 -1
  5. package/esm/client/3_types.d.ts +25 -1
  6. package/esm/client/4_client.d.ts +57 -26
  7. package/esm/client/4_client.js +72 -12
  8. package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/_diff.js +10 -3
  9. package/esm/storage/0_storage.d.ts +3 -1
  10. package/esm/storage/0_storage.js +7 -0
  11. package/esm/storage/0_utilities.d.ts +2 -1
  12. package/esm/storage/0_utilities.js +63 -0
  13. package/esm/storage/1_storage_indexed_db.d.ts +2 -1
  14. package/esm/storage/1_storage_indexed_db.js +18 -1
  15. package/esm/storage/1_storage_local_storage.d.ts +1 -0
  16. package/esm/storage/1_storage_local_storage.js +16 -0
  17. package/esm/storage/1_storage_memory.d.ts +1 -0
  18. package/esm/storage/1_storage_memory.js +14 -1
  19. package/esm/storage/1_storage_session_storage.d.ts +1 -0
  20. package/esm/storage/1_storage_session_storage.js +16 -0
  21. package/esm/tl/6_message.d.ts +1 -0
  22. package/esm/tl/6_message.js +1 -2
  23. package/esm/tl/6_message_test.d.ts +1 -0
  24. package/esm/transport/0_obfuscation.js +3 -3
  25. package/esm/transport/0_transport.d.ts +2 -2
  26. package/esm/transport/0_transport.js +2 -8
  27. package/esm/transport/1_transport_abridged.js +9 -7
  28. package/esm/transport/1_transport_intermediate.js +7 -3
  29. package/esm/types/3_message.d.ts +4 -0
  30. package/esm/types/3_message.js +3 -0
  31. package/esm/utilities/0_bigint.js +2 -1
  32. package/esm/utilities/0_crypto.d.ts +1 -1
  33. package/esm/utilities/0_crypto.js +1 -3
  34. package/package.json +1 -1
  35. package/script/0_deps.d.ts +2 -3
  36. package/script/0_deps.js +3 -5
  37. package/script/4_constants.d.ts +1 -1
  38. package/script/4_constants.js +1 -1
  39. package/script/client/3_types.d.ts +25 -1
  40. package/script/client/4_client.d.ts +57 -26
  41. package/script/client/4_client.js +71 -11
  42. package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/_diff.js +10 -3
  43. package/script/storage/0_storage.d.ts +3 -1
  44. package/script/storage/0_storage.js +7 -0
  45. package/script/storage/0_utilities.d.ts +2 -1
  46. package/script/storage/0_utilities.js +65 -1
  47. package/script/storage/1_storage_indexed_db.d.ts +2 -1
  48. package/script/storage/1_storage_indexed_db.js +17 -0
  49. package/script/storage/1_storage_local_storage.d.ts +1 -0
  50. package/script/storage/1_storage_local_storage.js +16 -0
  51. package/script/storage/1_storage_memory.d.ts +1 -0
  52. package/script/storage/1_storage_memory.js +13 -0
  53. package/script/storage/1_storage_session_storage.d.ts +1 -0
  54. package/script/storage/1_storage_session_storage.js +16 -0
  55. package/script/tl/6_message.d.ts +1 -0
  56. package/script/tl/6_message.js +2 -2
  57. package/script/tl/6_message_test.d.ts +1 -0
  58. package/script/transport/0_obfuscation.js +3 -3
  59. package/script/transport/0_transport.d.ts +2 -2
  60. package/script/transport/0_transport.js +2 -8
  61. package/script/transport/1_transport_abridged.js +9 -7
  62. package/script/transport/1_transport_intermediate.js +7 -3
  63. package/script/types/3_message.d.ts +4 -0
  64. package/script/types/3_message.js +3 -0
  65. package/script/utilities/0_bigint.js +2 -1
  66. package/script/utilities/0_crypto.d.ts +1 -1
  67. package/script/utilities/0_crypto.js +1 -3
  68. package/esm/deps/deno.land/std@0.203.0/crypto/_fnv/fnv32.d.ts +0 -2
  69. package/esm/deps/deno.land/std@0.203.0/crypto/_fnv/fnv32.js +0 -24
  70. package/esm/deps/deno.land/std@0.203.0/crypto/_fnv/fnv64.d.ts +0 -2
  71. package/esm/deps/deno.land/std@0.203.0/crypto/_fnv/fnv64.js +0 -27
  72. package/esm/deps/deno.land/std@0.203.0/crypto/_fnv/mod.d.ts +0 -1
  73. package/esm/deps/deno.land/std@0.203.0/crypto/_fnv/mod.js +0 -21
  74. package/esm/deps/deno.land/std@0.203.0/crypto/_fnv/util.d.ts +0 -13
  75. package/esm/deps/deno.land/std@0.203.0/crypto/_fnv/util.js +0 -48
  76. package/esm/deps/deno.land/std@0.203.0/crypto/_wasm/lib/deno_std_wasm_crypto.generated.d.ts +0 -125
  77. package/esm/deps/deno.land/std@0.203.0/crypto/_wasm/lib/deno_std_wasm_crypto.generated.js +0 -3337
  78. package/esm/deps/deno.land/std@0.203.0/crypto/_wasm/mod.d.ts +0 -12
  79. package/esm/deps/deno.land/std@0.203.0/crypto/_wasm/mod.js +0 -39
  80. package/esm/deps/deno.land/std@0.203.0/crypto/crypto.d.ts +0 -157
  81. package/esm/deps/deno.land/std@0.203.0/crypto/crypto.js +0 -266
  82. package/esm/deps/deno.land/std@0.203.0/crypto/keystack.d.ts +0 -4
  83. package/esm/deps/deno.land/std@0.203.0/crypto/keystack.js +0 -6
  84. package/esm/deps/deno.land/std@0.203.0/crypto/mod.d.ts +0 -12
  85. package/esm/deps/deno.land/std@0.203.0/crypto/mod.js +0 -14
  86. package/esm/deps/deno.land/std@0.203.0/crypto/timing_safe_equal.d.ts +0 -28
  87. package/esm/deps/deno.land/std@0.203.0/crypto/timing_safe_equal.js +0 -54
  88. package/esm/deps/deno.land/std@0.203.0/crypto/to_hash_string.d.ts +0 -19
  89. package/esm/deps/deno.land/std@0.203.0/crypto/to_hash_string.js +0 -31
  90. package/esm/deps/deno.land/std@0.203.0/crypto/unstable/keystack.d.ts +0 -46
  91. package/esm/deps/deno.land/std@0.203.0/crypto/unstable/keystack.js +0 -149
  92. package/esm/deps/deno.land/std@0.203.0/encoding/base64url.d.ts +0 -24
  93. package/esm/deps/deno.land/std@0.203.0/encoding/base64url.js +0 -80
  94. package/esm/deps/deno.land/std@0.203.0/encoding/hex.d.ts +0 -18
  95. package/esm/deps/deno.land/std@0.203.0/encoding/hex.js +0 -115
  96. package/script/deps/deno.land/std@0.203.0/crypto/_fnv/fnv32.d.ts +0 -2
  97. package/script/deps/deno.land/std@0.203.0/crypto/_fnv/fnv32.js +0 -29
  98. package/script/deps/deno.land/std@0.203.0/crypto/_fnv/fnv64.d.ts +0 -2
  99. package/script/deps/deno.land/std@0.203.0/crypto/_fnv/fnv64.js +0 -32
  100. package/script/deps/deno.land/std@0.203.0/crypto/_fnv/mod.d.ts +0 -1
  101. package/script/deps/deno.land/std@0.203.0/crypto/_fnv/mod.js +0 -25
  102. package/script/deps/deno.land/std@0.203.0/crypto/_fnv/util.d.ts +0 -13
  103. package/script/deps/deno.land/std@0.203.0/crypto/_fnv/util.js +0 -54
  104. package/script/deps/deno.land/std@0.203.0/crypto/_wasm/lib/deno_std_wasm_crypto.generated.d.ts +0 -125
  105. package/script/deps/deno.land/std@0.203.0/crypto/_wasm/lib/deno_std_wasm_crypto.generated.js +0 -3345
  106. package/script/deps/deno.land/std@0.203.0/crypto/_wasm/mod.d.ts +0 -12
  107. package/script/deps/deno.land/std@0.203.0/crypto/_wasm/mod.js +0 -44
  108. package/script/deps/deno.land/std@0.203.0/crypto/crypto.d.ts +0 -157
  109. package/script/deps/deno.land/std@0.203.0/crypto/crypto.js +0 -292
  110. package/script/deps/deno.land/std@0.203.0/crypto/keystack.d.ts +0 -4
  111. package/script/deps/deno.land/std@0.203.0/crypto/keystack.js +0 -22
  112. package/script/deps/deno.land/std@0.203.0/crypto/mod.d.ts +0 -12
  113. package/script/deps/deno.land/std@0.203.0/crypto/mod.js +0 -30
  114. package/script/deps/deno.land/std@0.203.0/crypto/timing_safe_equal.d.ts +0 -28
  115. package/script/deps/deno.land/std@0.203.0/crypto/timing_safe_equal.js +0 -58
  116. package/script/deps/deno.land/std@0.203.0/crypto/to_hash_string.d.ts +0 -19
  117. package/script/deps/deno.land/std@0.203.0/crypto/to_hash_string.js +0 -35
  118. package/script/deps/deno.land/std@0.203.0/crypto/unstable/keystack.d.ts +0 -46
  119. package/script/deps/deno.land/std@0.203.0/crypto/unstable/keystack.js +0 -176
  120. package/script/deps/deno.land/std@0.203.0/encoding/base64url.d.ts +0 -24
  121. package/script/deps/deno.land/std@0.203.0/encoding/base64url.js +0 -108
  122. package/script/deps/deno.land/std@0.203.0/encoding/hex.d.ts +0 -18
  123. package/script/deps/deno.land/std@0.203.0/encoding/hex.js +0 -122
  124. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/_constants.d.ts +0 -0
  125. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/_constants.js +0 -0
  126. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/_diff.d.ts +0 -0
  127. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/_format.d.ts +0 -0
  128. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/_format.js +0 -0
  129. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert.d.ts +0 -0
  130. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert.js +0 -0
  131. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_almost_equals.d.ts +0 -0
  132. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_almost_equals.js +0 -0
  133. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_array_includes.d.ts +0 -0
  134. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_array_includes.js +0 -0
  135. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_equals.d.ts +0 -0
  136. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_equals.js +0 -0
  137. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_exists.d.ts +0 -0
  138. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_exists.js +0 -0
  139. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_false.d.ts +0 -0
  140. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_false.js +0 -0
  141. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_greater.d.ts +0 -0
  142. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_greater.js +0 -0
  143. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_greater_or_equal.d.ts +0 -0
  144. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_greater_or_equal.js +0 -0
  145. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_instance_of.d.ts +0 -0
  146. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_instance_of.js +0 -0
  147. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_is_error.d.ts +0 -0
  148. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_is_error.js +0 -0
  149. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_less.d.ts +0 -0
  150. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_less.js +0 -0
  151. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_less_or_equal.d.ts +0 -0
  152. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_less_or_equal.js +0 -0
  153. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_match.d.ts +0 -0
  154. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_match.js +0 -0
  155. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_not_equals.d.ts +0 -0
  156. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_not_equals.js +0 -0
  157. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_not_instance_of.d.ts +0 -0
  158. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_not_instance_of.js +0 -0
  159. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_not_match.d.ts +0 -0
  160. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_not_match.js +0 -0
  161. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_not_strict_equals.d.ts +0 -0
  162. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_not_strict_equals.js +0 -0
  163. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_object_match.d.ts +0 -0
  164. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_object_match.js +0 -0
  165. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_rejects.d.ts +0 -0
  166. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_rejects.js +0 -0
  167. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_strict_equals.d.ts +0 -0
  168. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_strict_equals.js +0 -0
  169. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_string_includes.d.ts +0 -0
  170. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_string_includes.js +0 -0
  171. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_throws.d.ts +0 -0
  172. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_throws.js +0 -0
  173. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assertion_error.d.ts +0 -0
  174. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assertion_error.js +0 -0
  175. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/equal.d.ts +0 -0
  176. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/equal.js +0 -0
  177. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/fail.d.ts +0 -0
  178. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/fail.js +0 -0
  179. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/mod.d.ts +0 -0
  180. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/mod.js +0 -0
  181. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/unimplemented.d.ts +0 -0
  182. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/unimplemented.js +0 -0
  183. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/unreachable.d.ts +0 -0
  184. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/unreachable.js +0 -0
  185. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/encoding/_util.d.ts +0 -0
  186. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/encoding/_util.js +0 -0
  187. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/encoding/base64.d.ts +0 -0
  188. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/encoding/base64.js +0 -0
  189. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/fmt/colors.d.ts +0 -0
  190. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/fmt/colors.js +0 -0
  191. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/_constants.d.ts +0 -0
  192. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/_constants.js +0 -0
  193. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/_diff.d.ts +0 -0
  194. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/_format.d.ts +0 -0
  195. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/_format.js +0 -0
  196. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert.d.ts +0 -0
  197. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert.js +0 -0
  198. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_almost_equals.d.ts +0 -0
  199. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_almost_equals.js +0 -0
  200. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_array_includes.d.ts +0 -0
  201. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_array_includes.js +0 -0
  202. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_equals.d.ts +0 -0
  203. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_equals.js +0 -0
  204. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_exists.d.ts +0 -0
  205. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_exists.js +0 -0
  206. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_false.d.ts +0 -0
  207. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_false.js +0 -0
  208. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_greater.d.ts +0 -0
  209. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_greater.js +0 -0
  210. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_greater_or_equal.d.ts +0 -0
  211. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_greater_or_equal.js +0 -0
  212. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_instance_of.d.ts +0 -0
  213. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_instance_of.js +0 -0
  214. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_is_error.d.ts +0 -0
  215. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_is_error.js +0 -0
  216. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_less.d.ts +0 -0
  217. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_less.js +0 -0
  218. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_less_or_equal.d.ts +0 -0
  219. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_less_or_equal.js +0 -0
  220. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_match.d.ts +0 -0
  221. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_match.js +0 -0
  222. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_not_equals.d.ts +0 -0
  223. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_not_equals.js +0 -0
  224. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_not_instance_of.d.ts +0 -0
  225. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_not_instance_of.js +0 -0
  226. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_not_match.d.ts +0 -0
  227. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_not_match.js +0 -0
  228. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_not_strict_equals.d.ts +0 -0
  229. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_not_strict_equals.js +0 -0
  230. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_object_match.d.ts +0 -0
  231. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_object_match.js +0 -0
  232. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_rejects.d.ts +0 -0
  233. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_rejects.js +0 -0
  234. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_strict_equals.d.ts +0 -0
  235. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_strict_equals.js +0 -0
  236. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_string_includes.d.ts +0 -0
  237. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_string_includes.js +0 -0
  238. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_throws.d.ts +0 -0
  239. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_throws.js +0 -0
  240. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assertion_error.d.ts +0 -0
  241. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assertion_error.js +0 -0
  242. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/equal.d.ts +0 -0
  243. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/equal.js +0 -0
  244. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/fail.d.ts +0 -0
  245. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/fail.js +0 -0
  246. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/mod.d.ts +0 -0
  247. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/mod.js +0 -0
  248. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/unimplemented.d.ts +0 -0
  249. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/unimplemented.js +0 -0
  250. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/unreachable.d.ts +0 -0
  251. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/unreachable.js +0 -0
  252. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/encoding/_util.d.ts +0 -0
  253. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/encoding/_util.js +0 -0
  254. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/encoding/base64.d.ts +0 -0
  255. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/encoding/base64.js +0 -0
  256. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/fmt/colors.d.ts +0 -0
  257. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/fmt/colors.js +0 -0
@@ -1,12 +0,0 @@
1
- export { DigestContext, instantiate as instantiateWasm, } from "./lib/deno_std_wasm_crypto.generated.js";
2
- /**
3
- * All cryptographic hash/digest algorithms supported by std/crypto/_wasm.
4
- *
5
- * For algorithms that are supported by WebCrypto, the name here must match the
6
- * one used by WebCrypto. Otherwise we should prefer the formatting used in the
7
- * official specification. All names are uppercase to facilitate case-insensitive
8
- * comparisons required by the WebCrypto spec.
9
- */
10
- export declare const digestAlgorithms: readonly ["BLAKE2B-224", "BLAKE2B-256", "BLAKE2B-384", "BLAKE2B", "BLAKE2S", "BLAKE3", "KECCAK-224", "KECCAK-256", "KECCAK-384", "KECCAK-512", "SHA-384", "SHA3-224", "SHA3-256", "SHA3-384", "SHA3-512", "SHAKE128", "SHAKE256", "TIGER", "RIPEMD-160", "SHA-224", "SHA-256", "SHA-512", "MD4", "MD5", "SHA-1"];
11
- /** An algorithm name supported by std/crypto/_wasm. */
12
- export type DigestAlgorithm = typeof digestAlgorithms[number];
@@ -1,39 +0,0 @@
1
- // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
2
- export { DigestContext, instantiate as instantiateWasm, } from "./lib/deno_std_wasm_crypto.generated.js";
3
- /**
4
- * All cryptographic hash/digest algorithms supported by std/crypto/_wasm.
5
- *
6
- * For algorithms that are supported by WebCrypto, the name here must match the
7
- * one used by WebCrypto. Otherwise we should prefer the formatting used in the
8
- * official specification. All names are uppercase to facilitate case-insensitive
9
- * comparisons required by the WebCrypto spec.
10
- */
11
- export const digestAlgorithms = [
12
- "BLAKE2B-224",
13
- "BLAKE2B-256",
14
- "BLAKE2B-384",
15
- "BLAKE2B",
16
- "BLAKE2S",
17
- "BLAKE3",
18
- "KECCAK-224",
19
- "KECCAK-256",
20
- "KECCAK-384",
21
- "KECCAK-512",
22
- "SHA-384",
23
- "SHA3-224",
24
- "SHA3-256",
25
- "SHA3-384",
26
- "SHA3-512",
27
- "SHAKE128",
28
- "SHAKE256",
29
- "TIGER",
30
- // insecure (length-extendable):
31
- "RIPEMD-160",
32
- "SHA-224",
33
- "SHA-256",
34
- "SHA-512",
35
- // insecure (collidable and length-extendable):
36
- "MD4",
37
- "MD5",
38
- "SHA-1",
39
- ];
@@ -1,157 +0,0 @@
1
- /**
2
- * Extensions to the
3
- * [Web Crypto](https://developer.mozilla.org/en-US/docs/Web/API/Web_Crypto_API)
4
- * supporting additional encryption APIs, but also delegating to the built-in
5
- * APIs when possible.
6
- *
7
- * Provides additional digest algorithms that are not part of the WebCrypto
8
- * standard as well as a `subtle.digest` and `subtle.digestSync` methods. It
9
- * also provides a `subtle.timingSafeEqual()` method to compare array buffers
10
- * or data views in a way that isn't prone to timing based attacks.
11
- *
12
- * The "polyfill" delegates to `WebCrypto` where possible.
13
- *
14
- * The {@linkcode KeyStack} export implements the {@linkcode KeyRing} interface
15
- * for managing rotatable keys for signing data to prevent tampering, like with
16
- * HTTP cookies.
17
- *
18
- * ## Supported algorithms
19
- *
20
- * Here is a list of supported algorithms. If the algorithm name in WebCrypto
21
- * and Wasm/Rust is the same, this library prefers to use algorithms that are
22
- * supported by WebCrypto.
23
- *
24
- * WebCrypto
25
- *
26
- * ```ts
27
- * // https://deno.land/std/crypto/crypto.ts
28
- * const webCryptoDigestAlgorithms = [
29
- * "SHA-384",
30
- * "SHA-256",
31
- * "SHA-512",
32
- * // insecure (length-extendable and collidable):
33
- * "SHA-1",
34
- * ] as const;
35
- * ```
36
- *
37
- * Wasm/Rust
38
- *
39
- * ```ts
40
- * // https://deno.land/std/crypto/_wasm/mod.ts
41
- * export const digestAlgorithms = [
42
- * "BLAKE2B-224",
43
- * "BLAKE2B-256",
44
- * "BLAKE2B-384",
45
- * "BLAKE2B",
46
- * "BLAKE2S",
47
- * "BLAKE3",
48
- * "KECCAK-224",
49
- * "KECCAK-256",
50
- * "KECCAK-384",
51
- * "KECCAK-512",
52
- * "SHA-384",
53
- * "SHA3-224",
54
- * "SHA3-256",
55
- * "SHA3-384",
56
- * "SHA3-512",
57
- * "SHAKE128",
58
- * "SHAKE256",
59
- * "TIGER",
60
- * // insecure (length-extendable):
61
- * "RIPEMD-160",
62
- * "SHA-224",
63
- * "SHA-256",
64
- * "SHA-512",
65
- * // insecure (collidable and length-extendable):
66
- * "MD4",
67
- * "MD5",
68
- * "SHA-1",
69
- * ] as const;
70
- * ```
71
- *
72
- * @example
73
- * ```ts
74
- * import { crypto } from "https://deno.land/std@$STD_VERSION/crypto/mod.ts";
75
- *
76
- * // This will delegate to the runtime's WebCrypto implementation.
77
- * console.log(
78
- * new Uint8Array(
79
- * await crypto.subtle.digest(
80
- * "SHA-384",
81
- * new TextEncoder().encode("hello world"),
82
- * ),
83
- * ),
84
- * );
85
- *
86
- * // This will use a bundled Wasm/Rust implementation.
87
- * console.log(
88
- * new Uint8Array(
89
- * await crypto.subtle.digest(
90
- * "BLAKE3",
91
- * new TextEncoder().encode("hello world"),
92
- * ),
93
- * ),
94
- * );
95
- * ```
96
- *
97
- * @example Convert hash to a string
98
- *
99
- * ```ts
100
- * import {
101
- * crypto,
102
- * toHashString,
103
- * } from "https://deno.land/std@$STD_VERSION/crypto/mod.ts";
104
- *
105
- * const hash = await crypto.subtle.digest(
106
- * "SHA-384",
107
- * new TextEncoder().encode("You hear that Mr. Anderson?"),
108
- * );
109
- *
110
- * // Hex encoding by default
111
- * console.log(toHashString(hash));
112
- *
113
- * // Or with base64 encoding
114
- * console.log(toHashString(hash, "base64"));
115
- * ```
116
- *
117
- * @module
118
- */
119
- import * as dntShim from "../../../../_dnt.shims.js";
120
- import { DigestAlgorithm as WasmDigestAlgorithm } from "./_wasm/mod.js";
121
- /** Extensions to the web standard `SubtleCrypto` interface. */
122
- export interface StdSubtleCrypto extends dntShim.SubtleCrypto {
123
- /**
124
- * Returns a new `Promise` object that will digest `data` using the specified
125
- * `AlgorithmIdentifier`.
126
- */
127
- digest(algorithm: DigestAlgorithm, data: dntShim.BufferSource | AsyncIterable<dntShim.BufferSource> | Iterable<dntShim.BufferSource>): Promise<ArrayBuffer>;
128
- /**
129
- * Returns a ArrayBuffer with the result of digesting `data` using the
130
- * specified `AlgorithmIdentifier`.
131
- */
132
- digestSync(algorithm: DigestAlgorithm, data: dntShim.BufferSource | Iterable<dntShim.BufferSource>): ArrayBuffer;
133
- /**
134
- * @deprecated (will be removed in 0.207.0) Import from `std/crypto/timing_safe_equal.ts` instead
135
- *
136
- * Compare to array buffers or data views in a way that timing based attacks
137
- * cannot gain information about the platform. */
138
- timingSafeEqual(a: ArrayBufferLike | DataView, b: ArrayBufferLike | DataView): boolean;
139
- }
140
- /** Extensions to the Web {@linkcode Crypto} interface. */
141
- export interface StdCrypto extends dntShim.Crypto {
142
- readonly subtle: StdSubtleCrypto;
143
- }
144
- /**
145
- * An wrapper for WebCrypto adding support for additional non-standard
146
- * algorithms, but delegating to the runtime WebCrypto implementation whenever
147
- * possible.
148
- */
149
- declare const stdCrypto: StdCrypto;
150
- export type FNVAlgorithms = "FNV32" | "FNV32A" | "FNV64" | "FNV64A";
151
- export type DigestAlgorithmName = WasmDigestAlgorithm | FNVAlgorithms;
152
- export type DigestAlgorithmObject = {
153
- name: DigestAlgorithmName;
154
- length?: number;
155
- };
156
- export type DigestAlgorithm = DigestAlgorithmName | DigestAlgorithmObject;
157
- export { stdCrypto as crypto };
@@ -1,266 +0,0 @@
1
- // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
2
- // This module is browser compatible.
3
- /**
4
- * Extensions to the
5
- * [Web Crypto](https://developer.mozilla.org/en-US/docs/Web/API/Web_Crypto_API)
6
- * supporting additional encryption APIs, but also delegating to the built-in
7
- * APIs when possible.
8
- *
9
- * Provides additional digest algorithms that are not part of the WebCrypto
10
- * standard as well as a `subtle.digest` and `subtle.digestSync` methods. It
11
- * also provides a `subtle.timingSafeEqual()` method to compare array buffers
12
- * or data views in a way that isn't prone to timing based attacks.
13
- *
14
- * The "polyfill" delegates to `WebCrypto` where possible.
15
- *
16
- * The {@linkcode KeyStack} export implements the {@linkcode KeyRing} interface
17
- * for managing rotatable keys for signing data to prevent tampering, like with
18
- * HTTP cookies.
19
- *
20
- * ## Supported algorithms
21
- *
22
- * Here is a list of supported algorithms. If the algorithm name in WebCrypto
23
- * and Wasm/Rust is the same, this library prefers to use algorithms that are
24
- * supported by WebCrypto.
25
- *
26
- * WebCrypto
27
- *
28
- * ```ts
29
- * // https://deno.land/std/crypto/crypto.ts
30
- * const webCryptoDigestAlgorithms = [
31
- * "SHA-384",
32
- * "SHA-256",
33
- * "SHA-512",
34
- * // insecure (length-extendable and collidable):
35
- * "SHA-1",
36
- * ] as const;
37
- * ```
38
- *
39
- * Wasm/Rust
40
- *
41
- * ```ts
42
- * // https://deno.land/std/crypto/_wasm/mod.ts
43
- * export const digestAlgorithms = [
44
- * "BLAKE2B-224",
45
- * "BLAKE2B-256",
46
- * "BLAKE2B-384",
47
- * "BLAKE2B",
48
- * "BLAKE2S",
49
- * "BLAKE3",
50
- * "KECCAK-224",
51
- * "KECCAK-256",
52
- * "KECCAK-384",
53
- * "KECCAK-512",
54
- * "SHA-384",
55
- * "SHA3-224",
56
- * "SHA3-256",
57
- * "SHA3-384",
58
- * "SHA3-512",
59
- * "SHAKE128",
60
- * "SHAKE256",
61
- * "TIGER",
62
- * // insecure (length-extendable):
63
- * "RIPEMD-160",
64
- * "SHA-224",
65
- * "SHA-256",
66
- * "SHA-512",
67
- * // insecure (collidable and length-extendable):
68
- * "MD4",
69
- * "MD5",
70
- * "SHA-1",
71
- * ] as const;
72
- * ```
73
- *
74
- * @example
75
- * ```ts
76
- * import { crypto } from "https://deno.land/std@$STD_VERSION/crypto/mod.ts";
77
- *
78
- * // This will delegate to the runtime's WebCrypto implementation.
79
- * console.log(
80
- * new Uint8Array(
81
- * await crypto.subtle.digest(
82
- * "SHA-384",
83
- * new TextEncoder().encode("hello world"),
84
- * ),
85
- * ),
86
- * );
87
- *
88
- * // This will use a bundled Wasm/Rust implementation.
89
- * console.log(
90
- * new Uint8Array(
91
- * await crypto.subtle.digest(
92
- * "BLAKE3",
93
- * new TextEncoder().encode("hello world"),
94
- * ),
95
- * ),
96
- * );
97
- * ```
98
- *
99
- * @example Convert hash to a string
100
- *
101
- * ```ts
102
- * import {
103
- * crypto,
104
- * toHashString,
105
- * } from "https://deno.land/std@$STD_VERSION/crypto/mod.ts";
106
- *
107
- * const hash = await crypto.subtle.digest(
108
- * "SHA-384",
109
- * new TextEncoder().encode("You hear that Mr. Anderson?"),
110
- * );
111
- *
112
- * // Hex encoding by default
113
- * console.log(toHashString(hash));
114
- *
115
- * // Or with base64 encoding
116
- * console.log(toHashString(hash, "base64"));
117
- * ```
118
- *
119
- * @module
120
- */
121
- import * as dntShim from "../../../../_dnt.shims.js";
122
- import { digestAlgorithms as wasmDigestAlgorithms, instantiateWasm, } from "./_wasm/mod.js";
123
- import { timingSafeEqual } from "./timing_safe_equal.js";
124
- import { fnv } from "./_fnv/mod.js";
125
- /**
126
- * A copy of the global WebCrypto interface, with methods bound so they're
127
- * safe to re-export.
128
- */
129
- const webCrypto = ((crypto) => ({
130
- getRandomValues: crypto.getRandomValues?.bind(crypto),
131
- randomUUID: crypto.randomUUID?.bind(crypto),
132
- subtle: {
133
- decrypt: crypto.subtle?.decrypt?.bind(crypto.subtle),
134
- deriveBits: crypto.subtle?.deriveBits?.bind(crypto.subtle),
135
- deriveKey: crypto.subtle?.deriveKey?.bind(crypto.subtle),
136
- digest: crypto.subtle?.digest?.bind(crypto.subtle),
137
- encrypt: crypto.subtle?.encrypt?.bind(crypto.subtle),
138
- exportKey: crypto.subtle?.exportKey?.bind(crypto.subtle),
139
- generateKey: crypto.subtle?.generateKey?.bind(crypto.subtle),
140
- importKey: crypto.subtle?.importKey?.bind(crypto.subtle),
141
- sign: crypto.subtle?.sign?.bind(crypto.subtle),
142
- unwrapKey: crypto.subtle?.unwrapKey?.bind(crypto.subtle),
143
- verify: crypto.subtle?.verify?.bind(crypto.subtle),
144
- wrapKey: crypto.subtle?.wrapKey?.bind(crypto.subtle),
145
- },
146
- }))(dntShim.dntGlobalThis.crypto);
147
- const bufferSourceBytes = (data) => {
148
- let bytes;
149
- if (data instanceof Uint8Array) {
150
- bytes = data;
151
- }
152
- else if (ArrayBuffer.isView(data)) {
153
- bytes = new Uint8Array(data.buffer, data.byteOffset, data.byteLength);
154
- }
155
- else if (data instanceof ArrayBuffer) {
156
- bytes = new Uint8Array(data);
157
- }
158
- return bytes;
159
- };
160
- /**
161
- * An wrapper for WebCrypto adding support for additional non-standard
162
- * algorithms, but delegating to the runtime WebCrypto implementation whenever
163
- * possible.
164
- */
165
- const stdCrypto = ((x) => x)({
166
- ...webCrypto,
167
- subtle: {
168
- ...webCrypto.subtle,
169
- /**
170
- * Polyfills stream support until the Web Crypto API does so:
171
- * @see {@link https://github.com/wintercg/proposal-webcrypto-streams}
172
- */
173
- async digest(algorithm, data) {
174
- const { name, length } = normalizeAlgorithm(algorithm);
175
- const bytes = bufferSourceBytes(data);
176
- if (FNVAlgorithms.includes(name)) {
177
- return fnv(name, bytes);
178
- }
179
- // We delegate to WebCrypto whenever possible,
180
- if (
181
- // if the algorithm is supported by the WebCrypto standard,
182
- webCryptoDigestAlgorithms.includes(name) &&
183
- // and the data is a single buffer,
184
- bytes) {
185
- return webCrypto.subtle.digest(algorithm, bytes);
186
- }
187
- else if (wasmDigestAlgorithms.includes(name)) {
188
- if (bytes) {
189
- // Otherwise, we use our bundled Wasm implementation via digestSync
190
- // if it supports the algorithm.
191
- return stdCrypto.subtle.digestSync(algorithm, bytes);
192
- }
193
- else if (data[Symbol.iterator]) {
194
- return stdCrypto.subtle.digestSync(algorithm, data);
195
- }
196
- else if (data[Symbol.asyncIterator]) {
197
- const wasmCrypto = instantiateWasm();
198
- const context = new wasmCrypto.DigestContext(name);
199
- for await (const chunk of data) {
200
- const chunkBytes = bufferSourceBytes(chunk);
201
- if (!chunkBytes) {
202
- throw new TypeError("data contained chunk of the wrong type");
203
- }
204
- context.update(chunkBytes);
205
- }
206
- return context.digestAndDrop(length).buffer;
207
- }
208
- else {
209
- throw new TypeError("data must be a BufferSource or [Async]Iterable<BufferSource>");
210
- }
211
- }
212
- else if (webCrypto.subtle?.digest) {
213
- // (TypeScript type definitions prohibit this case.) If they're trying
214
- // to call an algorithm we don't recognize, pass it along to WebCrypto
215
- // in case it's a non-standard algorithm supported by the the runtime
216
- // they're using.
217
- return webCrypto.subtle.digest(algorithm, data);
218
- }
219
- else {
220
- throw new TypeError(`unsupported digest algorithm: ${algorithm}`);
221
- }
222
- },
223
- digestSync(algorithm, data) {
224
- algorithm = normalizeAlgorithm(algorithm);
225
- const bytes = bufferSourceBytes(data);
226
- if (FNVAlgorithms.includes(algorithm.name)) {
227
- return fnv(algorithm.name, bytes);
228
- }
229
- const wasmCrypto = instantiateWasm();
230
- if (bytes) {
231
- return wasmCrypto.digest(algorithm.name, bytes, algorithm.length)
232
- .buffer;
233
- }
234
- else if (data[Symbol.iterator]) {
235
- const context = new wasmCrypto.DigestContext(algorithm.name);
236
- for (const chunk of data) {
237
- const chunkBytes = bufferSourceBytes(chunk);
238
- if (!chunkBytes) {
239
- throw new TypeError("data contained chunk of the wrong type");
240
- }
241
- context.update(chunkBytes);
242
- }
243
- return context.digestAndDrop(algorithm.length).buffer;
244
- }
245
- else {
246
- throw new TypeError("data must be a BufferSource or Iterable<BufferSource>");
247
- }
248
- },
249
- // TODO(@kitsonk): rework when https://github.com/w3c/webcrypto/issues/270 resolved
250
- timingSafeEqual,
251
- },
252
- });
253
- const FNVAlgorithms = ["FNV32", "FNV32A", "FNV64", "FNV64A"];
254
- /** Digest algorithms supported by WebCrypto. */
255
- const webCryptoDigestAlgorithms = [
256
- "SHA-384",
257
- "SHA-256",
258
- "SHA-512",
259
- // insecure (length-extendable and collidable):
260
- "SHA-1",
261
- ];
262
- const normalizeAlgorithm = (algorithm) => ((typeof algorithm === "string") ? { name: algorithm.toUpperCase() } : {
263
- ...algorithm,
264
- name: algorithm.name.toUpperCase(),
265
- });
266
- export { stdCrypto as crypto };
@@ -1,4 +0,0 @@
1
- /**
2
- * @deprecated (will be removed after 0.209.0) Import from `std/crypto/unstable/keystack.ts` instead.
3
- */
4
- export * from "./unstable/keystack.js";
@@ -1,6 +0,0 @@
1
- // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
2
- // This module is browser compatible.
3
- /**
4
- * @deprecated (will be removed after 0.209.0) Import from `std/crypto/unstable/keystack.ts` instead.
5
- */
6
- export * from "./unstable/keystack.js";
@@ -1,12 +0,0 @@
1
- /**
2
- * Extensions to the
3
- * [Web Crypto](https://developer.mozilla.org/en-US/docs/Web/API/Web_Crypto_API)
4
- * supporting additional encryption APIs, but also delegating to the built-in
5
- * APIs when possible.
6
- *
7
- * @module
8
- */
9
- export * from "./crypto.js";
10
- export * from "./keystack.js";
11
- export * from "./timing_safe_equal.js";
12
- export * from "./to_hash_string.js";
@@ -1,14 +0,0 @@
1
- // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
2
- // This module is browser compatible.
3
- /**
4
- * Extensions to the
5
- * [Web Crypto](https://developer.mozilla.org/en-US/docs/Web/API/Web_Crypto_API)
6
- * supporting additional encryption APIs, but also delegating to the built-in
7
- * APIs when possible.
8
- *
9
- * @module
10
- */
11
- export * from "./crypto.js";
12
- export * from "./keystack.js";
13
- export * from "./timing_safe_equal.js";
14
- export * from "./to_hash_string.js";
@@ -1,28 +0,0 @@
1
- /**
2
- * When checking the values of cryptographic hashes are equal, default
3
- * comparisons can be susceptible to timing based attacks, where attacker is
4
- * able to find out information about the host system by repeatedly checking
5
- * response times to equality comparisons of values.
6
- *
7
- * It is likely some form of timing safe equality will make its way to the
8
- * WebCrypto standard (see:
9
- * [w3c/webcrypto#270](https://github.com/w3c/webcrypto/issues/270)), but until
10
- * that time, `timingSafeEqual()` is provided:
11
- *
12
- * ```ts
13
- * import { timingSafeEqual } from "https://deno.land/std@$STD_VERSION/crypto/timing_safe_equal.ts";
14
- * import { assert } from "https://deno.land/std@$STD_VERSION/assert/assert.ts";
15
- *
16
- * const a = await crypto.subtle.digest(
17
- * "SHA-384",
18
- * new TextEncoder().encode("hello world"),
19
- * );
20
- * const b = await crypto.subtle.digest(
21
- * "SHA-384",
22
- * new TextEncoder().encode("hello world"),
23
- * );
24
- *
25
- * assert(timingSafeEqual(a, b));
26
- * ```
27
- */
28
- export declare function timingSafeEqual(a: ArrayBufferView | ArrayBufferLike | DataView, b: ArrayBufferView | ArrayBufferLike | DataView): boolean;
@@ -1,54 +0,0 @@
1
- // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
2
- // This module is browser compatible.
3
- import { assert } from "../assert/assert.js";
4
- /**
5
- * When checking the values of cryptographic hashes are equal, default
6
- * comparisons can be susceptible to timing based attacks, where attacker is
7
- * able to find out information about the host system by repeatedly checking
8
- * response times to equality comparisons of values.
9
- *
10
- * It is likely some form of timing safe equality will make its way to the
11
- * WebCrypto standard (see:
12
- * [w3c/webcrypto#270](https://github.com/w3c/webcrypto/issues/270)), but until
13
- * that time, `timingSafeEqual()` is provided:
14
- *
15
- * ```ts
16
- * import { timingSafeEqual } from "https://deno.land/std@$STD_VERSION/crypto/timing_safe_equal.ts";
17
- * import { assert } from "https://deno.land/std@$STD_VERSION/assert/assert.ts";
18
- *
19
- * const a = await crypto.subtle.digest(
20
- * "SHA-384",
21
- * new TextEncoder().encode("hello world"),
22
- * );
23
- * const b = await crypto.subtle.digest(
24
- * "SHA-384",
25
- * new TextEncoder().encode("hello world"),
26
- * );
27
- *
28
- * assert(timingSafeEqual(a, b));
29
- * ```
30
- */
31
- export function timingSafeEqual(a, b) {
32
- if (a.byteLength !== b.byteLength) {
33
- return false;
34
- }
35
- if (!(a instanceof DataView)) {
36
- a = ArrayBuffer.isView(a)
37
- ? new DataView(a.buffer, a.byteOffset, a.byteLength)
38
- : new DataView(a);
39
- }
40
- if (!(b instanceof DataView)) {
41
- b = ArrayBuffer.isView(b)
42
- ? new DataView(b.buffer, b.byteOffset, b.byteLength)
43
- : new DataView(b);
44
- }
45
- assert(a instanceof DataView);
46
- assert(b instanceof DataView);
47
- const length = a.byteLength;
48
- let out = 0;
49
- let i = -1;
50
- while (++i < length) {
51
- out |= a.getUint8(i) ^ b.getUint8(i);
52
- }
53
- return out === 0;
54
- }
@@ -1,19 +0,0 @@
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;
@@ -1,31 +0,0 @@
1
- // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
2
- // This module is browser compatible.
3
- import { encode as hexEncode } from "../encoding/hex.js";
4
- import { encode as base64Encode } from "../encoding/base64.js";
5
- const decoder = new TextDecoder();
6
- /**
7
- * @deprecated (will be removed after 0.209.0) Use `std/encoding/hex.ts` or `std/encoding/base64.ts` instead.
8
- *
9
- * Converts a hash to a string with a given encoding.
10
- * @example
11
- * ```ts
12
- * import { crypto } from "https://deno.land/std@$STD_VERSION/crypto/crypto.ts";
13
- * import { toHashString } from "https://deno.land/std@$STD_VERSION/crypto/to_hash_string.ts"
14
- *
15
- * const hash = await crypto.subtle.digest("SHA-384", new TextEncoder().encode("You hear that Mr. Anderson?"));
16
- *
17
- * // Hex encoding by default
18
- * console.log(toHashString(hash));
19
- *
20
- * // Or with base64 encoding
21
- * console.log(toHashString(hash, "base64"));
22
- * ```
23
- */
24
- export function toHashString(hash, encoding = "hex") {
25
- switch (encoding) {
26
- case "hex":
27
- return decoder.decode(hexEncode(new Uint8Array(hash)));
28
- case "base64":
29
- return base64Encode(hash);
30
- }
31
- }