@gardenfi/utils 2.1.2-beta.9 → 2.1.3-beta.1
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.
- package/dist/index.cjs +1 -1
- package/dist/index.js +20 -21
- package/dist/index100.cjs +1 -1
- package/dist/index100.js +11 -5
- package/dist/index101.cjs +1 -1
- package/dist/index101.js +5 -10
- package/dist/index102.cjs +1 -1
- package/dist/index102.js +14 -6
- package/dist/index103.cjs +1 -1
- package/dist/index103.js +3 -20
- package/dist/index104.cjs +1 -1
- package/dist/index104.js +27 -5
- package/dist/index105.cjs +1 -0
- package/dist/index105.js +7 -0
- package/dist/index106.cjs +1 -0
- package/dist/index106.js +9 -0
- package/dist/index107.cjs +1 -0
- package/dist/index107.js +62 -0
- package/dist/index108.cjs +1 -0
- package/dist/index108.js +128 -0
- package/dist/index109.cjs +1 -0
- package/dist/index109.js +10 -0
- package/dist/index110.cjs +1 -0
- package/dist/index110.js +24 -0
- package/dist/index111.cjs +1 -0
- package/dist/index111.js +20 -0
- package/dist/index112.cjs +1 -0
- package/dist/index112.js +43 -0
- package/dist/index113.cjs +1 -0
- package/dist/index113.js +24 -0
- package/dist/index114.cjs +1 -0
- package/dist/index114.js +14 -0
- package/dist/index115.cjs +1 -0
- package/dist/index115.js +9 -0
- package/dist/index116.cjs +1 -0
- package/dist/index116.js +109 -0
- package/dist/index117.cjs +1 -0
- package/dist/index117.js +5 -0
- package/dist/index118.cjs +1 -0
- package/dist/index118.js +6 -0
- package/dist/index119.cjs +1 -0
- package/dist/index119.js +11 -0
- package/dist/index120.cjs +1 -0
- package/dist/index120.js +4 -0
- package/dist/index121.cjs +2 -0
- package/dist/index121.js +5 -0
- package/dist/index122.cjs +20 -0
- package/dist/index122.js +329 -0
- package/dist/index123.cjs +1 -0
- package/dist/index123.js +16 -0
- package/dist/index124.cjs +1 -0
- package/dist/index124.js +7 -0
- package/dist/index125.cjs +1 -0
- package/dist/index125.js +4 -0
- package/dist/index126.cjs +1 -0
- package/dist/index126.js +10 -0
- package/dist/index127.cjs +3 -0
- package/dist/index127.js +218 -0
- package/dist/index128.cjs +1 -0
- package/dist/index128.js +34 -0
- package/dist/index129.cjs +1 -0
- package/dist/index129.js +24 -0
- package/dist/index130.cjs +1 -0
- package/dist/index130.js +8 -0
- package/dist/index131.cjs +1 -0
- package/dist/index131.js +76 -0
- package/dist/index132.cjs +1 -0
- package/dist/index132.js +8 -0
- package/dist/index133.cjs +1 -0
- package/dist/index133.js +8 -0
- package/dist/index134.cjs +9 -0
- package/dist/index134.js +38 -0
- package/dist/index135.cjs +3 -0
- package/dist/index135.js +113 -0
- package/dist/index136.cjs +1 -0
- package/dist/index136.js +5 -0
- package/dist/index137.cjs +1 -0
- package/dist/index137.js +26 -0
- package/dist/index138.cjs +3 -0
- package/dist/index138.js +454 -0
- package/dist/index139.cjs +2 -0
- package/dist/index139.js +57 -0
- package/dist/index140.cjs +1 -0
- package/dist/index140.js +29 -0
- package/dist/index141.cjs +1 -0
- package/dist/index141.js +36 -0
- package/dist/index142.cjs +1 -0
- package/dist/index142.js +38 -0
- package/dist/index143.cjs +4 -0
- package/dist/index143.js +197 -0
- package/dist/index144.cjs +1 -0
- package/dist/index144.js +11 -0
- package/dist/index145.cjs +1 -0
- package/dist/index145.js +15 -0
- package/dist/index146.cjs +1 -0
- package/dist/index146.js +21 -0
- package/dist/index147.cjs +1 -0
- package/dist/index147.js +30 -0
- package/dist/index148.cjs +1 -0
- package/dist/index148.js +11 -0
- package/dist/index149.cjs +1 -0
- package/dist/index149.js +58 -0
- package/dist/index15.cjs +1 -1
- package/dist/index15.js +19 -18
- package/dist/index150.cjs +1 -0
- package/dist/index150.js +48 -0
- package/dist/index151.cjs +1 -0
- package/dist/index151.js +11 -0
- package/dist/index152.cjs +1 -0
- package/dist/index152.js +10 -0
- package/dist/index153.cjs +1 -0
- package/dist/index153.js +19 -0
- package/dist/index154.cjs +1 -0
- package/dist/index154.js +21 -0
- package/dist/index155.cjs +1 -0
- package/dist/index155.js +24 -0
- package/dist/index156.cjs +1 -0
- package/dist/index156.js +54 -0
- package/dist/index157.cjs +1 -0
- package/dist/index157.js +14 -0
- package/dist/index158.cjs +1 -0
- package/dist/index158.js +164 -0
- package/dist/index159.cjs +1 -0
- package/dist/index159.js +24 -0
- package/dist/index160.cjs +1 -0
- package/dist/index160.js +130 -0
- package/dist/index161.cjs +1 -0
- package/dist/index161.js +41 -0
- package/dist/index162.cjs +1 -0
- package/dist/index162.js +9 -0
- package/dist/index163.cjs +1 -0
- package/dist/index163.js +30 -0
- package/dist/index164.cjs +1 -0
- package/dist/index164.js +194 -0
- package/dist/index165.cjs +1 -0
- package/dist/index165.js +6 -0
- package/dist/index166.cjs +1 -0
- package/dist/index166.js +65 -0
- package/dist/index167.cjs +1 -0
- package/dist/index167.js +5 -0
- package/dist/index168.cjs +1 -0
- package/dist/index168.js +23 -0
- package/dist/index169.cjs +1 -0
- package/dist/index169.js +19 -0
- package/dist/index170.cjs +1 -0
- package/dist/index170.js +26 -0
- package/dist/index171.cjs +1 -0
- package/dist/index171.js +14 -0
- package/dist/index172.cjs +1 -0
- package/dist/index172.js +37 -0
- package/dist/index173.cjs +1 -0
- package/dist/index173.js +5 -0
- package/dist/index174.cjs +1 -0
- package/dist/index174.js +21 -0
- package/dist/index175.cjs +1 -0
- package/dist/index175.js +30 -0
- package/dist/index176.cjs +1 -0
- package/dist/index176.js +39 -0
- package/dist/index177.cjs +1 -0
- package/dist/index177.js +13 -0
- package/dist/index178.cjs +1 -0
- package/dist/index178.js +28 -0
- package/dist/index179.cjs +1 -0
- package/dist/index179.js +31 -0
- package/dist/index18.cjs +1 -1
- package/dist/index18.js +120 -12
- package/dist/index180.cjs +1 -0
- package/dist/index180.js +68 -0
- package/dist/index181.cjs +1 -0
- package/dist/index181.js +12 -0
- package/dist/index182.cjs +1 -0
- package/dist/index182.js +36 -0
- package/dist/index183.cjs +1 -0
- package/dist/index183.js +27 -0
- package/dist/index184.cjs +1 -0
- package/dist/index184.js +27 -0
- package/dist/index185.cjs +1 -0
- package/dist/index185.js +6 -0
- package/dist/index186.cjs +1 -0
- package/dist/index186.js +17 -0
- package/dist/index187.cjs +1 -0
- package/dist/index187.js +106 -0
- package/dist/index188.cjs +1 -0
- package/dist/index188.js +83 -0
- package/dist/index189.cjs +1 -0
- package/dist/index189.js +8 -0
- package/dist/index19.cjs +1 -1
- package/dist/index19.js +2 -36
- package/dist/index190.cjs +1 -0
- package/dist/index190.js +9 -0
- package/dist/index191.cjs +1 -0
- package/dist/index191.js +30 -0
- package/dist/index192.cjs +1 -0
- package/dist/index192.js +40 -0
- package/dist/index193.cjs +1 -0
- package/dist/index193.js +16 -0
- package/dist/index194.cjs +1 -0
- package/dist/index194.js +45 -0
- package/dist/index195.cjs +1 -0
- package/dist/index195.js +8 -0
- package/dist/index196.cjs +1 -0
- package/dist/index196.js +14 -0
- package/dist/index197.cjs +1 -0
- package/dist/index197.js +22 -0
- package/dist/index198.cjs +1 -0
- package/dist/index198.js +81 -0
- package/dist/index199.cjs +1 -0
- package/dist/index199.js +4 -0
- package/dist/index20.cjs +1 -1
- package/dist/index20.js +13 -31
- package/dist/index200.cjs +1 -0
- package/dist/index200.js +40 -0
- package/dist/index201.cjs +1 -0
- package/dist/index201.js +114 -0
- package/dist/index202.cjs +1 -0
- package/dist/index202.js +52 -0
- package/dist/index203.cjs +1 -0
- package/dist/index203.js +35 -0
- package/dist/index204.cjs +1 -0
- package/dist/index204.js +11 -0
- package/dist/index205.cjs +1 -0
- package/dist/index205.js +9 -0
- package/dist/index206.cjs +1 -0
- package/dist/index206.js +9 -0
- package/dist/index207.cjs +1 -0
- package/dist/index207.js +14 -0
- package/dist/index208.cjs +1 -0
- package/dist/index208.js +13 -0
- package/dist/index209.cjs +1 -0
- package/dist/index209.js +16 -0
- package/dist/index21.cjs +1 -1
- package/dist/index21.js +464 -32
- package/dist/index210.cjs +1 -0
- package/dist/index210.js +35 -0
- package/dist/index211.cjs +1 -0
- package/dist/index211.js +7 -0
- package/dist/index212.cjs +1 -0
- package/dist/index212.js +10 -0
- package/dist/index213.cjs +1 -0
- package/dist/index213.js +11 -0
- package/dist/index214.cjs +1 -0
- package/dist/index214.js +23 -0
- package/dist/index215.cjs +1 -0
- package/dist/index215.js +34 -0
- package/dist/index216.cjs +1 -0
- package/dist/index216.js +23 -0
- package/dist/index217.cjs +1 -0
- package/dist/index217.js +6 -0
- package/dist/index218.cjs +1 -0
- package/dist/index218.js +20 -0
- package/dist/index219.cjs +1 -0
- package/dist/index219.js +13 -0
- package/dist/index22.cjs +1 -16
- package/dist/index22.js +35 -113
- package/dist/index220.cjs +1 -0
- package/dist/index220.js +24 -0
- package/dist/index221.cjs +1 -0
- package/dist/index221.js +25 -0
- package/dist/index222.cjs +1 -0
- package/dist/index222.js +8 -0
- package/dist/index223.cjs +1 -0
- package/dist/index223.js +8 -0
- package/dist/index224.cjs +1 -0
- package/dist/index224.js +11 -0
- package/dist/index225.cjs +1 -0
- package/dist/index225.js +107 -0
- package/dist/index226.cjs +1 -0
- package/dist/index226.js +115 -0
- package/dist/index227.cjs +1 -0
- package/dist/index227.js +21 -0
- package/dist/index228.cjs +1 -0
- package/dist/index228.js +174 -0
- package/dist/index229.cjs +1 -0
- package/dist/index229.js +20 -0
- package/dist/index23.cjs +1 -1
- package/dist/index23.js +30 -41
- package/dist/index230.cjs +1 -0
- package/dist/index230.js +13 -0
- package/dist/index231.cjs +1 -0
- package/dist/index231.js +19 -0
- package/dist/index232.cjs +1 -0
- package/dist/index232.js +25 -0
- package/dist/index233.cjs +1 -0
- package/dist/index233.js +33 -0
- package/dist/index234.cjs +1 -0
- package/dist/index234.js +4 -0
- package/dist/index235.cjs +1 -0
- package/dist/index235.js +16 -0
- package/dist/index236.cjs +1 -0
- package/dist/index236.js +15 -0
- package/dist/index237.cjs +1 -0
- package/dist/index237.js +50 -0
- package/dist/index238.cjs +1 -0
- package/dist/index238.js +14 -0
- package/dist/index239.cjs +1 -0
- package/dist/index239.js +10 -0
- package/dist/index24.cjs +1 -1
- package/dist/index24.js +31 -45
- package/dist/index240.cjs +1 -0
- package/dist/index240.js +12 -0
- package/dist/index241.cjs +1 -0
- package/dist/index241.js +16 -0
- package/dist/index242.cjs +1 -0
- package/dist/index242.js +17 -0
- package/dist/index243.cjs +1 -0
- package/dist/index243.js +12 -0
- package/dist/index244.cjs +1 -0
- package/dist/index244.js +27 -0
- package/dist/index245.cjs +1 -0
- package/dist/index245.js +15 -0
- package/dist/index246.cjs +1 -0
- package/dist/index246.js +27 -0
- package/dist/index247.cjs +2 -0
- package/dist/index247.js +27 -0
- package/dist/index248.cjs +1 -0
- package/dist/index248.js +16 -0
- package/dist/index249.cjs +1 -0
- package/dist/index249.js +18 -0
- package/dist/index25.cjs +1 -1
- package/dist/index25.js +11 -25
- package/dist/index250.cjs +1 -0
- package/dist/index250.js +55 -0
- package/dist/index251.cjs +1 -0
- package/dist/index251.js +28 -0
- package/dist/index252.cjs +1 -0
- package/dist/index252.js +16 -0
- package/dist/index253.cjs +1 -0
- package/dist/index253.js +18 -0
- package/dist/index254.cjs +1 -0
- package/dist/index254.js +8 -0
- package/dist/index255.cjs +1 -0
- package/dist/index255.js +16 -0
- package/dist/index256.cjs +1 -0
- package/dist/index256.js +13 -0
- package/dist/index257.cjs +1 -0
- package/dist/index257.js +19 -0
- package/dist/index258.cjs +2 -0
- package/dist/index258.js +44 -0
- package/dist/index259.cjs +1 -0
- package/dist/index259.js +4 -0
- package/dist/index26.cjs +1 -1
- package/dist/index26.js +57 -6
- package/dist/index260.cjs +1 -0
- package/dist/index260.js +8 -0
- package/dist/index261.cjs +1 -0
- package/dist/index261.js +13 -0
- package/dist/index262.cjs +1 -0
- package/dist/index262.js +22 -0
- package/dist/index263.cjs +1 -0
- package/dist/index263.js +11 -0
- package/dist/index264.cjs +1 -0
- package/dist/index264.js +69 -0
- package/dist/index265.cjs +1 -0
- package/dist/index265.js +68 -0
- package/dist/index266.cjs +1 -0
- package/dist/index266.js +189 -0
- package/dist/index267.cjs +1 -0
- package/dist/index267.js +25 -0
- package/dist/index268.cjs +1 -0
- package/dist/index268.js +45 -0
- package/dist/index269.cjs +1 -0
- package/dist/index269.js +79 -0
- package/dist/index27.cjs +1 -1
- package/dist/index27.js +12 -13
- package/dist/index270.cjs +1 -0
- package/dist/index270.js +43 -0
- package/dist/index271.cjs +1 -0
- package/dist/index271.js +19 -0
- package/dist/index272.cjs +1 -0
- package/dist/index272.js +16 -0
- package/dist/index273.cjs +1 -0
- package/dist/index273.js +15 -0
- package/dist/index274.cjs +2 -0
- package/dist/index274.js +21 -0
- package/dist/index275.cjs +1 -0
- package/dist/index275.js +17 -0
- package/dist/index276.cjs +1 -0
- package/dist/index276.js +14 -0
- package/dist/index277.cjs +1 -0
- package/dist/index277.js +19 -0
- package/dist/index278.cjs +1 -0
- package/dist/index278.js +226 -0
- package/dist/index279.cjs +1 -0
- package/dist/index279.js +9 -0
- package/dist/index28.cjs +16 -1
- package/dist/index28.js +113 -15
- package/dist/index280.cjs +1 -0
- package/dist/index280.js +9 -0
- package/dist/index281.cjs +1 -0
- package/dist/index281.js +29 -0
- package/dist/index282.cjs +1 -0
- package/dist/index282.js +37 -0
- package/dist/index283.cjs +1 -0
- package/dist/index283.js +21 -0
- package/dist/index284.cjs +1 -0
- package/dist/index284.js +73 -0
- package/dist/index285.cjs +1 -0
- package/dist/index285.js +70 -0
- package/dist/index286.cjs +1 -0
- package/dist/index286.js +6 -0
- package/dist/index287.cjs +1 -0
- package/dist/index287.js +143 -0
- package/dist/index288.cjs +1 -0
- package/dist/index288.js +158 -0
- package/dist/index289.cjs +1 -0
- package/dist/index289.js +12 -0
- package/dist/index29.cjs +1 -1
- package/dist/index29.js +7 -5
- package/dist/index290.cjs +1 -0
- package/dist/index290.js +116 -0
- package/dist/index291.cjs +2 -0
- package/dist/index291.js +137 -0
- package/dist/index292.cjs +1 -0
- package/dist/index292.js +43 -0
- package/dist/index293.cjs +1 -0
- package/dist/index293.js +4 -0
- package/dist/index294.cjs +1 -0
- package/dist/index294.js +209 -0
- package/dist/index295.cjs +1 -0
- package/dist/index295.js +71 -0
- package/dist/index296.cjs +1 -0
- package/dist/index296.js +14 -0
- package/dist/index297.cjs +1 -0
- package/dist/index297.js +22 -0
- package/dist/index298.cjs +1 -0
- package/dist/index298.js +645 -0
- package/dist/index299.cjs +1 -0
- package/dist/index299.js +175 -0
- package/dist/index3.cjs +1 -1
- package/dist/index3.js +1 -1
- package/dist/index30.cjs +1 -1
- package/dist/index30.js +30 -12
- package/dist/index300.cjs +2 -0
- package/dist/index300.js +69 -0
- package/dist/index301.cjs +1 -0
- package/dist/index301.js +7 -0
- package/dist/index302.cjs +1 -0
- package/dist/index302.js +43 -0
- package/dist/index303.cjs +1 -0
- package/dist/index303.js +10 -0
- package/dist/index304.cjs +1 -0
- package/dist/index304.js +65 -0
- package/dist/index305.cjs +1 -0
- package/dist/index305.js +80 -0
- package/dist/index306.cjs +1 -0
- package/dist/index306.js +6 -0
- package/dist/index307.cjs +1 -0
- package/dist/index307.js +197 -0
- package/dist/index308.cjs +1 -0
- package/dist/index308.js +66 -0
- package/dist/index309.cjs +1 -0
- package/dist/index309.js +47 -0
- package/dist/index31.cjs +1 -1
- package/dist/index31.js +28 -9
- package/dist/index310.cjs +1 -0
- package/dist/index310.js +7 -0
- package/dist/index311.cjs +1 -0
- package/dist/index311.js +107 -0
- package/dist/index312.cjs +1 -0
- package/dist/index312.js +7 -0
- package/dist/index313.cjs +1 -0
- package/dist/index313.js +4 -0
- package/dist/index314.cjs +1 -0
- package/dist/index314.js +22 -0
- package/dist/index315.cjs +1 -0
- package/dist/index315.js +74 -0
- package/dist/index316.cjs +1 -0
- package/dist/index316.js +24 -0
- package/dist/index32.cjs +1 -1
- package/dist/index32.js +16 -12
- package/dist/index33.cjs +1 -1
- package/dist/index33.js +33 -11
- package/dist/index34.cjs +1 -1
- package/dist/index34.js +44 -13
- package/dist/index35.cjs +1 -1
- package/dist/index35.js +150 -22
- package/dist/index36.cjs +1 -1
- package/dist/index36.js +34 -54
- package/dist/index37.cjs +1 -1
- package/dist/index37.js +38 -16
- package/dist/index38.cjs +2 -1
- package/dist/index38.js +59 -5
- package/dist/index39.cjs +1 -1
- package/dist/index39.js +32 -8
- package/dist/index4.cjs +1 -1
- package/dist/index4.js +27 -25
- package/dist/index40.cjs +1 -1
- package/dist/index40.js +15 -171
- package/dist/index41.cjs +1 -1
- package/dist/index41.js +7 -102
- package/dist/index42.cjs +1 -1
- package/dist/index42.js +2 -22
- package/dist/index43.cjs +1 -2
- package/dist/index43.js +26 -50
- package/dist/index44.cjs +1 -1
- package/dist/index44.js +30 -23
- package/dist/index45.cjs +1 -1
- package/dist/index45.js +3 -12
- package/dist/index46.cjs +1 -1
- package/dist/index46.js +8 -33
- package/dist/index47.cjs +1 -1
- package/dist/index47.js +65 -109
- package/dist/index48.cjs +1 -1
- package/dist/index48.js +9 -16
- package/dist/index49.cjs +1 -1
- package/dist/index49.js +26 -221
- package/dist/index5.cjs +1 -1
- package/dist/index5.js +19 -47
- package/dist/index50.cjs +1 -2
- package/dist/index50.js +71 -59
- package/dist/index51.cjs +1 -1
- package/dist/index51.js +19 -21
- package/dist/index52.cjs +1 -1
- package/dist/index52.js +110 -104
- package/dist/index53.cjs +1 -1
- package/dist/index53.js +60 -3
- package/dist/index54.cjs +1 -1
- package/dist/index54.js +23 -16
- package/dist/index55.cjs +1 -1
- package/dist/index55.js +40 -8
- package/dist/index56.cjs +1 -1
- package/dist/index56.js +37 -10
- package/dist/index57.cjs +1 -1
- package/dist/index57.js +58 -11
- package/dist/index58.cjs +1 -1
- package/dist/index58.js +164 -12
- package/dist/index59.cjs +1 -1
- package/dist/index59.js +40 -18
- package/dist/index6.cjs +1 -1
- package/dist/index6.js +1 -1
- package/dist/index60.cjs +1 -1
- package/dist/index60.js +9 -6
- package/dist/index61.cjs +1 -1
- package/dist/index61.js +34 -40
- package/dist/index62.cjs +1 -1
- package/dist/index62.js +9 -78
- package/dist/index63.cjs +1 -1
- package/dist/index63.js +50 -14
- package/dist/index64.cjs +1 -1
- package/dist/index64.js +84 -17
- package/dist/index65.cjs +1 -1
- package/dist/index65.js +41 -8
- package/dist/index66.cjs +1 -1
- package/dist/index66.js +7 -190
- package/dist/index67.cjs +1 -1
- package/dist/index67.js +6 -64
- package/dist/index68.cjs +1 -1
- package/dist/index68.js +17 -4
- package/dist/index69.cjs +1 -1
- package/dist/index69.js +8 -40
- package/dist/index70.cjs +1 -1
- package/dist/index70.js +13 -34
- package/dist/index71.cjs +1 -1
- package/dist/index71.js +7 -69
- package/dist/index72.cjs +1 -1
- package/dist/index72.js +9 -67
- package/dist/index73.cjs +1 -1
- package/dist/index73.js +47 -2
- package/dist/index74.cjs +1 -1
- package/dist/index74.js +13 -231
- package/dist/index75.cjs +1 -1
- package/dist/index75.js +17 -2
- package/dist/index76.cjs +1 -1
- package/dist/index76.js +13 -6
- package/dist/index77.cjs +1 -1
- package/dist/index77.js +6 -11
- package/dist/index78.cjs +1 -1
- package/dist/index78.js +36 -8
- package/dist/index79.cjs +1 -5
- package/dist/index79.js +9 -56
- package/dist/index80.cjs +1 -2
- package/dist/index80.js +8 -34
- package/dist/index81.cjs +1 -1
- package/dist/index81.js +26 -5
- package/dist/index82.cjs +1 -1
- package/dist/index82.js +11 -2
- package/dist/index83.cjs +1 -1
- package/dist/index83.js +14 -6
- package/dist/index84.cjs +1 -1
- package/dist/index84.js +111 -28
- package/dist/index85.cjs +1 -1
- package/dist/index85.js +79 -26
- package/dist/index86.cjs +1 -1
- package/dist/index86.js +182 -3
- package/dist/index87.cjs +1 -1
- package/dist/index87.js +6 -11
- package/dist/index88.cjs +1 -1
- package/dist/index88.js +13 -19
- package/dist/index89.cjs +1 -1
- package/dist/index89.js +13 -12
- package/dist/index9.cjs +1 -1
- package/dist/index9.js +17 -16
- package/dist/index90.cjs +1 -1
- package/dist/index90.js +93 -8
- package/dist/index91.cjs +1 -1
- package/dist/index91.js +71 -639
- package/dist/index92.cjs +1 -1
- package/dist/index92.js +86 -170
- package/dist/index93.cjs +1 -1
- package/dist/index93.js +138 -18
- package/dist/index94.cjs +1 -1
- package/dist/index94.js +68 -126
- package/dist/index95.cjs +1 -1
- package/dist/index95.js +24 -2
- package/dist/index96.cjs +1 -1
- package/dist/index96.js +110 -2
- package/dist/index97.cjs +1 -1
- package/dist/index97.js +6 -37
- package/dist/index98.cjs +1 -1
- package/dist/index98.js +50 -38
- package/dist/index99.cjs +1 -2
- package/dist/index99.js +17 -3
- package/dist/src/lib/digestKey/digestKey.d.ts +4 -2
- package/dist/src/lib/result.d.ts +13 -9
- package/dist/src/lib/utils.d.ts +2 -1
- package/package.json +2 -3
package/dist/index91.js
CHANGED
|
@@ -1,646 +1,78 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
fromBytes: "function",
|
|
21
|
-
toBytes: "function"
|
|
22
|
-
});
|
|
23
|
-
const { endo: t, Fp: E, a: R } = n;
|
|
24
|
-
if (t) {
|
|
25
|
-
if (!E.eql(R, E.ZERO))
|
|
26
|
-
throw new Error("invalid endomorphism, can only be defined for Koblitz curves that have a=0");
|
|
27
|
-
if (typeof t != "object" || typeof t.beta != "bigint" || typeof t.splitScalar != "function")
|
|
28
|
-
throw new Error("invalid endomorphism, expected beta: bigint and splitScalar: function");
|
|
29
|
-
}
|
|
30
|
-
return Object.freeze({ ...n });
|
|
31
|
-
}
|
|
32
|
-
const { bytesToNumberBE: Tt, hexToBytes: Zt } = St;
|
|
33
|
-
class qt extends Error {
|
|
34
|
-
constructor(n = "") {
|
|
35
|
-
super(n);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
const U = {
|
|
39
|
-
// asn.1 DER encoding utils
|
|
40
|
-
Err: qt,
|
|
41
|
-
// Basic building block is TLV (Tag-Length-Value)
|
|
42
|
-
_tlv: {
|
|
43
|
-
encode: (f, n) => {
|
|
44
|
-
const { Err: t } = U;
|
|
45
|
-
if (f < 0 || f > 256)
|
|
46
|
-
throw new t("tlv.encode: wrong tag");
|
|
47
|
-
if (n.length & 1)
|
|
48
|
-
throw new t("tlv.encode: unpadded data");
|
|
49
|
-
const E = n.length / 2, R = et(E);
|
|
50
|
-
if (R.length / 2 & 128)
|
|
51
|
-
throw new t("tlv.encode: long form length too big");
|
|
52
|
-
const Z = E > 127 ? et(R.length / 2 | 128) : "";
|
|
53
|
-
return et(f) + Z + R + n;
|
|
54
|
-
},
|
|
55
|
-
// v - value, l - left bytes (unparsed)
|
|
56
|
-
decode(f, n) {
|
|
57
|
-
const { Err: t } = U;
|
|
58
|
-
let E = 0;
|
|
59
|
-
if (f < 0 || f > 256)
|
|
60
|
-
throw new t("tlv.encode: wrong tag");
|
|
61
|
-
if (n.length < 2 || n[E++] !== f)
|
|
62
|
-
throw new t("tlv.decode: wrong tlv");
|
|
63
|
-
const R = n[E++], Z = !!(R & 128);
|
|
64
|
-
let B = 0;
|
|
65
|
-
if (!Z)
|
|
66
|
-
B = R;
|
|
67
|
-
else {
|
|
68
|
-
const S = R & 127;
|
|
69
|
-
if (!S)
|
|
70
|
-
throw new t("tlv.decode(long): indefinite length not supported");
|
|
71
|
-
if (S > 4)
|
|
72
|
-
throw new t("tlv.decode(long): byte length is too big");
|
|
73
|
-
const L = n.subarray(E, E + S);
|
|
74
|
-
if (L.length !== S)
|
|
75
|
-
throw new t("tlv.decode: length bytes not complete");
|
|
76
|
-
if (L[0] === 0)
|
|
77
|
-
throw new t("tlv.decode(long): zero leftmost byte");
|
|
78
|
-
for (const P of L)
|
|
79
|
-
B = B << 8 | P;
|
|
80
|
-
if (E += S, B < 128)
|
|
81
|
-
throw new t("tlv.decode(long): not minimal encoding");
|
|
82
|
-
}
|
|
83
|
-
const H = n.subarray(E, E + B);
|
|
84
|
-
if (H.length !== B)
|
|
85
|
-
throw new t("tlv.decode: wrong value length");
|
|
86
|
-
return { v: H, l: n.subarray(E + B) };
|
|
87
|
-
}
|
|
88
|
-
},
|
|
89
|
-
// https://crypto.stackexchange.com/a/57734 Leftmost bit of first byte is 'negative' flag,
|
|
90
|
-
// since we always use positive integers here. It must always be empty:
|
|
91
|
-
// - add zero byte if exists
|
|
92
|
-
// - if next byte doesn't have a flag, leading zero is not allowed (minimal encoding)
|
|
93
|
-
_int: {
|
|
94
|
-
encode(f) {
|
|
95
|
-
const { Err: n } = U;
|
|
96
|
-
if (f < j)
|
|
97
|
-
throw new n("integer: negative integers are not allowed");
|
|
98
|
-
let t = et(f);
|
|
99
|
-
if (Number.parseInt(t[0], 16) & 8 && (t = "00" + t), t.length & 1)
|
|
100
|
-
throw new n("unexpected DER parsing assertion: unpadded hex");
|
|
101
|
-
return t;
|
|
102
|
-
},
|
|
103
|
-
decode(f) {
|
|
104
|
-
const { Err: n } = U;
|
|
105
|
-
if (f[0] & 128)
|
|
106
|
-
throw new n("invalid signature integer: negative");
|
|
107
|
-
if (f[0] === 0 && !(f[1] & 128))
|
|
108
|
-
throw new n("invalid signature integer: unnecessary leading zero");
|
|
109
|
-
return Tt(f);
|
|
110
|
-
}
|
|
111
|
-
},
|
|
112
|
-
toSig(f) {
|
|
113
|
-
const { Err: n, _int: t, _tlv: E } = U, R = typeof f == "string" ? Zt(f) : f;
|
|
114
|
-
At(R);
|
|
115
|
-
const { v: Z, l: B } = E.decode(48, R);
|
|
116
|
-
if (B.length)
|
|
117
|
-
throw new n("invalid signature: left bytes after parsing");
|
|
118
|
-
const { v: H, l: S } = E.decode(2, Z), { v: L, l: P } = E.decode(2, S);
|
|
119
|
-
if (P.length)
|
|
120
|
-
throw new n("invalid signature: left bytes after parsing");
|
|
121
|
-
return { r: t.decode(H), s: t.decode(L) };
|
|
122
|
-
},
|
|
123
|
-
hexFromSig(f) {
|
|
124
|
-
const { _tlv: n, _int: t } = U, E = n.encode(2, t.encode(f.r)), R = n.encode(2, t.encode(f.s)), Z = E + R;
|
|
125
|
-
return n.encode(48, Z);
|
|
126
|
-
}
|
|
127
|
-
}, j = BigInt(0), A = BigInt(1);
|
|
128
|
-
BigInt(2);
|
|
129
|
-
const ht = BigInt(3);
|
|
130
|
-
BigInt(4);
|
|
131
|
-
function zt(f) {
|
|
132
|
-
const n = Nt(f), { Fp: t } = n, E = bt(n.n, n.nBitLength), R = n.toBytes || ((m, e, i) => {
|
|
133
|
-
const c = e.toAffine();
|
|
134
|
-
return st(Uint8Array.from([4]), t.toBytes(c.x), t.toBytes(c.y));
|
|
135
|
-
}), Z = n.fromBytes || ((m) => {
|
|
136
|
-
const e = m.subarray(1), i = t.fromBytes(e.subarray(0, t.BYTES)), c = t.fromBytes(e.subarray(t.BYTES, 2 * t.BYTES));
|
|
137
|
-
return { x: i, y: c };
|
|
138
|
-
});
|
|
139
|
-
function B(m) {
|
|
140
|
-
const { a: e, b: i } = n, c = t.sqr(m), u = t.mul(c, m);
|
|
141
|
-
return t.add(t.add(u, t.mul(m, e)), i);
|
|
142
|
-
}
|
|
143
|
-
if (!t.eql(t.sqr(n.Gy), B(n.Gx)))
|
|
144
|
-
throw new Error("bad generator point: equation left != right");
|
|
145
|
-
function H(m) {
|
|
146
|
-
return pt(m, A, n.n);
|
|
147
|
-
}
|
|
148
|
-
function S(m) {
|
|
149
|
-
const { allowedPrivateKeyLengths: e, nByteLength: i, wrapPrivateKey: c, n: u } = n;
|
|
150
|
-
if (e && typeof m != "bigint") {
|
|
151
|
-
if (at(m) && (m = ct(m)), typeof m != "string" || !e.includes(m.length))
|
|
152
|
-
throw new Error("invalid private key");
|
|
153
|
-
m = m.padStart(i * 2, "0");
|
|
154
|
-
}
|
|
155
|
-
let y;
|
|
156
|
-
try {
|
|
157
|
-
y = typeof m == "bigint" ? m : nt(Y("private key", m, i));
|
|
158
|
-
} catch {
|
|
159
|
-
throw new Error("invalid private key, expected hex or " + i + " bytes, got " + typeof m);
|
|
160
|
-
}
|
|
161
|
-
return c && (y = wt(y, u)), Q("private key", y, A, u), y;
|
|
162
|
-
}
|
|
163
|
-
function L(m) {
|
|
164
|
-
if (!(m instanceof w))
|
|
165
|
-
throw new Error("ProjectivePoint expected");
|
|
166
|
-
}
|
|
167
|
-
const P = ut((m, e) => {
|
|
168
|
-
const { px: i, py: c, pz: u } = m;
|
|
169
|
-
if (t.eql(u, t.ONE))
|
|
170
|
-
return { x: i, y: c };
|
|
171
|
-
const y = m.is0();
|
|
172
|
-
e == null && (e = y ? t.ONE : t.inv(u));
|
|
173
|
-
const v = t.mul(i, e), p = t.mul(c, e), a = t.mul(u, e);
|
|
174
|
-
if (y)
|
|
175
|
-
return { x: t.ZERO, y: t.ZERO };
|
|
176
|
-
if (!t.eql(a, t.ONE))
|
|
177
|
-
throw new Error("invZ was invalid");
|
|
178
|
-
return { x: v, y: p };
|
|
179
|
-
}), rt = ut((m) => {
|
|
180
|
-
if (m.is0()) {
|
|
181
|
-
if (n.allowInfinityPoint && !t.is0(m.py))
|
|
182
|
-
return;
|
|
183
|
-
throw new Error("bad point: ZERO");
|
|
184
|
-
}
|
|
185
|
-
const { x: e, y: i } = m.toAffine();
|
|
186
|
-
if (!t.isValid(e) || !t.isValid(i))
|
|
187
|
-
throw new Error("bad point: x or y not FE");
|
|
188
|
-
const c = t.sqr(i), u = B(e);
|
|
189
|
-
if (!t.eql(c, u))
|
|
190
|
-
throw new Error("bad point: equation left != right");
|
|
191
|
-
if (!m.isTorsionFree())
|
|
192
|
-
throw new Error("bad point: not in prime-order subgroup");
|
|
193
|
-
return !0;
|
|
194
|
-
});
|
|
195
|
-
class w {
|
|
196
|
-
constructor(e, i, c) {
|
|
197
|
-
if (this.px = e, this.py = i, this.pz = c, e == null || !t.isValid(e))
|
|
198
|
-
throw new Error("x required");
|
|
199
|
-
if (i == null || !t.isValid(i))
|
|
200
|
-
throw new Error("y required");
|
|
201
|
-
if (c == null || !t.isValid(c))
|
|
202
|
-
throw new Error("z required");
|
|
203
|
-
Object.freeze(this);
|
|
204
|
-
}
|
|
205
|
-
// Does not validate if the point is on-curve.
|
|
206
|
-
// Use fromHex instead, or call assertValidity() later.
|
|
207
|
-
static fromAffine(e) {
|
|
208
|
-
const { x: i, y: c } = e || {};
|
|
209
|
-
if (!e || !t.isValid(i) || !t.isValid(c))
|
|
210
|
-
throw new Error("invalid affine point");
|
|
211
|
-
if (e instanceof w)
|
|
212
|
-
throw new Error("projective point not allowed");
|
|
213
|
-
const u = (y) => t.eql(y, t.ZERO);
|
|
214
|
-
return u(i) && u(c) ? w.ZERO : new w(i, c, t.ONE);
|
|
215
|
-
}
|
|
216
|
-
get x() {
|
|
217
|
-
return this.toAffine().x;
|
|
218
|
-
}
|
|
219
|
-
get y() {
|
|
220
|
-
return this.toAffine().y;
|
|
221
|
-
}
|
|
222
|
-
/**
|
|
223
|
-
* Takes a bunch of Projective Points but executes only one
|
|
224
|
-
* inversion on all of them. Inversion is very slow operation,
|
|
225
|
-
* so this improves performance massively.
|
|
226
|
-
* Optimization: converts a list of projective points to a list of identical points with Z=1.
|
|
227
|
-
*/
|
|
228
|
-
static normalizeZ(e) {
|
|
229
|
-
const i = t.invertBatch(e.map((c) => c.pz));
|
|
230
|
-
return e.map((c, u) => c.toAffine(i[u])).map(w.fromAffine);
|
|
231
|
-
}
|
|
232
|
-
/**
|
|
233
|
-
* Converts hash string or Uint8Array to Point.
|
|
234
|
-
* @param hex short/long ECDSA hex
|
|
235
|
-
*/
|
|
236
|
-
static fromHex(e) {
|
|
237
|
-
const i = w.fromAffine(Z(Y("pointHex", e)));
|
|
238
|
-
return i.assertValidity(), i;
|
|
239
|
-
}
|
|
240
|
-
// Multiplies generator point by privateKey.
|
|
241
|
-
static fromPrivateKey(e) {
|
|
242
|
-
return w.BASE.multiply(S(e));
|
|
243
|
-
}
|
|
244
|
-
// Multiscalar Multiplication
|
|
245
|
-
static msm(e, i) {
|
|
246
|
-
return Et(w, E, e, i);
|
|
247
|
-
}
|
|
248
|
-
// "Private method", don't use it directly
|
|
249
|
-
_setWindowSize(e) {
|
|
250
|
-
D.setWindowSize(this, e);
|
|
251
|
-
}
|
|
252
|
-
// A point on curve is valid if it conforms to equation.
|
|
253
|
-
assertValidity() {
|
|
254
|
-
rt(this);
|
|
255
|
-
}
|
|
256
|
-
hasEvenY() {
|
|
257
|
-
const { y: e } = this.toAffine();
|
|
258
|
-
if (t.isOdd)
|
|
259
|
-
return !t.isOdd(e);
|
|
260
|
-
throw new Error("Field doesn't support isOdd");
|
|
261
|
-
}
|
|
262
|
-
/**
|
|
263
|
-
* Compare one point to another.
|
|
264
|
-
*/
|
|
265
|
-
equals(e) {
|
|
266
|
-
L(e);
|
|
267
|
-
const { px: i, py: c, pz: u } = this, { px: y, py: v, pz: p } = e, a = t.eql(t.mul(i, p), t.mul(y, u)), h = t.eql(t.mul(c, p), t.mul(v, u));
|
|
268
|
-
return a && h;
|
|
269
|
-
}
|
|
270
|
-
/**
|
|
271
|
-
* Flips point to one corresponding to (x, -y) in Affine coordinates.
|
|
272
|
-
*/
|
|
273
|
-
negate() {
|
|
274
|
-
return new w(this.px, t.neg(this.py), this.pz);
|
|
275
|
-
}
|
|
276
|
-
// Renes-Costello-Batina exception-free doubling formula.
|
|
277
|
-
// There is 30% faster Jacobian formula, but it is not complete.
|
|
278
|
-
// https://eprint.iacr.org/2015/1060, algorithm 3
|
|
279
|
-
// Cost: 8M + 3S + 3*a + 2*b3 + 15add.
|
|
280
|
-
double() {
|
|
281
|
-
const { a: e, b: i } = n, c = t.mul(i, ht), { px: u, py: y, pz: v } = this;
|
|
282
|
-
let p = t.ZERO, a = t.ZERO, h = t.ZERO, l = t.mul(u, u), N = t.mul(y, y), x = t.mul(v, v), b = t.mul(u, y);
|
|
283
|
-
return b = t.add(b, b), h = t.mul(u, v), h = t.add(h, h), p = t.mul(e, h), a = t.mul(c, x), a = t.add(p, a), p = t.sub(N, a), a = t.add(N, a), a = t.mul(p, a), p = t.mul(b, p), h = t.mul(c, h), x = t.mul(e, x), b = t.sub(l, x), b = t.mul(e, b), b = t.add(b, h), h = t.add(l, l), l = t.add(h, l), l = t.add(l, x), l = t.mul(l, b), a = t.add(a, l), x = t.mul(y, v), x = t.add(x, x), l = t.mul(x, b), p = t.sub(p, l), h = t.mul(x, N), h = t.add(h, h), h = t.add(h, h), new w(p, a, h);
|
|
284
|
-
}
|
|
285
|
-
// Renes-Costello-Batina exception-free addition formula.
|
|
286
|
-
// There is 30% faster Jacobian formula, but it is not complete.
|
|
287
|
-
// https://eprint.iacr.org/2015/1060, algorithm 1
|
|
288
|
-
// Cost: 12M + 0S + 3*a + 3*b3 + 23add.
|
|
289
|
-
add(e) {
|
|
290
|
-
L(e);
|
|
291
|
-
const { px: i, py: c, pz: u } = this, { px: y, py: v, pz: p } = e;
|
|
292
|
-
let a = t.ZERO, h = t.ZERO, l = t.ZERO;
|
|
293
|
-
const N = n.a, x = t.mul(n.b, ht);
|
|
294
|
-
let b = t.mul(i, y), F = t.mul(c, v), r = t.mul(u, p), o = t.add(i, c), s = t.add(y, v);
|
|
295
|
-
o = t.mul(o, s), s = t.add(b, F), o = t.sub(o, s), s = t.add(i, u);
|
|
296
|
-
let d = t.add(y, p);
|
|
297
|
-
return s = t.mul(s, d), d = t.add(b, r), s = t.sub(s, d), d = t.add(c, u), a = t.add(v, p), d = t.mul(d, a), a = t.add(F, r), d = t.sub(d, a), l = t.mul(N, s), a = t.mul(x, r), l = t.add(a, l), a = t.sub(F, l), l = t.add(F, l), h = t.mul(a, l), F = t.add(b, b), F = t.add(F, b), r = t.mul(N, r), s = t.mul(x, s), F = t.add(F, r), r = t.sub(b, r), r = t.mul(N, r), s = t.add(s, r), b = t.mul(F, s), h = t.add(h, b), b = t.mul(d, s), a = t.mul(o, a), a = t.sub(a, b), b = t.mul(o, F), l = t.mul(d, l), l = t.add(l, b), new w(a, h, l);
|
|
298
|
-
}
|
|
299
|
-
subtract(e) {
|
|
300
|
-
return this.add(e.negate());
|
|
301
|
-
}
|
|
302
|
-
is0() {
|
|
303
|
-
return this.equals(w.ZERO);
|
|
304
|
-
}
|
|
305
|
-
wNAF(e) {
|
|
306
|
-
return D.wNAFCached(this, e, w.normalizeZ);
|
|
307
|
-
}
|
|
308
|
-
/**
|
|
309
|
-
* Non-constant-time multiplication. Uses double-and-add algorithm.
|
|
310
|
-
* It's faster, but should only be used when you don't care about
|
|
311
|
-
* an exposed private key e.g. sig verification, which works over *public* keys.
|
|
312
|
-
*/
|
|
313
|
-
multiplyUnsafe(e) {
|
|
314
|
-
const { endo: i, n: c } = n;
|
|
315
|
-
Q("scalar", e, j, c);
|
|
316
|
-
const u = w.ZERO;
|
|
317
|
-
if (e === j)
|
|
318
|
-
return u;
|
|
319
|
-
if (this.is0() || e === A)
|
|
320
|
-
return this;
|
|
321
|
-
if (!i || D.hasPrecomputes(this))
|
|
322
|
-
return D.wNAFCachedUnsafe(this, e, w.normalizeZ);
|
|
323
|
-
let { k1neg: y, k1: v, k2neg: p, k2: a } = i.splitScalar(e), h = u, l = u, N = this;
|
|
324
|
-
for (; v > j || a > j; )
|
|
325
|
-
v & A && (h = h.add(N)), a & A && (l = l.add(N)), N = N.double(), v >>= A, a >>= A;
|
|
326
|
-
return y && (h = h.negate()), p && (l = l.negate()), l = new w(t.mul(l.px, i.beta), l.py, l.pz), h.add(l);
|
|
327
|
-
}
|
|
328
|
-
/**
|
|
329
|
-
* Constant time multiplication.
|
|
330
|
-
* Uses wNAF method. Windowed method may be 10% faster,
|
|
331
|
-
* but takes 2x longer to generate and consumes 2x memory.
|
|
332
|
-
* Uses precomputes when available.
|
|
333
|
-
* Uses endomorphism for Koblitz curves.
|
|
334
|
-
* @param scalar by which the point would be multiplied
|
|
335
|
-
* @returns New point
|
|
336
|
-
*/
|
|
337
|
-
multiply(e) {
|
|
338
|
-
const { endo: i, n: c } = n;
|
|
339
|
-
Q("scalar", e, A, c);
|
|
340
|
-
let u, y;
|
|
341
|
-
if (i) {
|
|
342
|
-
const { k1neg: v, k1: p, k2neg: a, k2: h } = i.splitScalar(e);
|
|
343
|
-
let { p: l, f: N } = this.wNAF(p), { p: x, f: b } = this.wNAF(h);
|
|
344
|
-
l = D.constTimeNegate(v, l), x = D.constTimeNegate(a, x), x = new w(t.mul(x.px, i.beta), x.py, x.pz), u = l.add(x), y = N.add(b);
|
|
345
|
-
} else {
|
|
346
|
-
const { p: v, f: p } = this.wNAF(e);
|
|
347
|
-
u = v, y = p;
|
|
348
|
-
}
|
|
349
|
-
return w.normalizeZ([u, y])[0];
|
|
350
|
-
}
|
|
351
|
-
/**
|
|
352
|
-
* Efficiently calculate `aP + bQ`. Unsafe, can expose private key, if used incorrectly.
|
|
353
|
-
* Not using Strauss-Shamir trick: precomputation tables are faster.
|
|
354
|
-
* The trick could be useful if both P and Q are not G (not in our case).
|
|
355
|
-
* @returns non-zero affine point
|
|
356
|
-
*/
|
|
357
|
-
multiplyAndAddUnsafe(e, i, c) {
|
|
358
|
-
const u = w.BASE, y = (p, a) => a === j || a === A || !p.equals(u) ? p.multiplyUnsafe(a) : p.multiply(a), v = y(this, i).add(y(e, c));
|
|
359
|
-
return v.is0() ? void 0 : v;
|
|
360
|
-
}
|
|
361
|
-
// Converts Projective point to affine (x, y) coordinates.
|
|
362
|
-
// Can accept precomputed Z^-1 - for example, from invertBatch.
|
|
363
|
-
// (x, y, z) ∋ (x=x/z, y=y/z)
|
|
364
|
-
toAffine(e) {
|
|
365
|
-
return P(this, e);
|
|
366
|
-
}
|
|
367
|
-
isTorsionFree() {
|
|
368
|
-
const { h: e, isTorsionFree: i } = n;
|
|
369
|
-
if (e === A)
|
|
370
|
-
return !0;
|
|
371
|
-
if (i)
|
|
372
|
-
return i(w, this);
|
|
373
|
-
throw new Error("isTorsionFree() has not been declared for the elliptic curve");
|
|
374
|
-
}
|
|
375
|
-
clearCofactor() {
|
|
376
|
-
const { h: e, clearCofactor: i } = n;
|
|
377
|
-
return e === A ? this : i ? i(w, this) : this.multiplyUnsafe(n.h);
|
|
378
|
-
}
|
|
379
|
-
toRawBytes(e = !0) {
|
|
380
|
-
return tt("isCompressed", e), this.assertValidity(), R(w, this, e);
|
|
381
|
-
}
|
|
382
|
-
toHex(e = !0) {
|
|
383
|
-
return tt("isCompressed", e), ct(this.toRawBytes(e));
|
|
384
|
-
}
|
|
385
|
-
}
|
|
386
|
-
w.BASE = new w(n.Gx, n.Gy, t.ONE), w.ZERO = new w(t.ZERO, t.ONE, t.ZERO);
|
|
387
|
-
const X = n.nBitLength, D = gt(w, n.endo ? Math.ceil(X / 2) : X);
|
|
388
|
-
return {
|
|
389
|
-
CURVE: n,
|
|
390
|
-
ProjectivePoint: w,
|
|
391
|
-
normPrivateKeyToScalar: S,
|
|
392
|
-
weierstrassEquation: B,
|
|
393
|
-
isWithinCurveOrder: H
|
|
394
|
-
};
|
|
395
|
-
}
|
|
396
|
-
function Lt(f) {
|
|
397
|
-
const n = mt(f);
|
|
398
|
-
return yt(n, {
|
|
399
|
-
hash: "hash",
|
|
400
|
-
hmac: "function",
|
|
401
|
-
randomBytes: "function"
|
|
402
|
-
}, {
|
|
403
|
-
bits2int: "function",
|
|
404
|
-
bits2int_modN: "function",
|
|
405
|
-
lowS: "boolean"
|
|
406
|
-
}), Object.freeze({ lowS: !0, ...n });
|
|
407
|
-
}
|
|
408
|
-
function Yt(f) {
|
|
409
|
-
const n = Lt(f), { Fp: t, n: E } = n, R = t.BYTES + 1, Z = 2 * t.BYTES + 1;
|
|
410
|
-
function B(r) {
|
|
411
|
-
return wt(r, E);
|
|
412
|
-
}
|
|
413
|
-
function H(r) {
|
|
414
|
-
return xt(r, E);
|
|
415
|
-
}
|
|
416
|
-
const { ProjectivePoint: S, normPrivateKeyToScalar: L, weierstrassEquation: P, isWithinCurveOrder: rt } = zt({
|
|
417
|
-
...n,
|
|
418
|
-
toBytes(r, o, s) {
|
|
419
|
-
const d = o.toAffine(), g = t.toBytes(d.x), O = st;
|
|
420
|
-
return tt("isCompressed", s), s ? O(Uint8Array.from([o.hasEvenY() ? 2 : 3]), g) : O(Uint8Array.from([4]), g, t.toBytes(d.y));
|
|
421
|
-
},
|
|
422
|
-
fromBytes(r) {
|
|
423
|
-
const o = r.length, s = r[0], d = r.subarray(1);
|
|
424
|
-
if (o === R && (s === 2 || s === 3)) {
|
|
425
|
-
const g = nt(d);
|
|
426
|
-
if (!pt(g, A, t.ORDER))
|
|
427
|
-
throw new Error("Point is not on curve");
|
|
428
|
-
const O = P(g);
|
|
429
|
-
let q;
|
|
430
|
-
try {
|
|
431
|
-
q = t.sqrt(O);
|
|
432
|
-
} catch (V) {
|
|
433
|
-
const z = V instanceof Error ? ": " + V.message : "";
|
|
434
|
-
throw new Error("Point is not on curve" + z);
|
|
435
|
-
}
|
|
436
|
-
const T = (q & A) === A;
|
|
437
|
-
return (s & 1) === 1 !== T && (q = t.neg(q)), { x: g, y: q };
|
|
438
|
-
} else if (o === Z && s === 4) {
|
|
439
|
-
const g = t.fromBytes(d.subarray(0, t.BYTES)), O = t.fromBytes(d.subarray(t.BYTES, 2 * t.BYTES));
|
|
440
|
-
return { x: g, y: O };
|
|
441
|
-
} else {
|
|
442
|
-
const g = R, O = Z;
|
|
443
|
-
throw new Error("invalid Point, expected length of " + g + ", or uncompressed " + O + ", got " + o);
|
|
444
|
-
}
|
|
445
|
-
}
|
|
446
|
-
}), w = (r) => ct(dt(r, n.nByteLength));
|
|
447
|
-
function X(r) {
|
|
448
|
-
const o = E >> A;
|
|
449
|
-
return r > o;
|
|
450
|
-
}
|
|
451
|
-
function D(r) {
|
|
452
|
-
return X(r) ? B(-r) : r;
|
|
453
|
-
}
|
|
454
|
-
const m = (r, o, s) => nt(r.slice(o, s));
|
|
455
|
-
class e {
|
|
456
|
-
constructor(o, s, d) {
|
|
457
|
-
this.r = o, this.s = s, this.recovery = d, this.assertValidity();
|
|
458
|
-
}
|
|
459
|
-
// pair (bytes of r, bytes of s)
|
|
460
|
-
static fromCompact(o) {
|
|
461
|
-
const s = n.nByteLength;
|
|
462
|
-
return o = Y("compactSignature", o, s * 2), new e(m(o, 0, s), m(o, s, 2 * s));
|
|
463
|
-
}
|
|
464
|
-
// DER encoded ECDSA signature
|
|
465
|
-
// https://bitcoin.stackexchange.com/questions/57644/what-are-the-parts-of-a-bitcoin-transaction-input-script
|
|
466
|
-
static fromDER(o) {
|
|
467
|
-
const { r: s, s: d } = U.toSig(Y("DER", o));
|
|
468
|
-
return new e(s, d);
|
|
469
|
-
}
|
|
470
|
-
assertValidity() {
|
|
471
|
-
Q("r", this.r, A, E), Q("s", this.s, A, E);
|
|
472
|
-
}
|
|
473
|
-
addRecoveryBit(o) {
|
|
474
|
-
return new e(this.r, this.s, o);
|
|
475
|
-
}
|
|
476
|
-
recoverPublicKey(o) {
|
|
477
|
-
const { r: s, s: d, recovery: g } = this, O = p(Y("msgHash", o));
|
|
478
|
-
if (g == null || ![0, 1, 2, 3].includes(g))
|
|
479
|
-
throw new Error("recovery id invalid");
|
|
480
|
-
const q = g === 2 || g === 3 ? s + n.n : s;
|
|
481
|
-
if (q >= t.ORDER)
|
|
482
|
-
throw new Error("recovery id 2 or 3 invalid");
|
|
483
|
-
const T = g & 1 ? "03" : "02", C = S.fromHex(T + w(q)), V = H(q), z = B(-O * V), M = B(d * V), K = S.BASE.multiplyAndAddUnsafe(C, z, M);
|
|
484
|
-
if (!K)
|
|
485
|
-
throw new Error("point at infinify");
|
|
486
|
-
return K.assertValidity(), K;
|
|
487
|
-
}
|
|
488
|
-
// Signatures should be low-s, to prevent malleability.
|
|
489
|
-
hasHighS() {
|
|
490
|
-
return X(this.s);
|
|
491
|
-
}
|
|
492
|
-
normalizeS() {
|
|
493
|
-
return this.hasHighS() ? new e(this.r, B(-this.s), this.recovery) : this;
|
|
494
|
-
}
|
|
495
|
-
// DER-encoded
|
|
496
|
-
toDERRawBytes() {
|
|
497
|
-
return lt(this.toDERHex());
|
|
498
|
-
}
|
|
499
|
-
toDERHex() {
|
|
500
|
-
return U.hexFromSig({ r: this.r, s: this.s });
|
|
501
|
-
}
|
|
502
|
-
// padded bytes of r, then padded bytes of s
|
|
503
|
-
toCompactRawBytes() {
|
|
504
|
-
return lt(this.toCompactHex());
|
|
505
|
-
}
|
|
506
|
-
toCompactHex() {
|
|
507
|
-
return w(this.r) + w(this.s);
|
|
508
|
-
}
|
|
509
|
-
}
|
|
510
|
-
const i = {
|
|
511
|
-
isValidPrivateKey(r) {
|
|
1
|
+
import { hexToBigInt as h } from "./index182.js";
|
|
2
|
+
import { getAction as v } from "./index29.js";
|
|
3
|
+
import { observe as i } from "./index39.js";
|
|
4
|
+
import { poll as d } from "./index40.js";
|
|
5
|
+
import { stringify as y } from "./index42.js";
|
|
6
|
+
import { getBlockNumber as g } from "./index69.js";
|
|
7
|
+
function j(t, { emitOnBegin: b = !1, emitMissed: f = !1, onBlockNumber: p, onError: n, poll: k, pollingInterval: m = t.pollingInterval }) {
|
|
8
|
+
const B = typeof k < "u" ? k : !(t.transport.type === "webSocket" || t.transport.type === "fallback" && t.transport.transports[0].config.type === "webSocket");
|
|
9
|
+
let r;
|
|
10
|
+
return B ? (() => {
|
|
11
|
+
const l = y([
|
|
12
|
+
"watchBlockNumber",
|
|
13
|
+
t.uid,
|
|
14
|
+
b,
|
|
15
|
+
f,
|
|
16
|
+
m
|
|
17
|
+
]);
|
|
18
|
+
return i(l, { onBlockNumber: p, onError: n }, (e) => d(async () => {
|
|
19
|
+
var a;
|
|
512
20
|
try {
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
21
|
+
const o = await v(t, g, "getBlockNumber")({ cacheTime: 0 });
|
|
22
|
+
if (r) {
|
|
23
|
+
if (o === r)
|
|
24
|
+
return;
|
|
25
|
+
if (o - r > 1 && f)
|
|
26
|
+
for (let s = r + 1n; s < o; s++)
|
|
27
|
+
e.onBlockNumber(s, r), r = s;
|
|
28
|
+
}
|
|
29
|
+
(!r || o > r) && (e.onBlockNumber(o, r), r = o);
|
|
30
|
+
} catch (o) {
|
|
31
|
+
(a = e.onError) == null || a.call(e, o);
|
|
516
32
|
}
|
|
517
|
-
},
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
* @example
|
|
532
|
-
* const fast = utils.precompute(8, ProjectivePoint.fromHex(someonesPubKey));
|
|
533
|
-
* fast.multiply(privKey); // much faster ECDH now
|
|
534
|
-
*/
|
|
535
|
-
precompute(r = 8, o = S.BASE) {
|
|
536
|
-
return o._setWindowSize(r), o.multiply(BigInt(3)), o;
|
|
537
|
-
}
|
|
538
|
-
};
|
|
539
|
-
function c(r, o = !0) {
|
|
540
|
-
return S.fromPrivateKey(r).toRawBytes(o);
|
|
541
|
-
}
|
|
542
|
-
function u(r) {
|
|
543
|
-
const o = at(r), s = typeof r == "string", d = (o || s) && r.length;
|
|
544
|
-
return o ? d === R || d === Z : s ? d === 2 * R || d === 2 * Z : r instanceof S;
|
|
545
|
-
}
|
|
546
|
-
function y(r, o, s = !0) {
|
|
547
|
-
if (u(r))
|
|
548
|
-
throw new Error("first arg must be private key");
|
|
549
|
-
if (!u(o))
|
|
550
|
-
throw new Error("second arg must be public key");
|
|
551
|
-
return S.fromHex(o).multiply(L(r)).toRawBytes(s);
|
|
552
|
-
}
|
|
553
|
-
const v = n.bits2int || function(r) {
|
|
554
|
-
if (r.length > 8192)
|
|
555
|
-
throw new Error("input is too large");
|
|
556
|
-
const o = nt(r), s = r.length * 8 - n.nBitLength;
|
|
557
|
-
return s > 0 ? o >> BigInt(s) : o;
|
|
558
|
-
}, p = n.bits2int_modN || function(r) {
|
|
559
|
-
return B(v(r));
|
|
560
|
-
}, a = Rt(n.nBitLength);
|
|
561
|
-
function h(r) {
|
|
562
|
-
return Q("num < 2^" + n.nBitLength, r, j, a), dt(r, n.nByteLength);
|
|
563
|
-
}
|
|
564
|
-
function l(r, o, s = N) {
|
|
565
|
-
if (["recovered", "canonical"].some((k) => k in s))
|
|
566
|
-
throw new Error("sign() legacy options not supported");
|
|
567
|
-
const { hash: d, randomBytes: g } = n;
|
|
568
|
-
let { lowS: O, prehash: q, extraEntropy: T } = s;
|
|
569
|
-
O == null && (O = !0), r = Y("msgHash", r), ft(s), q && (r = Y("prehashed msgHash", d(r)));
|
|
570
|
-
const C = p(r), V = L(o), z = [h(V), h(C)];
|
|
571
|
-
if (T != null && T !== !1) {
|
|
572
|
-
const k = T === !0 ? g(t.BYTES) : T;
|
|
573
|
-
z.push(Y("extraEntropy", k));
|
|
574
|
-
}
|
|
575
|
-
const M = st(...z), K = C;
|
|
576
|
-
function ot(k) {
|
|
577
|
-
const W = v(k);
|
|
578
|
-
if (!rt(W))
|
|
579
|
-
return;
|
|
580
|
-
const it = H(W), $ = S.BASE.multiply(W).toAffine(), I = B($.x);
|
|
581
|
-
if (I === j)
|
|
582
|
-
return;
|
|
583
|
-
const J = B(it * B(K + I * V));
|
|
584
|
-
if (J === j)
|
|
585
|
-
return;
|
|
586
|
-
let _ = ($.x === I ? 0 : 2) | Number($.y & A), G = J;
|
|
587
|
-
return O && X(J) && (G = D(J), _ ^= 1), new e(I, G, _);
|
|
588
|
-
}
|
|
589
|
-
return { seed: M, k2sig: ot };
|
|
590
|
-
}
|
|
591
|
-
const N = { lowS: n.lowS, prehash: !1 }, x = { lowS: n.lowS, prehash: !1 };
|
|
592
|
-
function b(r, o, s = N) {
|
|
593
|
-
const { seed: d, k2sig: g } = l(r, o, s), O = n;
|
|
594
|
-
return Ot(O.hash.outputLen, O.nByteLength, O.hmac)(d, g);
|
|
595
|
-
}
|
|
596
|
-
S.BASE._setWindowSize(8);
|
|
597
|
-
function F(r, o, s, d = x) {
|
|
598
|
-
var _;
|
|
599
|
-
const g = r;
|
|
600
|
-
o = Y("msgHash", o), s = Y("publicKey", s);
|
|
601
|
-
const { lowS: O, prehash: q, format: T } = d;
|
|
602
|
-
if (ft(d), "strict" in d)
|
|
603
|
-
throw new Error("options.strict was renamed to lowS");
|
|
604
|
-
if (T !== void 0 && T !== "compact" && T !== "der")
|
|
605
|
-
throw new Error("format must be compact or der");
|
|
606
|
-
const C = typeof g == "string" || at(g), V = !C && !T && typeof g == "object" && g !== null && typeof g.r == "bigint" && typeof g.s == "bigint";
|
|
607
|
-
if (!C && !V)
|
|
608
|
-
throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");
|
|
609
|
-
let z, M;
|
|
610
|
-
try {
|
|
611
|
-
if (V && (z = new e(g.r, g.s)), C) {
|
|
33
|
+
}, {
|
|
34
|
+
emitOnBegin: b,
|
|
35
|
+
interval: m
|
|
36
|
+
}));
|
|
37
|
+
})() : (() => {
|
|
38
|
+
const l = y([
|
|
39
|
+
"watchBlockNumber",
|
|
40
|
+
t.uid,
|
|
41
|
+
b,
|
|
42
|
+
f
|
|
43
|
+
]);
|
|
44
|
+
return i(l, { onBlockNumber: p, onError: n }, (e) => {
|
|
45
|
+
let a = !0, o = () => a = !1;
|
|
46
|
+
return (async () => {
|
|
612
47
|
try {
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
48
|
+
const s = (() => {
|
|
49
|
+
if (t.transport.type === "fallback") {
|
|
50
|
+
const c = t.transport.transports.find((u) => u.config.type === "webSocket");
|
|
51
|
+
return c ? c.value : t.transport;
|
|
52
|
+
}
|
|
53
|
+
return t.transport;
|
|
54
|
+
})(), { unsubscribe: w } = await s.subscribe({
|
|
55
|
+
params: ["newHeads"],
|
|
56
|
+
onData(c) {
|
|
57
|
+
var N;
|
|
58
|
+
if (!a)
|
|
59
|
+
return;
|
|
60
|
+
const u = h((N = c.result) == null ? void 0 : N.number);
|
|
61
|
+
e.onBlockNumber(u, r), r = u;
|
|
62
|
+
},
|
|
63
|
+
onError(c) {
|
|
64
|
+
var u;
|
|
65
|
+
(u = e.onError) == null || u.call(e, c);
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
o = w, a || o();
|
|
69
|
+
} catch (s) {
|
|
70
|
+
n == null || n(s);
|
|
617
71
|
}
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
} catch {
|
|
622
|
-
return !1;
|
|
623
|
-
}
|
|
624
|
-
if (!z || O && z.hasHighS())
|
|
625
|
-
return !1;
|
|
626
|
-
q && (o = n.hash(o));
|
|
627
|
-
const { r: K, s: ot } = z, k = p(o), W = H(ot), it = B(k * W), $ = B(K * W), I = (_ = S.BASE.multiplyAndAddUnsafe(M, it, $)) == null ? void 0 : _.toAffine();
|
|
628
|
-
return I ? B(I.x) === K : !1;
|
|
629
|
-
}
|
|
630
|
-
return {
|
|
631
|
-
CURVE: n,
|
|
632
|
-
getPublicKey: c,
|
|
633
|
-
getSharedSecret: y,
|
|
634
|
-
sign: b,
|
|
635
|
-
verify: F,
|
|
636
|
-
ProjectivePoint: S,
|
|
637
|
-
Signature: e,
|
|
638
|
-
utils: i
|
|
639
|
-
};
|
|
72
|
+
})(), () => o();
|
|
73
|
+
});
|
|
74
|
+
})();
|
|
640
75
|
}
|
|
641
76
|
export {
|
|
642
|
-
|
|
643
|
-
qt as DERErr,
|
|
644
|
-
Yt as weierstrass,
|
|
645
|
-
zt as weierstrassPoints
|
|
77
|
+
j as watchBlockNumber
|
|
646
78
|
};
|