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