@waku/rln 0.1.3-f6d5deb → 0.1.4-29a4c3f.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 (341) hide show
  1. package/README.md +10 -186
  2. package/bundle/_virtual/__node-resolve_empty.js +6 -0
  3. package/bundle/_virtual/_assert.js +3 -0
  4. package/bundle/_virtual/_commonjs-dynamic-modules.js +5 -0
  5. package/bundle/_virtual/_commonjsHelpers.js +32 -0
  6. package/bundle/_virtual/_node-resolve_empty.js +3 -0
  7. package/bundle/_virtual/_sha2.js +3 -0
  8. package/bundle/_virtual/_u64.js +3 -0
  9. package/bundle/_virtual/aes.js +3 -0
  10. package/bundle/_virtual/bn.js +3 -0
  11. package/bundle/_virtual/browser.js +3 -0
  12. package/bundle/_virtual/checksum.js +3 -0
  13. package/bundle/_virtual/cipher.js +3 -0
  14. package/bundle/_virtual/class.js +3 -0
  15. package/bundle/_virtual/common.js +3 -0
  16. package/bundle/_virtual/common2.js +3 -0
  17. package/bundle/_virtual/cryptoBrowser.js +3 -0
  18. package/bundle/_virtual/functional.js +3 -0
  19. package/bundle/_virtual/hash.js +3 -0
  20. package/bundle/_virtual/hmac.js +3 -0
  21. package/bundle/_virtual/index.js +3 -0
  22. package/bundle/_virtual/index2.js +6 -0
  23. package/bundle/_virtual/inherits_browser.js +3 -0
  24. package/bundle/_virtual/kdf.js +3 -0
  25. package/bundle/_virtual/lodash.js +3 -0
  26. package/bundle/_virtual/password.js +3 -0
  27. package/bundle/_virtual/pbkdf2.js +3 -0
  28. package/bundle/_virtual/pbkdf22.js +3 -0
  29. package/bundle/_virtual/random.js +3 -0
  30. package/bundle/_virtual/ripemd.js +3 -0
  31. package/bundle/_virtual/schema-validation-generated.js +3 -0
  32. package/bundle/_virtual/schema-validation.js +3 -0
  33. package/bundle/_virtual/scrypt.js +3 -0
  34. package/bundle/_virtual/scrypt2.js +3 -0
  35. package/bundle/_virtual/sha.js +3 -0
  36. package/bundle/_virtual/sha256.js +3 -0
  37. package/bundle/_virtual/sha2562.js +3 -0
  38. package/bundle/_virtual/sha3.js +3 -0
  39. package/bundle/_virtual/sha512.js +3 -0
  40. package/bundle/_virtual/types.js +3 -0
  41. package/bundle/_virtual/utils.js +3 -0
  42. package/bundle/_virtual/utils2.js +3 -0
  43. package/bundle/_virtual/utils3.js +3 -0
  44. package/bundle/index.js +12 -74804
  45. package/bundle/node_modules/@ethersproject/abi/lib.esm/_version.js +3 -0
  46. package/bundle/node_modules/@ethersproject/abi/lib.esm/abi-coder.js +96 -0
  47. package/bundle/node_modules/@ethersproject/abi/lib.esm/coders/abstract-coder.js +148 -0
  48. package/bundle/node_modules/@ethersproject/abi/lib.esm/coders/address.js +26 -0
  49. package/bundle/node_modules/@ethersproject/abi/lib.esm/coders/anonymous.js +20 -0
  50. package/bundle/node_modules/@ethersproject/abi/lib.esm/coders/array.js +210 -0
  51. package/bundle/node_modules/@ethersproject/abi/lib.esm/coders/boolean.js +18 -0
  52. package/bundle/node_modules/@ethersproject/abi/lib.esm/coders/bytes.js +30 -0
  53. package/bundle/node_modules/@ethersproject/abi/lib.esm/coders/fixed-bytes.js +26 -0
  54. package/bundle/node_modules/@ethersproject/abi/lib.esm/coders/null.js +22 -0
  55. package/bundle/node_modules/@ethersproject/abi/lib.esm/coders/number.js +43 -0
  56. package/bundle/node_modules/@ethersproject/abi/lib.esm/coders/string.js +19 -0
  57. package/bundle/node_modules/@ethersproject/abi/lib.esm/coders/tuple.js +58 -0
  58. package/bundle/node_modules/@ethersproject/abi/lib.esm/fragments.js +854 -0
  59. package/bundle/node_modules/@ethersproject/abi/lib.esm/interface.js +609 -0
  60. package/bundle/node_modules/@ethersproject/abstract-provider/lib.esm/_version.js +3 -0
  61. package/bundle/node_modules/@ethersproject/abstract-provider/lib.esm/index.js +66 -0
  62. package/bundle/node_modules/@ethersproject/abstract-signer/lib.esm/_version.js +3 -0
  63. package/bundle/node_modules/@ethersproject/abstract-signer/lib.esm/index.js +302 -0
  64. package/bundle/node_modules/@ethersproject/address/lib.esm/_version.js +3 -0
  65. package/bundle/node_modules/@ethersproject/address/lib.esm/index.js +110 -0
  66. package/bundle/node_modules/@ethersproject/base64/lib.esm/base64.js +20 -0
  67. package/bundle/node_modules/@ethersproject/basex/lib.esm/index.js +120 -0
  68. package/bundle/node_modules/@ethersproject/bignumber/lib.esm/_version.js +3 -0
  69. package/bundle/node_modules/@ethersproject/bignumber/lib.esm/bignumber.js +287 -0
  70. package/bundle/node_modules/@ethersproject/bytes/lib.esm/_version.js +3 -0
  71. package/bundle/node_modules/@ethersproject/bytes/lib.esm/index.js +402 -0
  72. package/bundle/node_modules/@ethersproject/constants/lib.esm/addresses.js +3 -0
  73. package/bundle/node_modules/@ethersproject/constants/lib.esm/bignumbers.js +8 -0
  74. package/bundle/node_modules/@ethersproject/constants/lib.esm/hashes.js +3 -0
  75. package/bundle/node_modules/@ethersproject/contracts/lib.esm/_version.js +3 -0
  76. package/bundle/node_modules/@ethersproject/contracts/lib.esm/index.js +893 -0
  77. package/bundle/node_modules/@ethersproject/hash/lib.esm/_version.js +3 -0
  78. package/bundle/node_modules/@ethersproject/hash/lib.esm/ens-normalize/decoder.js +256 -0
  79. package/bundle/node_modules/@ethersproject/hash/lib.esm/ens-normalize/include.js +36 -0
  80. package/bundle/node_modules/@ethersproject/hash/lib.esm/ens-normalize/lib.js +135 -0
  81. package/bundle/node_modules/@ethersproject/hash/lib.esm/id.js +8 -0
  82. package/bundle/node_modules/@ethersproject/hash/lib.esm/namehash.js +64 -0
  83. package/bundle/node_modules/@ethersproject/hash/lib.esm/typed-data.js +443 -0
  84. package/bundle/node_modules/@ethersproject/keccak256/lib.esm/index.js +8 -0
  85. package/bundle/node_modules/@ethersproject/keccak256/node_modules/js-sha3/src/sha3.js +660 -0
  86. package/bundle/node_modules/@ethersproject/logger/lib.esm/_version.js +3 -0
  87. package/bundle/node_modules/@ethersproject/logger/lib.esm/index.js +352 -0
  88. package/bundle/node_modules/@ethersproject/networks/lib.esm/_version.js +3 -0
  89. package/bundle/node_modules/@ethersproject/networks/lib.esm/index.js +248 -0
  90. package/bundle/node_modules/@ethersproject/properties/lib.esm/_version.js +3 -0
  91. package/bundle/node_modules/@ethersproject/properties/lib.esm/index.js +127 -0
  92. package/bundle/node_modules/@ethersproject/providers/lib.esm/_version.js +3 -0
  93. package/bundle/node_modules/@ethersproject/providers/lib.esm/base-provider.js +2007 -0
  94. package/bundle/node_modules/@ethersproject/providers/lib.esm/formatter.js +422 -0
  95. package/bundle/node_modules/@ethersproject/providers/lib.esm/json-rpc-provider.js +674 -0
  96. package/bundle/node_modules/@ethersproject/providers/lib.esm/web3-provider.js +132 -0
  97. package/bundle/node_modules/@ethersproject/rlp/lib.esm/_version.js +3 -0
  98. package/bundle/node_modules/@ethersproject/rlp/lib.esm/index.js +120 -0
  99. package/bundle/node_modules/@ethersproject/sha2/lib.esm/sha2.js +8 -0
  100. package/bundle/node_modules/@ethersproject/signing-key/lib.esm/_version.js +3 -0
  101. package/bundle/node_modules/@ethersproject/signing-key/lib.esm/elliptic.js +2430 -0
  102. package/bundle/node_modules/@ethersproject/signing-key/lib.esm/index.js +76 -0
  103. package/bundle/node_modules/@ethersproject/strings/lib.esm/_version.js +3 -0
  104. package/bundle/node_modules/@ethersproject/strings/lib.esm/utf8.js +219 -0
  105. package/bundle/node_modules/@ethersproject/transactions/lib.esm/_version.js +3 -0
  106. package/bundle/node_modules/@ethersproject/transactions/lib.esm/index.js +279 -0
  107. package/bundle/node_modules/@ethersproject/web/lib.esm/_version.js +3 -0
  108. package/bundle/node_modules/@ethersproject/web/lib.esm/geturl.js +69 -0
  109. package/bundle/node_modules/@ethersproject/web/lib.esm/index.js +404 -0
  110. package/bundle/node_modules/@multiformats/multiaddr/dist/src/convert.js +15 -0
  111. package/bundle/node_modules/@multiformats/multiaddr/dist/src/multiaddr.js +20 -0
  112. package/bundle/node_modules/@multiformats/multiaddr/dist/src/protocols-table.js +92 -0
  113. package/bundle/node_modules/@noble/hashes/esm/_assert.js +37 -0
  114. package/bundle/node_modules/@noble/hashes/esm/_md.js +132 -0
  115. package/bundle/node_modules/@noble/hashes/esm/_u64.js +29 -0
  116. package/bundle/node_modules/@noble/hashes/esm/sha256.js +113 -0
  117. package/bundle/node_modules/@noble/hashes/esm/sha3.js +210 -0
  118. package/bundle/node_modules/@noble/hashes/esm/utils.js +144 -0
  119. package/bundle/node_modules/@waku/zerokit-rln-wasm/rln_wasm.js +756 -0
  120. package/bundle/node_modules/bech32/index.js +187 -0
  121. package/bundle/node_modules/bn.js/lib/bn.js +3361 -0
  122. package/bundle/node_modules/debug/src/browser.js +283 -0
  123. package/bundle/node_modules/debug/src/common.js +295 -0
  124. package/bundle/node_modules/ethereum-cryptography/esm/keccak.js +10 -0
  125. package/bundle/node_modules/ethereum-cryptography/esm/sha256.js +6 -0
  126. package/bundle/node_modules/ethereum-cryptography/esm/utils.js +24 -0
  127. package/bundle/node_modules/hash.js/lib/hash/common.js +97 -0
  128. package/bundle/node_modules/hash.js/lib/hash/hmac.js +51 -0
  129. package/bundle/node_modules/hash.js/lib/hash/ripemd.js +152 -0
  130. package/bundle/node_modules/hash.js/lib/hash/sha/1.js +81 -0
  131. package/bundle/node_modules/hash.js/lib/hash/sha/224.js +33 -0
  132. package/bundle/node_modules/hash.js/lib/hash/sha/256.js +113 -0
  133. package/bundle/node_modules/hash.js/lib/hash/sha/384.js +39 -0
  134. package/bundle/node_modules/hash.js/lib/hash/sha/512.js +336 -0
  135. package/bundle/node_modules/hash.js/lib/hash/sha/common.js +53 -0
  136. package/bundle/node_modules/hash.js/lib/hash/sha.js +14 -0
  137. package/bundle/node_modules/hash.js/lib/hash/utils.js +282 -0
  138. package/bundle/node_modules/hash.js/lib/hash.js +33 -0
  139. package/bundle/node_modules/inherits/inherits_browser.js +33 -0
  140. package/bundle/node_modules/it-length-prefixed/dist/src/decode.js +6 -0
  141. package/bundle/node_modules/lodash/lodash.js +17207 -0
  142. package/bundle/node_modules/minimalistic-assert/index.js +13 -0
  143. package/bundle/node_modules/ms/index.js +172 -0
  144. package/bundle/node_modules/multiformats/dist/src/bases/base.js +205 -0
  145. package/bundle/node_modules/multiformats/dist/src/bases/base10.js +9 -0
  146. package/bundle/node_modules/multiformats/dist/src/bases/base16.js +16 -0
  147. package/bundle/node_modules/multiformats/dist/src/bases/base2.js +10 -0
  148. package/bundle/node_modules/multiformats/dist/src/bases/base256emoji.js +41 -0
  149. package/bundle/node_modules/multiformats/dist/src/bases/base32.js +58 -0
  150. package/bundle/node_modules/multiformats/dist/src/bases/base36.js +14 -0
  151. package/bundle/node_modules/multiformats/dist/src/bases/base58.js +14 -0
  152. package/bundle/node_modules/multiformats/dist/src/bases/base64.js +28 -0
  153. package/bundle/node_modules/multiformats/dist/src/bases/base8.js +10 -0
  154. package/bundle/node_modules/multiformats/dist/src/bases/identity.js +11 -0
  155. package/bundle/node_modules/multiformats/dist/src/basics.js +15 -0
  156. package/bundle/node_modules/multiformats/dist/src/bytes.js +18 -0
  157. package/bundle/node_modules/multiformats/dist/src/codecs/json.js +2 -0
  158. package/bundle/node_modules/multiformats/dist/src/vendor/base-x.js +170 -0
  159. package/bundle/node_modules/protons-runtime/dist/src/codec.js +20 -0
  160. package/bundle/node_modules/protons-runtime/dist/src/codecs/enum.js +24 -0
  161. package/bundle/node_modules/protons-runtime/dist/src/codecs/message.js +7 -0
  162. package/bundle/node_modules/protons-runtime/dist/src/decode.js +8 -0
  163. package/bundle/node_modules/protons-runtime/dist/src/encode.js +11 -0
  164. package/bundle/node_modules/protons-runtime/dist/src/index.js +30 -0
  165. package/bundle/node_modules/protons-runtime/dist/src/utils/float.js +54 -0
  166. package/bundle/node_modules/protons-runtime/dist/src/utils/longbits.js +175 -0
  167. package/bundle/node_modules/protons-runtime/dist/src/utils/pool.js +28 -0
  168. package/bundle/node_modules/protons-runtime/dist/src/utils/reader.js +367 -0
  169. package/bundle/node_modules/protons-runtime/dist/src/utils/utf8.js +99 -0
  170. package/bundle/node_modules/protons-runtime/dist/src/utils/writer.js +438 -0
  171. package/bundle/node_modules/uint8-varint/dist/src/index.js +124 -0
  172. package/bundle/node_modules/uint8arrays/dist/src/alloc.js +17 -0
  173. package/bundle/node_modules/uint8arrays/dist/src/from-string.js +19 -0
  174. package/bundle/node_modules/uint8arrays/dist/src/util/bases.js +49 -0
  175. package/bundle/packages/core/dist/lib/connection_manager/connection_manager.js +21 -0
  176. package/bundle/packages/core/dist/lib/connection_manager/keep_alive_manager.js +18 -0
  177. package/bundle/packages/core/dist/lib/filter/filter.js +27 -0
  178. package/bundle/packages/core/dist/lib/light_push/light_push.js +27 -0
  179. package/bundle/packages/core/dist/lib/message/version_0.js +154 -0
  180. package/bundle/packages/core/dist/lib/metadata/metadata.js +27 -0
  181. package/bundle/packages/core/dist/lib/store/store.js +27 -0
  182. package/bundle/packages/interfaces/dist/connection_manager.js +19 -0
  183. package/bundle/packages/interfaces/dist/constants.js +6 -0
  184. package/bundle/packages/interfaces/dist/health_indicator.js +12 -0
  185. package/bundle/packages/interfaces/dist/protocols.js +92 -0
  186. package/bundle/packages/proto/dist/generated/filter.js +445 -0
  187. package/bundle/packages/proto/dist/generated/filter_v2.js +424 -0
  188. package/bundle/packages/proto/dist/generated/light_push.js +389 -0
  189. package/bundle/packages/proto/dist/generated/message.js +213 -0
  190. package/bundle/packages/proto/dist/generated/metadata.js +130 -0
  191. package/bundle/packages/proto/dist/generated/peer_exchange.js +209 -0
  192. package/bundle/packages/proto/dist/generated/sds_message.js +105 -0
  193. package/bundle/packages/proto/dist/generated/store_v3.js +490 -0
  194. package/bundle/packages/proto/dist/generated/topic_only_message.js +61 -0
  195. package/bundle/packages/rln/dist/codec.js +93 -0
  196. package/bundle/packages/rln/dist/contract/abi.js +394 -0
  197. package/bundle/packages/rln/dist/contract/constants.js +27 -0
  198. package/bundle/packages/rln/dist/contract/rln_contract.js +438 -0
  199. package/bundle/packages/rln/dist/create.js +9 -0
  200. package/bundle/packages/rln/dist/identity.js +30 -0
  201. package/bundle/packages/rln/dist/keystore/cipher.js +31 -0
  202. package/bundle/packages/rln/dist/keystore/credential_validation_generated.js +119 -0
  203. package/bundle/packages/rln/dist/keystore/keystore.js +223 -0
  204. package/bundle/packages/rln/dist/keystore/keystore_validation_generated.js +74 -0
  205. package/bundle/packages/rln/dist/keystore/schema_validator.js +20 -0
  206. package/bundle/packages/rln/dist/message.js +51 -0
  207. package/bundle/packages/rln/dist/proof.js +54 -0
  208. package/bundle/packages/rln/dist/resources/verification_key.js +112 -0
  209. package/bundle/packages/rln/dist/resources/witness_calculator.js +330 -0
  210. package/bundle/packages/rln/dist/rln.js +220 -0
  211. package/bundle/packages/rln/dist/root_tracker.js +76 -0
  212. package/bundle/packages/rln/dist/utils/bytes.js +65 -0
  213. package/bundle/packages/rln/dist/utils/epoch.js +39 -0
  214. package/bundle/packages/rln/dist/utils/hash.js +10 -0
  215. package/bundle/packages/rln/dist/utils/metamask.js +14 -0
  216. package/bundle/packages/rln/dist/zerokit.js +128 -0
  217. package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/lib/checksum.js +52 -0
  218. package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/lib/cipher.js +65 -0
  219. package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/lib/class.js +99 -0
  220. package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/lib/functional.js +103 -0
  221. package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/lib/index.js +28 -0
  222. package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/lib/kdf.js +78 -0
  223. package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/lib/password.js +17 -0
  224. package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/lib/schema-validation-generated.js +1253 -0
  225. package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/lib/schema-validation.js +40 -0
  226. package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/lib/types.js +5 -0
  227. package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/node_modules/ethereum-cryptography/aes.js +103 -0
  228. package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/node_modules/ethereum-cryptography/pbkdf2.js +41 -0
  229. package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/node_modules/ethereum-cryptography/random.js +17 -0
  230. package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/node_modules/ethereum-cryptography/scrypt.js +23 -0
  231. package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/node_modules/ethereum-cryptography/sha256.js +12 -0
  232. package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/node_modules/ethereum-cryptography/utils.js +77 -0
  233. package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/index.js +9 -0
  234. package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/md5.js +215 -0
  235. package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/nil.js +3 -0
  236. package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/parse.js +35 -0
  237. package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/regex.js +3 -0
  238. package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/rng.js +21 -0
  239. package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/sha1.js +96 -0
  240. package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/stringify.js +31 -0
  241. package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/v1.js +96 -0
  242. package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/v3.js +6 -0
  243. package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/v35.js +66 -0
  244. package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/v4.js +24 -0
  245. package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/v5.js +6 -0
  246. package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/validate.js +7 -0
  247. package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/version.js +11 -0
  248. package/bundle/packages/rln/node_modules/@noble/hashes/_assert.js +52 -0
  249. package/bundle/packages/rln/node_modules/@noble/hashes/_sha2.js +124 -0
  250. package/bundle/packages/rln/node_modules/@noble/hashes/_u64.js +71 -0
  251. package/bundle/packages/rln/node_modules/@noble/hashes/cryptoBrowser.js +10 -0
  252. package/bundle/packages/rln/node_modules/@noble/hashes/hmac.js +88 -0
  253. package/bundle/packages/rln/node_modules/@noble/hashes/pbkdf2.js +99 -0
  254. package/bundle/packages/rln/node_modules/@noble/hashes/scrypt.js +233 -0
  255. package/bundle/packages/rln/node_modules/@noble/hashes/sha256.js +133 -0
  256. package/bundle/packages/rln/node_modules/@noble/hashes/sha512.js +243 -0
  257. package/bundle/packages/rln/node_modules/@noble/hashes/utils.js +167 -0
  258. package/bundle/packages/rln/node_modules/uuid/dist/esm-browser/native.js +4 -0
  259. package/bundle/packages/rln/node_modules/uuid/dist/esm-browser/rng.js +13 -0
  260. package/bundle/packages/rln/node_modules/uuid/dist/esm-browser/stringify.js +28 -0
  261. package/bundle/packages/rln/node_modules/uuid/dist/esm-browser/v4.js +19 -0
  262. package/bundle/packages/utils/dist/bytes/index.js +44 -0
  263. package/bundle/packages/utils/dist/common/sharding/index.js +91 -0
  264. package/bundle/packages/utils/dist/logger/index.js +31 -0
  265. package/bundle/resources/verification_key.d.ts +13 -0
  266. package/bundle/resources/verification_key.js +112 -0
  267. package/bundle/resources/witness_calculator.d.ts +11 -0
  268. package/bundle/resources/witness_calculator.js +328 -0
  269. package/dist/.tsbuildinfo +1 -0
  270. package/dist/codec.d.ts +5 -5
  271. package/dist/codec.js +6 -6
  272. package/dist/codec.js.map +1 -1
  273. package/dist/contract/abi.d.ts +42 -0
  274. package/dist/contract/abi.js +393 -0
  275. package/dist/contract/abi.js.map +1 -0
  276. package/dist/contract/constants.d.ts +59 -3
  277. package/dist/contract/constants.js +21 -63
  278. package/dist/contract/constants.js.map +1 -1
  279. package/dist/contract/rln_contract.d.ts +98 -17
  280. package/dist/contract/rln_contract.js +292 -71
  281. package/dist/contract/rln_contract.js.map +1 -1
  282. package/dist/identity.js +5 -2
  283. package/dist/identity.js.map +1 -1
  284. package/dist/index.d.ts +3 -3
  285. package/dist/index.js +3 -3
  286. package/dist/index.js.map +1 -1
  287. package/dist/keystore/cipher.js +3 -3
  288. package/dist/keystore/cipher.js.map +1 -1
  289. package/dist/keystore/credential_validation_generated.js.map +1 -1
  290. package/dist/keystore/keystore.js +4 -4
  291. package/dist/keystore/keystore.js.map +1 -1
  292. package/dist/keystore/keystore_validation_generated.js.map +1 -1
  293. package/dist/message.js +3 -3
  294. package/dist/message.js.map +1 -1
  295. package/dist/proof.js +3 -2
  296. package/dist/proof.js.map +1 -1
  297. package/dist/resources/verification_key.d.ts +12 -11
  298. package/dist/resources/verification_key.js +103 -103
  299. package/dist/resources/witness_calculator.d.ts +10 -15
  300. package/dist/resources/witness_calculator.js +302 -265
  301. package/dist/rln.d.ts +5 -1
  302. package/dist/rln.js +56 -28
  303. package/dist/rln.js.map +1 -1
  304. package/dist/root_tracker.js.map +1 -1
  305. package/dist/utils/epoch.js +5 -5
  306. package/dist/utils/epoch.js.map +1 -1
  307. package/dist/zerokit.d.ts +13 -9
  308. package/dist/zerokit.js +40 -20
  309. package/dist/zerokit.js.map +1 -1
  310. package/package.json +1 -146
  311. package/src/codec.ts +26 -22
  312. package/src/contract/abi.ts +392 -0
  313. package/src/contract/constants.ts +28 -0
  314. package/src/contract/index.ts +2 -0
  315. package/src/contract/rln_contract.ts +686 -0
  316. package/src/identity.ts +8 -4
  317. package/src/index.ts +4 -9
  318. package/src/keystore/cipher.ts +54 -0
  319. package/src/keystore/credential_validation_generated.ts +7 -0
  320. package/src/keystore/index.ts +5 -0
  321. package/src/keystore/keystore.ts +330 -0
  322. package/src/keystore/keystore_validation_generated.ts +7 -0
  323. package/src/keystore/schema_validator.ts +34 -0
  324. package/src/keystore/types.ts +36 -0
  325. package/src/message.ts +10 -10
  326. package/src/proof.ts +13 -11
  327. package/src/resources/verification_key.d.ts +13 -0
  328. package/src/resources/witness_calculator.d.ts +11 -0
  329. package/src/rln.ts +76 -31
  330. package/src/root_tracker.ts +7 -6
  331. package/src/utils/bytes.ts +84 -0
  332. package/src/utils/epoch.ts +30 -0
  333. package/src/utils/hash.ts +15 -0
  334. package/src/utils/index.ts +9 -0
  335. package/src/utils/metamask.ts +17 -0
  336. package/src/zerokit.ts +95 -33
  337. package/bundle/assets/rln_wasm_bg-a503e304.wasm +0 -0
  338. package/dist/resources/verification_key.js.map +0 -1
  339. package/dist/resources/witness_calculator.js.map +0 -1
  340. /package/bundle/{assets/rln-6ded2896.wasm → resources/rln.wasm} +0 -0
  341. /package/bundle/{assets/rln_final-8b299152.zkey → resources/rln_final.zkey} +0 -0
@@ -0,0 +1,40 @@
1
+ import { __exports as schemaValidation } from '../../../../../../_virtual/schema-validation.js';
2
+ import './schema-validation-generated.js';
3
+ import { __exports as schemaValidationGenerated } from '../../../../../../_virtual/schema-validation-generated.js';
4
+
5
+ Object.defineProperty(schemaValidation, "__esModule", { value: true });
6
+ schemaValidation.isValidKeystore = schemaValidation.validateKeystore = schemaValidation.schemaValidationErrors = undefined;
7
+ const schema_validation_generated_1 = schemaValidationGenerated;
8
+ // Redeclare generated function with the proper type
9
+ const _validateKeystore = schema_validation_generated_1.Keystore;
10
+ /**
11
+ * Return schema validation errors for a potential keystore object
12
+ */
13
+ // This function wraps the generated code weirdness
14
+ function schemaValidationErrors(data) {
15
+ const validated = _validateKeystore(data);
16
+ if (validated) {
17
+ return null;
18
+ }
19
+ return _validateKeystore.errors;
20
+ }
21
+ schemaValidation.schemaValidationErrors = schemaValidationErrors;
22
+ /**
23
+ * Validate an unknown object as a valid keystore, throws on invalid keystore
24
+ */
25
+ function validateKeystore(keystore) {
26
+ const errors = schemaValidationErrors(keystore);
27
+ if (errors) {
28
+ throw new Error(errors.map((error) => `${error.instancePath}: ${error.message}`).join('\n'));
29
+ }
30
+ }
31
+ schemaValidation.validateKeystore = validateKeystore;
32
+ /**
33
+ * Predicate for validating an unknown object as a valid keystore
34
+ */
35
+ function isValidKeystore(keystore) {
36
+ return !schemaValidationErrors(keystore);
37
+ }
38
+ schemaValidation.isValidKeystore = isValidKeystore;
39
+
40
+ export { schemaValidation as default };
@@ -0,0 +1,5 @@
1
+ import { __exports as types } from '../../../../../../_virtual/types.js';
2
+
3
+ Object.defineProperty(types, "__esModule", { value: true });
4
+
5
+ export { types as default };
@@ -0,0 +1,103 @@
1
+ import { __exports as aes } from '../../../../../../../_virtual/aes.js';
2
+ import '../../../../@noble/hashes/cryptoBrowser.js';
3
+ import { u as utilsExports } from './utils.js';
4
+ import { __exports as cryptoBrowser } from '../../../../../../../_virtual/cryptoBrowser.js';
5
+
6
+ Object.defineProperty(aes, "__esModule", { value: true });
7
+ aes.decrypt = aes.encrypt = undefined;
8
+ const crypto_1 = cryptoBrowser;
9
+ const utils_1 = utilsExports;
10
+ function validateOpt(key, iv, mode) {
11
+ if (!mode.startsWith("aes-")) {
12
+ throw new Error(`AES submodule doesn't support mode ${mode}`);
13
+ }
14
+ if (iv.length !== 16) {
15
+ throw new Error("AES: wrong IV length");
16
+ }
17
+ if ((mode.startsWith("aes-128") && key.length !== 16) ||
18
+ (mode.startsWith("aes-256") && key.length !== 32)) {
19
+ throw new Error("AES: wrong key length");
20
+ }
21
+ }
22
+ async function getBrowserKey(mode, key, iv) {
23
+ if (!crypto_1.crypto.web) {
24
+ throw new Error("Browser crypto not available.");
25
+ }
26
+ let keyMode;
27
+ if (["aes-128-cbc", "aes-256-cbc"].includes(mode)) {
28
+ keyMode = "cbc";
29
+ }
30
+ if (["aes-128-ctr", "aes-256-ctr"].includes(mode)) {
31
+ keyMode = "ctr";
32
+ }
33
+ if (!keyMode) {
34
+ throw new Error("AES: unsupported mode");
35
+ }
36
+ const wKey = await crypto_1.crypto.web.subtle.importKey("raw", key, { name: `AES-${keyMode.toUpperCase()}`, length: key.length * 8 }, true, ["encrypt", "decrypt"]);
37
+ // node.js uses whole 128 bit as a counter, without nonce, instead of 64 bit
38
+ // recommended by NIST SP800-38A
39
+ return [wKey, { name: `aes-${keyMode}`, iv, counter: iv, length: 128 }];
40
+ }
41
+ async function encrypt(msg, key, iv, mode = "aes-128-ctr", pkcs7PaddingEnabled = true) {
42
+ validateOpt(key, iv, mode);
43
+ if (crypto_1.crypto.web) {
44
+ const [wKey, wOpt] = await getBrowserKey(mode, key, iv);
45
+ const cipher = await crypto_1.crypto.web.subtle.encrypt(wOpt, wKey, msg);
46
+ // Remove PKCS7 padding on cbc mode by stripping end of message
47
+ let res = new Uint8Array(cipher);
48
+ if (!pkcs7PaddingEnabled && wOpt.name === "aes-cbc" && !(msg.length % 16)) {
49
+ res = res.slice(0, -16);
50
+ }
51
+ return res;
52
+ }
53
+ else if (crypto_1.crypto.node) {
54
+ const cipher = crypto_1.crypto.node.createCipheriv(mode, key, iv);
55
+ cipher.setAutoPadding(pkcs7PaddingEnabled);
56
+ return (0, utils_1.concatBytes)(cipher.update(msg), cipher.final());
57
+ }
58
+ else {
59
+ throw new Error("The environment doesn't have AES module");
60
+ }
61
+ }
62
+ aes.encrypt = encrypt;
63
+ async function getPadding(cypherText, key, iv, mode) {
64
+ const lastBlock = cypherText.slice(-16);
65
+ for (let i = 0; i < 16; i++) {
66
+ // Undo xor of iv and fill with lastBlock ^ padding (16)
67
+ lastBlock[i] ^= iv[i] ^ 16;
68
+ }
69
+ const res = await encrypt(lastBlock, key, iv, mode);
70
+ return res.slice(0, 16);
71
+ }
72
+ async function decrypt(cypherText, key, iv, mode = "aes-128-ctr", pkcs7PaddingEnabled = true) {
73
+ validateOpt(key, iv, mode);
74
+ if (crypto_1.crypto.web) {
75
+ const [wKey, wOpt] = await getBrowserKey(mode, key, iv);
76
+ // Add empty padding so Chrome will correctly decrypt message
77
+ if (!pkcs7PaddingEnabled && wOpt.name === "aes-cbc") {
78
+ const padding = await getPadding(cypherText, key, iv, mode);
79
+ cypherText = (0, utils_1.concatBytes)(cypherText, padding);
80
+ }
81
+ const msg = await crypto_1.crypto.web.subtle.decrypt(wOpt, wKey, cypherText);
82
+ const msgBytes = new Uint8Array(msg);
83
+ // Safari always ignores padding (if no padding -> broken message)
84
+ if (wOpt.name === "aes-cbc") {
85
+ const encrypted = await encrypt(msgBytes, key, iv, mode);
86
+ if (!(0, utils_1.equalsBytes)(encrypted, cypherText)) {
87
+ throw new Error("AES: wrong padding");
88
+ }
89
+ }
90
+ return msgBytes;
91
+ }
92
+ else if (crypto_1.crypto.node) {
93
+ const decipher = crypto_1.crypto.node.createDecipheriv(mode, key, iv);
94
+ decipher.setAutoPadding(pkcs7PaddingEnabled);
95
+ return (0, utils_1.concatBytes)(decipher.update(cypherText), decipher.final());
96
+ }
97
+ else {
98
+ throw new Error("The environment doesn't have AES module");
99
+ }
100
+ }
101
+ aes.decrypt = decrypt;
102
+
103
+ export { aes as default };
@@ -0,0 +1,41 @@
1
+ import { __exports as pbkdf2$1 } from '../../../../../../../_virtual/pbkdf2.js';
2
+ import '../../../../@noble/hashes/pbkdf2.js';
3
+ import '../../../../@noble/hashes/sha256.js';
4
+ import '../../../../@noble/hashes/sha512.js';
5
+ import { u as utilsExports } from './utils.js';
6
+ import { __exports as pbkdf2$2 } from '../../../../../../../_virtual/pbkdf22.js';
7
+ import { __exports as sha256 } from '../../../../../../../_virtual/sha2562.js';
8
+ import { __exports as sha512 } from '../../../../../../../_virtual/sha512.js';
9
+
10
+ Object.defineProperty(pbkdf2$1, "__esModule", { value: true });
11
+ pbkdf2$1.pbkdf2Sync = pbkdf2$1.pbkdf2 = undefined;
12
+ const pbkdf2_1 = pbkdf2$2;
13
+ const sha256_1 = sha256;
14
+ const sha512_1 = sha512;
15
+ const utils_1 = utilsExports;
16
+ async function pbkdf2(password, salt, iterations, keylen, digest) {
17
+ if (!["sha256", "sha512"].includes(digest)) {
18
+ throw new Error("Only sha256 and sha512 are supported");
19
+ }
20
+ (0, utils_1.assertBytes)(password);
21
+ (0, utils_1.assertBytes)(salt);
22
+ return (0, pbkdf2_1.pbkdf2Async)(digest === "sha256" ? sha256_1.sha256 : sha512_1.sha512, password, salt, {
23
+ c: iterations,
24
+ dkLen: keylen
25
+ });
26
+ }
27
+ pbkdf2$1.pbkdf2 = pbkdf2;
28
+ function pbkdf2Sync(password, salt, iterations, keylen, digest) {
29
+ if (!["sha256", "sha512"].includes(digest)) {
30
+ throw new Error("Only sha256 and sha512 are supported");
31
+ }
32
+ (0, utils_1.assertBytes)(password);
33
+ (0, utils_1.assertBytes)(salt);
34
+ return (0, pbkdf2_1.pbkdf2)(digest === "sha256" ? sha256_1.sha256 : sha512_1.sha512, password, salt, {
35
+ c: iterations,
36
+ dkLen: keylen
37
+ });
38
+ }
39
+ pbkdf2$1.pbkdf2Sync = pbkdf2Sync;
40
+
41
+ export { pbkdf2$1 as default };
@@ -0,0 +1,17 @@
1
+ import { __exports as random } from '../../../../../../../_virtual/random.js';
2
+ import '../../../../@noble/hashes/utils.js';
3
+ import { __exports as utils } from '../../../../../../../_virtual/utils.js';
4
+
5
+ Object.defineProperty(random, "__esModule", { value: true });
6
+ random.getRandomBytes = random.getRandomBytesSync = undefined;
7
+ const utils_1 = utils;
8
+ function getRandomBytesSync(bytes) {
9
+ return (0, utils_1.randomBytes)(bytes);
10
+ }
11
+ random.getRandomBytesSync = getRandomBytesSync;
12
+ async function getRandomBytes(bytes) {
13
+ return (0, utils_1.randomBytes)(bytes);
14
+ }
15
+ random.getRandomBytes = getRandomBytes;
16
+
17
+ export { random as default };
@@ -0,0 +1,23 @@
1
+ import { __exports as scrypt$1 } from '../../../../../../../_virtual/scrypt.js';
2
+ import '../../../../@noble/hashes/scrypt.js';
3
+ import { u as utilsExports } from './utils.js';
4
+ import { __exports as scrypt$2 } from '../../../../../../../_virtual/scrypt2.js';
5
+
6
+ Object.defineProperty(scrypt$1, "__esModule", { value: true });
7
+ scrypt$1.scryptSync = scrypt$1.scrypt = undefined;
8
+ const scrypt_1 = scrypt$2;
9
+ const utils_1 = utilsExports;
10
+ async function scrypt(password, salt, n, p, r, dkLen, onProgress) {
11
+ (0, utils_1.assertBytes)(password);
12
+ (0, utils_1.assertBytes)(salt);
13
+ return (0, scrypt_1.scryptAsync)(password, salt, { N: n, r, p, dkLen, onProgress });
14
+ }
15
+ scrypt$1.scrypt = scrypt;
16
+ function scryptSync(password, salt, n, p, r, dkLen, onProgress) {
17
+ (0, utils_1.assertBytes)(password);
18
+ (0, utils_1.assertBytes)(salt);
19
+ return (0, scrypt_1.scrypt)(password, salt, { N: n, r, p, dkLen, onProgress });
20
+ }
21
+ scrypt$1.scryptSync = scryptSync;
22
+
23
+ export { scrypt$1 as default };
@@ -0,0 +1,12 @@
1
+ import { __exports as sha256 } from '../../../../../../../_virtual/sha256.js';
2
+ import '../../../../@noble/hashes/sha256.js';
3
+ import { u as utilsExports } from './utils.js';
4
+ import { __exports as sha256$1 } from '../../../../../../../_virtual/sha2562.js';
5
+
6
+ Object.defineProperty(sha256, "__esModule", { value: true });
7
+ sha256.sha256 = undefined;
8
+ const sha256_1 = sha256$1;
9
+ const utils_1 = utilsExports;
10
+ sha256.sha256 = (0, utils_1.wrapHash)(sha256_1.sha256);
11
+
12
+ export { sha256 as default };
@@ -0,0 +1,77 @@
1
+ import { commonjsGlobal } from '../../../../../../../_virtual/_commonjsHelpers.js';
2
+ import { commonjsRequire } from '../../../../../../../_virtual/_commonjs-dynamic-modules.js';
3
+ import { __module as utils } from '../../../../../../../_virtual/utils2.js';
4
+ import '../../../../@noble/hashes/_assert.js';
5
+ import '../../../../@noble/hashes/utils.js';
6
+ import { __exports as _assert } from '../../../../../../../_virtual/_assert.js';
7
+ import { __exports as utils$1 } from '../../../../../../../_virtual/utils.js';
8
+
9
+ utils.exports;
10
+
11
+ (function (module, exports) {
12
+ var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
13
+ return (mod && mod.__esModule) ? mod : { "default": mod };
14
+ };
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.crypto = exports.wrapHash = exports.equalsBytes = exports.hexToBytes = exports.bytesToUtf8 = exports.utf8ToBytes = exports.createView = exports.concatBytes = exports.toHex = exports.bytesToHex = exports.assertBytes = exports.assertBool = undefined;
17
+ // buf.toString('hex') -> toHex(buf)
18
+ const _assert_1 = __importDefault(_assert);
19
+ const utils_1 = utils$1;
20
+ const assertBool = _assert_1.default.bool;
21
+ exports.assertBool = assertBool;
22
+ const assertBytes = _assert_1.default.bytes;
23
+ exports.assertBytes = assertBytes;
24
+ var utils_2 = utils$1;
25
+ Object.defineProperty(exports, "bytesToHex", { enumerable: true, get: function () { return utils_2.bytesToHex; } });
26
+ Object.defineProperty(exports, "toHex", { enumerable: true, get: function () { return utils_2.bytesToHex; } });
27
+ Object.defineProperty(exports, "concatBytes", { enumerable: true, get: function () { return utils_2.concatBytes; } });
28
+ Object.defineProperty(exports, "createView", { enumerable: true, get: function () { return utils_2.createView; } });
29
+ Object.defineProperty(exports, "utf8ToBytes", { enumerable: true, get: function () { return utils_2.utf8ToBytes; } });
30
+ // buf.toString('utf8') -> bytesToUtf8(buf)
31
+ function bytesToUtf8(data) {
32
+ if (!(data instanceof Uint8Array)) {
33
+ throw new TypeError(`bytesToUtf8 expected Uint8Array, got ${typeof data}`);
34
+ }
35
+ return new TextDecoder().decode(data);
36
+ }
37
+ exports.bytesToUtf8 = bytesToUtf8;
38
+ function hexToBytes(data) {
39
+ const sliced = data.startsWith("0x") ? data.substring(2) : data;
40
+ return (0, utils_1.hexToBytes)(sliced);
41
+ }
42
+ exports.hexToBytes = hexToBytes;
43
+ // buf.equals(buf2) -> equalsBytes(buf, buf2)
44
+ function equalsBytes(a, b) {
45
+ if (a.length !== b.length) {
46
+ return false;
47
+ }
48
+ for (let i = 0; i < a.length; i++) {
49
+ if (a[i] !== b[i]) {
50
+ return false;
51
+ }
52
+ }
53
+ return true;
54
+ }
55
+ exports.equalsBytes = equalsBytes;
56
+ // Internal utils
57
+ function wrapHash(hash) {
58
+ return (msg) => {
59
+ _assert_1.default.bytes(msg);
60
+ return hash(msg);
61
+ };
62
+ }
63
+ exports.wrapHash = wrapHash;
64
+ exports.crypto = (() => {
65
+ const webCrypto = typeof self === "object" && "crypto" in self ? self.crypto : undefined;
66
+ const nodeRequire = typeof commonjsRequire === "function" &&
67
+ commonjsRequire.bind(module);
68
+ return {
69
+ node: nodeRequire && !webCrypto ? nodeRequire("crypto") : undefined,
70
+ web: webCrypto
71
+ };
72
+ })();
73
+ } (utils, utils.exports));
74
+
75
+ var utilsExports = utils.exports;
76
+
77
+ export { utilsExports as u };
@@ -0,0 +1,9 @@
1
+ export { default as v1 } from './v1.js';
2
+ export { default as v3 } from './v3.js';
3
+ export { default as v4 } from './v4.js';
4
+ export { default as v5 } from './v5.js';
5
+ export { default as NIL } from './nil.js';
6
+ export { default as version } from './version.js';
7
+ export { default as validate } from './validate.js';
8
+ export { default as stringify } from './stringify.js';
9
+ export { default as parse } from './parse.js';
@@ -0,0 +1,215 @@
1
+ /*
2
+ * Browser-compatible JavaScript MD5
3
+ *
4
+ * Modification of JavaScript MD5
5
+ * https://github.com/blueimp/JavaScript-MD5
6
+ *
7
+ * Copyright 2011, Sebastian Tschan
8
+ * https://blueimp.net
9
+ *
10
+ * Licensed under the MIT license:
11
+ * https://opensource.org/licenses/MIT
12
+ *
13
+ * Based on
14
+ * A JavaScript implementation of the RSA Data Security, Inc. MD5 Message
15
+ * Digest Algorithm, as defined in RFC 1321.
16
+ * Version 2.2 Copyright (C) Paul Johnston 1999 - 2009
17
+ * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
18
+ * Distributed under the BSD License
19
+ * See http://pajhome.org.uk/crypt/md5 for more info.
20
+ */
21
+ function md5(bytes) {
22
+ if (typeof bytes === 'string') {
23
+ var msg = unescape(encodeURIComponent(bytes)); // UTF8 escape
24
+
25
+ bytes = new Uint8Array(msg.length);
26
+
27
+ for (var i = 0; i < msg.length; ++i) {
28
+ bytes[i] = msg.charCodeAt(i);
29
+ }
30
+ }
31
+
32
+ return md5ToHexEncodedArray(wordsToMd5(bytesToWords(bytes), bytes.length * 8));
33
+ }
34
+ /*
35
+ * Convert an array of little-endian words to an array of bytes
36
+ */
37
+
38
+
39
+ function md5ToHexEncodedArray(input) {
40
+ var output = [];
41
+ var length32 = input.length * 32;
42
+ var hexTab = '0123456789abcdef';
43
+
44
+ for (var i = 0; i < length32; i += 8) {
45
+ var x = input[i >> 5] >>> i % 32 & 0xff;
46
+ var hex = parseInt(hexTab.charAt(x >>> 4 & 0x0f) + hexTab.charAt(x & 0x0f), 16);
47
+ output.push(hex);
48
+ }
49
+
50
+ return output;
51
+ }
52
+ /**
53
+ * Calculate output length with padding and bit length
54
+ */
55
+
56
+
57
+ function getOutputLength(inputLength8) {
58
+ return (inputLength8 + 64 >>> 9 << 4) + 14 + 1;
59
+ }
60
+ /*
61
+ * Calculate the MD5 of an array of little-endian words, and a bit length.
62
+ */
63
+
64
+
65
+ function wordsToMd5(x, len) {
66
+ /* append padding */
67
+ x[len >> 5] |= 0x80 << len % 32;
68
+ x[getOutputLength(len) - 1] = len;
69
+ var a = 1732584193;
70
+ var b = -271733879;
71
+ var c = -1732584194;
72
+ var d = 271733878;
73
+
74
+ for (var i = 0; i < x.length; i += 16) {
75
+ var olda = a;
76
+ var oldb = b;
77
+ var oldc = c;
78
+ var oldd = d;
79
+ a = md5ff(a, b, c, d, x[i], 7, -680876936);
80
+ d = md5ff(d, a, b, c, x[i + 1], 12, -389564586);
81
+ c = md5ff(c, d, a, b, x[i + 2], 17, 606105819);
82
+ b = md5ff(b, c, d, a, x[i + 3], 22, -1044525330);
83
+ a = md5ff(a, b, c, d, x[i + 4], 7, -176418897);
84
+ d = md5ff(d, a, b, c, x[i + 5], 12, 1200080426);
85
+ c = md5ff(c, d, a, b, x[i + 6], 17, -1473231341);
86
+ b = md5ff(b, c, d, a, x[i + 7], 22, -45705983);
87
+ a = md5ff(a, b, c, d, x[i + 8], 7, 1770035416);
88
+ d = md5ff(d, a, b, c, x[i + 9], 12, -1958414417);
89
+ c = md5ff(c, d, a, b, x[i + 10], 17, -42063);
90
+ b = md5ff(b, c, d, a, x[i + 11], 22, -1990404162);
91
+ a = md5ff(a, b, c, d, x[i + 12], 7, 1804603682);
92
+ d = md5ff(d, a, b, c, x[i + 13], 12, -40341101);
93
+ c = md5ff(c, d, a, b, x[i + 14], 17, -1502002290);
94
+ b = md5ff(b, c, d, a, x[i + 15], 22, 1236535329);
95
+ a = md5gg(a, b, c, d, x[i + 1], 5, -165796510);
96
+ d = md5gg(d, a, b, c, x[i + 6], 9, -1069501632);
97
+ c = md5gg(c, d, a, b, x[i + 11], 14, 643717713);
98
+ b = md5gg(b, c, d, a, x[i], 20, -373897302);
99
+ a = md5gg(a, b, c, d, x[i + 5], 5, -701558691);
100
+ d = md5gg(d, a, b, c, x[i + 10], 9, 38016083);
101
+ c = md5gg(c, d, a, b, x[i + 15], 14, -660478335);
102
+ b = md5gg(b, c, d, a, x[i + 4], 20, -405537848);
103
+ a = md5gg(a, b, c, d, x[i + 9], 5, 568446438);
104
+ d = md5gg(d, a, b, c, x[i + 14], 9, -1019803690);
105
+ c = md5gg(c, d, a, b, x[i + 3], 14, -187363961);
106
+ b = md5gg(b, c, d, a, x[i + 8], 20, 1163531501);
107
+ a = md5gg(a, b, c, d, x[i + 13], 5, -1444681467);
108
+ d = md5gg(d, a, b, c, x[i + 2], 9, -51403784);
109
+ c = md5gg(c, d, a, b, x[i + 7], 14, 1735328473);
110
+ b = md5gg(b, c, d, a, x[i + 12], 20, -1926607734);
111
+ a = md5hh(a, b, c, d, x[i + 5], 4, -378558);
112
+ d = md5hh(d, a, b, c, x[i + 8], 11, -2022574463);
113
+ c = md5hh(c, d, a, b, x[i + 11], 16, 1839030562);
114
+ b = md5hh(b, c, d, a, x[i + 14], 23, -35309556);
115
+ a = md5hh(a, b, c, d, x[i + 1], 4, -1530992060);
116
+ d = md5hh(d, a, b, c, x[i + 4], 11, 1272893353);
117
+ c = md5hh(c, d, a, b, x[i + 7], 16, -155497632);
118
+ b = md5hh(b, c, d, a, x[i + 10], 23, -1094730640);
119
+ a = md5hh(a, b, c, d, x[i + 13], 4, 681279174);
120
+ d = md5hh(d, a, b, c, x[i], 11, -358537222);
121
+ c = md5hh(c, d, a, b, x[i + 3], 16, -722521979);
122
+ b = md5hh(b, c, d, a, x[i + 6], 23, 76029189);
123
+ a = md5hh(a, b, c, d, x[i + 9], 4, -640364487);
124
+ d = md5hh(d, a, b, c, x[i + 12], 11, -421815835);
125
+ c = md5hh(c, d, a, b, x[i + 15], 16, 530742520);
126
+ b = md5hh(b, c, d, a, x[i + 2], 23, -995338651);
127
+ a = md5ii(a, b, c, d, x[i], 6, -198630844);
128
+ d = md5ii(d, a, b, c, x[i + 7], 10, 1126891415);
129
+ c = md5ii(c, d, a, b, x[i + 14], 15, -1416354905);
130
+ b = md5ii(b, c, d, a, x[i + 5], 21, -57434055);
131
+ a = md5ii(a, b, c, d, x[i + 12], 6, 1700485571);
132
+ d = md5ii(d, a, b, c, x[i + 3], 10, -1894986606);
133
+ c = md5ii(c, d, a, b, x[i + 10], 15, -1051523);
134
+ b = md5ii(b, c, d, a, x[i + 1], 21, -2054922799);
135
+ a = md5ii(a, b, c, d, x[i + 8], 6, 1873313359);
136
+ d = md5ii(d, a, b, c, x[i + 15], 10, -30611744);
137
+ c = md5ii(c, d, a, b, x[i + 6], 15, -1560198380);
138
+ b = md5ii(b, c, d, a, x[i + 13], 21, 1309151649);
139
+ a = md5ii(a, b, c, d, x[i + 4], 6, -145523070);
140
+ d = md5ii(d, a, b, c, x[i + 11], 10, -1120210379);
141
+ c = md5ii(c, d, a, b, x[i + 2], 15, 718787259);
142
+ b = md5ii(b, c, d, a, x[i + 9], 21, -343485551);
143
+ a = safeAdd(a, olda);
144
+ b = safeAdd(b, oldb);
145
+ c = safeAdd(c, oldc);
146
+ d = safeAdd(d, oldd);
147
+ }
148
+
149
+ return [a, b, c, d];
150
+ }
151
+ /*
152
+ * Convert an array bytes to an array of little-endian words
153
+ * Characters >255 have their high-byte silently ignored.
154
+ */
155
+
156
+
157
+ function bytesToWords(input) {
158
+ if (input.length === 0) {
159
+ return [];
160
+ }
161
+
162
+ var length8 = input.length * 8;
163
+ var output = new Uint32Array(getOutputLength(length8));
164
+
165
+ for (var i = 0; i < length8; i += 8) {
166
+ output[i >> 5] |= (input[i / 8] & 0xff) << i % 32;
167
+ }
168
+
169
+ return output;
170
+ }
171
+ /*
172
+ * Add integers, wrapping at 2^32. This uses 16-bit operations internally
173
+ * to work around bugs in some JS interpreters.
174
+ */
175
+
176
+
177
+ function safeAdd(x, y) {
178
+ var lsw = (x & 0xffff) + (y & 0xffff);
179
+ var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
180
+ return msw << 16 | lsw & 0xffff;
181
+ }
182
+ /*
183
+ * Bitwise rotate a 32-bit number to the left.
184
+ */
185
+
186
+
187
+ function bitRotateLeft(num, cnt) {
188
+ return num << cnt | num >>> 32 - cnt;
189
+ }
190
+ /*
191
+ * These functions implement the four basic operations the algorithm uses.
192
+ */
193
+
194
+
195
+ function md5cmn(q, a, b, x, s, t) {
196
+ return safeAdd(bitRotateLeft(safeAdd(safeAdd(a, q), safeAdd(x, t)), s), b);
197
+ }
198
+
199
+ function md5ff(a, b, c, d, x, s, t) {
200
+ return md5cmn(b & c | ~b & d, a, b, x, s, t);
201
+ }
202
+
203
+ function md5gg(a, b, c, d, x, s, t) {
204
+ return md5cmn(b & d | c & ~d, a, b, x, s, t);
205
+ }
206
+
207
+ function md5hh(a, b, c, d, x, s, t) {
208
+ return md5cmn(b ^ c ^ d, a, b, x, s, t);
209
+ }
210
+
211
+ function md5ii(a, b, c, d, x, s, t) {
212
+ return md5cmn(c ^ (b | ~d), a, b, x, s, t);
213
+ }
214
+
215
+ export { md5 as default };
@@ -0,0 +1,3 @@
1
+ var nil = '00000000-0000-0000-0000-000000000000';
2
+
3
+ export { nil as default };
@@ -0,0 +1,35 @@
1
+ import validate from './validate.js';
2
+
3
+ function parse(uuid) {
4
+ if (!validate(uuid)) {
5
+ throw TypeError('Invalid UUID');
6
+ }
7
+
8
+ var v;
9
+ var arr = new Uint8Array(16); // Parse ########-....-....-....-............
10
+
11
+ arr[0] = (v = parseInt(uuid.slice(0, 8), 16)) >>> 24;
12
+ arr[1] = v >>> 16 & 0xff;
13
+ arr[2] = v >>> 8 & 0xff;
14
+ arr[3] = v & 0xff; // Parse ........-####-....-....-............
15
+
16
+ arr[4] = (v = parseInt(uuid.slice(9, 13), 16)) >>> 8;
17
+ arr[5] = v & 0xff; // Parse ........-....-####-....-............
18
+
19
+ arr[6] = (v = parseInt(uuid.slice(14, 18), 16)) >>> 8;
20
+ arr[7] = v & 0xff; // Parse ........-....-....-####-............
21
+
22
+ arr[8] = (v = parseInt(uuid.slice(19, 23), 16)) >>> 8;
23
+ arr[9] = v & 0xff; // Parse ........-....-....-....-############
24
+ // (Use "/" to avoid 32-bit truncation when bit-shifting high-order bytes)
25
+
26
+ arr[10] = (v = parseInt(uuid.slice(24, 36), 16)) / 0x10000000000 & 0xff;
27
+ arr[11] = v / 0x100000000 & 0xff;
28
+ arr[12] = v >>> 24 & 0xff;
29
+ arr[13] = v >>> 16 & 0xff;
30
+ arr[14] = v >>> 8 & 0xff;
31
+ arr[15] = v & 0xff;
32
+ return arr;
33
+ }
34
+
35
+ export { parse as default };
@@ -0,0 +1,3 @@
1
+ var REGEX = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;
2
+
3
+ export { REGEX as default };
@@ -0,0 +1,21 @@
1
+ // Unique ID creation requires a high quality random # generator. In the browser we therefore
2
+ // require the crypto API and do not support built-in fallback to lower quality random number
3
+ // generators (like Math.random()).
4
+ var getRandomValues;
5
+ var rnds8 = new Uint8Array(16);
6
+ function rng() {
7
+ // lazy load so that environments that need to polyfill have a chance to do so
8
+ if (!getRandomValues) {
9
+ // getRandomValues needs to be invoked in a context where "this" is a Crypto implementation. Also,
10
+ // find the complete implementation of crypto (msCrypto) on IE11.
11
+ getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || typeof msCrypto !== 'undefined' && typeof msCrypto.getRandomValues === 'function' && msCrypto.getRandomValues.bind(msCrypto);
12
+
13
+ if (!getRandomValues) {
14
+ throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');
15
+ }
16
+ }
17
+
18
+ return getRandomValues(rnds8);
19
+ }
20
+
21
+ export { rng as default };