From 035ce99bc26ee79d217d15c2e93e8d56afa7064d Mon Sep 17 00:00:00 2001 From: Keep Creating Online Date: Sun, 19 Jan 2025 19:42:39 -0500 Subject: [PATCH] update --- refactoring/about.html | 207 - refactoring/assets/favicon.ico | Bin 15406 -> 0 bytes refactoring/assets/jpg/bitvid.jpg | Bin 95452 -> 0 bytes .../assets/png/android-chrome-192x192.png | Bin 9326 -> 0 bytes .../assets/png/android-chrome-512x512.png | Bin 37857 -> 0 bytes refactoring/assets/png/apple-touch-icon.png | Bin 8295 -> 0 bytes refactoring/assets/png/favicon-16x16.png | Bin 586 -> 0 bytes refactoring/assets/png/favicon-32x32.png | Bin 1150 -> 0 bytes .../assets/svg/bitvid-logo-dark-mode.svg | 33 - .../assets/svg/bitvid-logo-light-mode.svg | 33 - .../assets/svg/video-settings-gear.svg | 1 - refactoring/components/video-modal.html | 99 - refactoring/content/about.md | 24 - refactoring/content/getting-started.md | 47 - refactoring/content/ipns.md | 19 - refactoring/content/roadmap.md | 47 - refactoring/css/markdown.css | 111 - refactoring/css/style.css | 423 - refactoring/getting-started.html | 207 - refactoring/index.html | 448 - refactoring/ipns.html | 206 - refactoring/js/accessControl.js | 154 - refactoring/js/app.js | 724 -- refactoring/js/components/VideoList.js | 285 - refactoring/js/components/VideoPlayer.js | 187 - refactoring/js/config.js | 4 - refactoring/js/disclaimer.js | 29 - refactoring/js/libs/nostr.bundle.js | 8676 ----------------- refactoring/js/lists.js | 13 - refactoring/js/nostr.js | 677 -- refactoring/js/utils/htmlUtils.js | 9 - refactoring/js/utils/timeUtils.js | 21 - refactoring/js/webtorrent.js | 286 - refactoring/roadmap.html | 185 - refactoring/site.webmanifest | 41 - refactoring/sw.min.js | 132 - 36 files changed, 13328 deletions(-) delete mode 100644 refactoring/about.html delete mode 100644 refactoring/assets/favicon.ico delete mode 100644 refactoring/assets/jpg/bitvid.jpg delete mode 100644 refactoring/assets/png/android-chrome-192x192.png delete mode 100644 refactoring/assets/png/android-chrome-512x512.png delete mode 100644 refactoring/assets/png/apple-touch-icon.png delete mode 100644 refactoring/assets/png/favicon-16x16.png delete mode 100644 refactoring/assets/png/favicon-32x32.png delete mode 100644 refactoring/assets/svg/bitvid-logo-dark-mode.svg delete mode 100644 refactoring/assets/svg/bitvid-logo-light-mode.svg delete mode 100644 refactoring/assets/svg/video-settings-gear.svg delete mode 100644 refactoring/components/video-modal.html delete mode 100644 refactoring/content/about.md delete mode 100644 refactoring/content/getting-started.md delete mode 100644 refactoring/content/ipns.md delete mode 100644 refactoring/content/roadmap.md delete mode 100644 refactoring/css/markdown.css delete mode 100644 refactoring/css/style.css delete mode 100644 refactoring/getting-started.html delete mode 100644 refactoring/index.html delete mode 100644 refactoring/ipns.html delete mode 100644 refactoring/js/accessControl.js delete mode 100644 refactoring/js/app.js delete mode 100644 refactoring/js/components/VideoList.js delete mode 100644 refactoring/js/components/VideoPlayer.js delete mode 100644 refactoring/js/config.js delete mode 100644 refactoring/js/disclaimer.js delete mode 100644 refactoring/js/libs/nostr.bundle.js delete mode 100644 refactoring/js/lists.js delete mode 100644 refactoring/js/nostr.js delete mode 100644 refactoring/js/utils/htmlUtils.js delete mode 100644 refactoring/js/utils/timeUtils.js delete mode 100644 refactoring/js/webtorrent.js delete mode 100644 refactoring/roadmap.html delete mode 100644 refactoring/site.webmanifest delete mode 100644 refactoring/sw.min.js diff --git a/refactoring/about.html b/refactoring/about.html deleted file mode 100644 index 8b4acd4..0000000 --- a/refactoring/about.html +++ /dev/null @@ -1,207 +0,0 @@ - - - - - - bitvid | About - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
-
- - - BitVid Logo - -
-
- - -
- -
-

Loading Content...

-
-
- - - - -
- - - - - - - - - diff --git a/refactoring/assets/favicon.ico b/refactoring/assets/favicon.ico deleted file mode 100644 index 8ea244df05532b3e74196c13713369a11cb738e2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 15406 zcmeHNZOETh8NdH?YGL^j8AehM5p8O2d-mcqXKizcW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?6}cs~hR`1dP252n~bu`CW7^j#o- zu9@lmN)2yv^j%cHA9i9JDOdF?aQ4v-v_}m7{g7{*26C&&H&Tr6jHAFO`7y`U|gE`j*Ac;rH{i!DDG{xrH^^Ch9uyeqN~)tI%N^;tk&p zBJV!`YJZVe*g%{7V)@u|L7(*r81nZEYv(rd+`G~L?#6sS8X+s`+Jj{g{r>wAfAe9! z77f8}^~G4?e8BvnT`JpFSd*R6Zp#bAPFd;uT|2@7Gn=}Fx$XkyD|)}5R(|QkJZ4O^ z1J}s-odR>UM$&>hx`Ase*IwF%wzN3=%E{&x{?u;ygfaMj?Y2%^BS(XV`n3hPPvgAT z{riE0)5e%B=Xn`*;F~eejrje*e8=wxD(S=3(Q5JR!80Gvtw{0r8$ujo-mr1@?fCtM z`5v(VAe}=iH8G~$5(vZl`%3@&8MhYSLG(TH5OjG3IOFeU{2LkCWFKPC-}&_J0b6u3 T?`#}E(y7P?jUQNGiUs})E2abA diff --git a/refactoring/assets/jpg/bitvid.jpg b/refactoring/assets/jpg/bitvid.jpg deleted file mode 100644 index ac4493d99ce17222a7600437c5a3365785b67d5a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 95452 zcmeFa3p`Zo{y)BirbrXHgqU*ABs+zYOqY$YOO#Z~R1%V;2*s?Th|+|xV~0rO(o~W{ zCimzf_q!RFkn4=g7-nY8|C#prpR-H*{Q7>+_k6$KbG~CY`(?(gwVvl$@8|ivKkv`y z`7CZTmkKR0H!(AT1Ox=2Ti`#4+Xiii<_QS!{{7`gP*{-nGhawZP#85Ih2p&yEEHY1 zV1dX26iP%)L_~BE_(3gPj22t8nD;yHB)r3UM}dEf7N8dJzVRRX;l75%7YL__$_ol8 zLG#1~1jPlor4R;!1cX6rc@6%{kH9=ZA>sL;Ng|@)3pqgTF&U z;=&Ru*KVD^)aoco$wN}-a`?Rk%G;h4NmRMs6k8?aDBT4tH7oT{3-#wyMAx_bH> zHX3aI+1SK%hne}Fy*B%7_a8XuaN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(ME3v3)LtDlYsi*cEsZqtZ>Pkx6w5i@W*MN2bOXfMz<9H!hCn7H1h6_x^A#jUgH|l|z#=;? zFb@MwGz3Y^fvnt0Z)|Rc1tY?#=|pY5H8a>tQt5VqbQOH^Q@{MwQXgVd?`Q6L1yz3% zXFrMH=c@bKoE+Y(i4kxCU}D_-sTwAb#vHJ+q6J#pA#6_xNLM?vwzpy` z`=RXI{YznWM~2yzAtlc4O9TLm3}r@r{c-j=O8y=9h6E-Y*zVub>2^b3HypCvzDMAz z;on*B+QbNyUjX>ZqaZ&cn%EHfQ^h85J8NNwEyT7sXC=-S>%^ci2g5lC!}N2ZL}oac z9VeKVLC}_Z9VA``(_*A8K&NTqaghF>c_d`V3U;(m2v$^U84vBOJ_)WibO19}c8$dxa83(2)H*ws#CeP!KLMn}E(F_P+1_i~XD8 z^;J88@(TdfPR!fy1nxp06&n6k;LlAkl-URb?GUwt{fsT0ahur{#7KL9nj50o7_4E_nLj5R9vXfewtBUzoG+zbSv7Uh`HKzll+wK z0J|LW)T{#)n-ia@{xfFeNjDxAQbT7%(62pXWN z3Gz)4nZaQb#90aLm>~Ha5oDjWNeG$(XpB+&X`Yx-FvLhZB0 z_I;38;@f>12gvRF(w%w~Lq0$T<0N}tY?k?1i3gP+`J5vfB>8M5KM3I<8-10E$J@>v00-SmcJx-H#Ao zM%pNR`ExYlKGR6p_i;mfTSzF_8Dxupa(VgLXD diff --git a/refactoring/assets/png/apple-touch-icon.png b/refactoring/assets/png/apple-touch-icon.png deleted file mode 100644 index 06e7947d7df502347dba5c65a9afca3bf51c1ea9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8295 zcmYj%Ra6vE+w}x9bT^Vp$dJ+@-Q6i5ARy9RLku7w4Wg99&>$%xA;K_7*U*Zj)BqCF zDZlUk#riJJc`nYmIqTVL?S1xs;`MdahzS@700027hPtxhzuNqtg$Mn&%Zx#V{uQ9F zp_(F~Zk%xk0AK}ZC@UBT+3e>NzBAr@e;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nSY}OUn{_sibl%8ChFkA zu2v@J_&v1v8~*Esr~Qa?wTkVp1OKwCdI^aYs3fzWqECc%TEr4-;ct_bWiRi0Q56^R zhLX-@Z^$-Xn<71sDL-kLLxcgil!5G-8V}QG;`EagsiTlS(u6qcBc^G7_?DmvaKlOe zCn8gg?@Z;BEFQtb0(cA^Oh~^^lOR52oL_HPj_!6()xgl?td#ObDgoA;W9;B-{G&QF z1J}*9RU|o5auq)VyDPt0nEhaJ zE*4csnP=+t9A~@5P-(6|I56%Da`F|m${$R|_d-2|pTJe^@ia;Pm~rD$i1RoHS*>W5 zd-@wO{A}9A1ft`Rgc$~}R{3e>AX&;}W&Z77q_U=M2!4WqP507KItcMrpbR*>4*Mkd z?N7sz+>JWu&eEe89g4vHtZ&Dh4GiXxoij8HUSlcFA&cPOhF;t@7flHawi|lP-F#KcYqukS$RC+mH`)#R6afLaBtuQaKo(7!;KefEEX@i5h zOMsLnjPP{7ic^G@D^)>w9SMIZqV2n;tnhn(ogCF8=?mv@a&f|ru^z%);yO0d!YdN{ zQ)APwsWMw~?ARGhiYYc|KHm%+5(Wb;=&z(078?yW9Skz=pE&jF-SJBV?n zRgbt98W<~PFHI-{pC)yf!jcnlKGb<<7G+L0Y?nq4C5CPoyvi$&b^C7nvN>`kW|Bl| z_{Mtw!cCtEH^5TD!b{r9p#sdrtiF^YGBt_#NzzC;m7g|R^FZ_8U;y=hW&w7i0;ZF{ jxa_-(ag8K?JiiC(K!U@8EME2hE&w!Cbd~EAZKM7lkEPl$ diff --git a/refactoring/assets/png/favicon-16x16.png b/refactoring/assets/png/favicon-16x16.png deleted file mode 100644 index c9f0d8d2ca59529b3ea70b2c0b7d69bf8a195ec7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 586 zcmV-Q0=4~#P)Px%1W80eR5(v(kd>89ga*+DvEm`9DWLKJsMvx^6W+kY z&{0xZ83jVX4aS7T7ht2YVA!3{oV#}xh)yw?d*_~Wzkf#nlE98nDq1r}8>n~*JW_00 zS3|0!Lc{&SXP2>O#&3a4tN$?+o?81ISlt+*(ohlHqj+^`x4xL8Yd z2~hlTsvq^LSLy2z%Jpax;2AQ%3);%((qVa2{NVoB86ihjQLKSlTGMGg{E4ZHH`_NYNbnW+P$HL@7>DAeOHUZPx(I7vi7R9Huim(OcmRS?HN^O~Bd*ld%9LPa4Iq=~i&^#>*>*1y0-6$&mZS)_EK ziwZ7UTo_9KfKUp8e}T0K4{brPA_ml?kYabfETlDQwJ%BE9XUVlz31F_&ds}v$GhjA zIWzN}neWUIMtqbP#^ISa3RnlA6!T+2dC*@2?uQ$uB z_PRLRVRgAo6I*J^#BG7ebZQx!1X*4}&s~DYgEGTfOSpvxwxB;FtZ!O;mDvl5e3CAc z0QUJ~@WU@qI5T6vgR~C3NT-U?SzJ88ub+xzxI=e=X)BjVKBrCK#}#;T!rA%nBY6Fz zp+qg6C>5uVvtN6{_F+-x-d5zhN^x75pPhzI$LY`l?imL5&x8L;Ch)16IVe~b^c@*6 zcR?EPCt)+L{B#wb_6UUW8WiyAhsdK{S0$sBq^X&UQthpusUOQSNP;GFz zTW|-tgJZesa^+&UIP7s>Ux(h`Ihmd_Akk)r^1v|j8D~I1Q`Ny$);Ciy zVL))UHDDc>sUu@kJR-xY3|Bsbi6`<1SkWK^?K=%pHUw1?dN$9Coj8gdFeFmCLo2&vc{_%NX25s1fbsrCg_?4md4no%oz3e3L} zHKQbX#hQkyq+Bp8Xq%BUz_nwL$?V8s5LjM9&Rs%nJI+ECk7*%GdbShr?Rd?!WA`)% z5UClM;^QZLM{L)Q>&b5cW9T8P!LO5~rxfYSX+z1r29zU~YJENLAhVjio@*B#-t2H^r)Iw4gf8v)AJO#8-%6=W Q{r~^~07*qoM6N<$f|Elo$N&HU diff --git a/refactoring/assets/svg/bitvid-logo-dark-mode.svg b/refactoring/assets/svg/bitvid-logo-dark-mode.svg deleted file mode 100644 index 4cded50..0000000 --- a/refactoring/assets/svg/bitvid-logo-dark-mode.svg +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/refactoring/assets/svg/bitvid-logo-light-mode.svg b/refactoring/assets/svg/bitvid-logo-light-mode.svg deleted file mode 100644 index 6d02a40..0000000 --- a/refactoring/assets/svg/bitvid-logo-light-mode.svg +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/refactoring/assets/svg/video-settings-gear.svg b/refactoring/assets/svg/video-settings-gear.svg deleted file mode 100644 index 9a64fbd..0000000 --- a/refactoring/assets/svg/video-settings-gear.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/refactoring/components/video-modal.html b/refactoring/components/video-modal.html deleted file mode 100644 index 29d15d0..0000000 --- a/refactoring/components/video-modal.html +++ /dev/null @@ -1,99 +0,0 @@ - - diff --git a/refactoring/content/about.md b/refactoring/content/about.md deleted file mode 100644 index fcae05c..0000000 --- a/refactoring/content/about.md +++ /dev/null @@ -1,24 +0,0 @@ -![](https://bitvid.netlify.app/assets/jpg/bitvid.jpg) - -# About bitvid - -Welcome to bitvid, a new kind of video platform that puts you in control. Unlike traditional video sites that keep your content on their servers, bitvid lets videos flow directly between creators and viewers. Think of it like a digital potluck where everyone brings and shares content directly with each other! - -## What Makes bitvid Different? - -- **You're in Control**: Your videos stay yours. No company owns or controls your content – you share it directly with your viewers. -- **Always Available**: Because videos are shared between viewers, popular content actually loads faster instead of slower. No more buffering during peak times! -- **Privacy First**: No need for email or password – you log in with a secure key that only you control. -- **Support Creators Directly**: Send tips to creators you love without a platform taking a big cut. -- **Free and Open**: bitvid's code is open source, meaning anyone can check how it works or help make it better. - -## How Does It Work? - -bitvid uses two main technologies to make this all possible: - -1. **WebTorrent**: This lets viewers stream videos directly from other viewers, like a relay race passing the content from person to person. -2. **Nostr**: This handles your login and video details, like a digital ID card that works across many sites. - -## Join the Revolution - -Whether you're tired of traditional platforms controlling your content, care about privacy, or just want a better way to share videos, bitvid offers a fresh alternative. Come be part of the future of video sharing! diff --git a/refactoring/content/getting-started.md b/refactoring/content/getting-started.md deleted file mode 100644 index 9d0f20c..0000000 --- a/refactoring/content/getting-started.md +++ /dev/null @@ -1,47 +0,0 @@ -# Getting Started with bitvid - -Ready to jump in? Here's everything you need to know to start watching and sharing videos on bitvid. - -## Watching Videos - -1. Just visit [bitvid.network](https://bitvid.network) or one of our alternate sites like [bitvid.btc.us](https://bitvid.btc.us) and [bitvid.eth.limo](https://bitvid.eth.limo). We also have other instances via [IPNS](ipns.html) gateways you can try. -2. Browse the videos on the homepage -3. Click any video to start watching - That's it! No account needed to watch. - -## Sharing Your Videos - -### Step 1: Set Up Your Account - -1. Install a [Nostr extension](https://nostrapps.com/#signers#all) (like Alby or Nos2x) in your browser -2. The extension creates your secure login key automatically -3. Click "Login" on bitvid to connect - -### Step 2: Prepare Your Video - -1. Download WebTorrent Desktop app from [webtorrent.io/desktop](https://webtorrent.io/desktop/) -2. Open your video file in WebTorrent Desktop -3. It will create a special "magnet link" for your video -4. Keep WebTorrent Desktop running to share your video - -### Step 3: Share on bitvid - -1. Click "Share a Video" on bitvid -2. Paste your video's magnet link -3. Add a title, description, and thumbnail -4. Click "Post" to share! - -## Tips for Success - -- Keep WebTorrent Desktop running while sharing videos -- Add eye-catching thumbnails to attract viewers -- Write clear descriptions to help people find your content -- Use the "Private" option if you only want to share with specific people - -## Need Help? - -- Visit our [GitHub](https://github.com/PR0M3TH3AN/bitvid) page for technical support -- Join our [community](https://primal.net/p/npub13yarr7j6vjqjjkahd63dmr27curypehx45ucue286ac7sft27y0srnpmpe) to connect with other users -- Report bugs to help us improve - -Welcome to bitvid – let's start sharing! diff --git a/refactoring/content/ipns.md b/refactoring/content/ipns.md deleted file mode 100644 index 036d4e6..0000000 --- a/refactoring/content/ipns.md +++ /dev/null @@ -1,19 +0,0 @@ -# IPNS Gateways - -Below is a list of available IPNS gateways you can use with the hash `k51qzi5uqu5dgwr4oejq9rk41aoe9zcupenby6iqecsk5byc7rx48uecd133a1`: - -1. **[FLK IPFS Gateway](https://k51qzi5uqu5dgwr4oejq9rk41aoe9zcupenby6iqecsk5byc7rx48uecd133a1.ipns.flk-ipfs.xyz/)** - A public gateway that resolves the provided IPNS hash. - -2. **[Aragon IPFS Gateway](https://ipfs.eth.aragon.network/ipfs/bafybeih2ebj55ki3wvasj5i3rhwgjn6e72f6vxsrlrjfqvzezot2eoeqz4/)** - A gateway hosted by Aragon for IPFS content resolution. - -3. **[Dweb.link Gateway](https://dweb.link/ipns/k51qzi5uqu5dgwr4oejq9rk41aoe9zcupenby6iqecsk5byc7rx48uecd133a1)** - A subdomain resolution gateway provided by Protocol Labs. - -4. **[IPFS.io Gateway](https://ipfs.io/ipns/k51qzi5uqu5dgwr4oejq9rk41aoe9zcupenby6iqecsk5byc7rx48uecd133a1)** - A public gateway operated by Protocol Labs. - ---- - -**Note:** The availability and performance of these gateways may vary. diff --git a/refactoring/content/roadmap.md b/refactoring/content/roadmap.md deleted file mode 100644 index 824c7a2..0000000 --- a/refactoring/content/roadmap.md +++ /dev/null @@ -1,47 +0,0 @@ -# Roadmap and Bug List - -## UI Enhancements - -- Add a copy Magnet button labeled "Seed". -- add community guidelines page -- add links to pop-up modal -- Convert "Logged in as" from public key to profile image and username (use npub as fallback). -- Add a sidebar for improved UI flexibility. -- Customize home screen content via algorithms for better feeds. (trending, new, for you etc.) -- Improve UI/UX and CSS. -- Add custom color themes and toggle between light and dark mode. - -## Bug Fixes - -- Fix public key wrapping issue on smaller screens. -- Fix video editing failures. -- Resolve issue where reopening the same video doesn't work after closing the video player. -- Address "Video playback error: MEDIA_ELEMENT_ERROR: Empty src attribute" error. -- Fix "Dev Mode" publishing "Live Mode" notes—add a flag for dev mode posts. - -## Feature Additions - -- Allow users to set custom relay settings, stored in local cache. -- Add a "Publish" step in the video editing process. -- Add comments to the video modal. -- Implement an "Adult Content" flag for note submissions. -- Enable custom hashtags in the submission spec and form. -- Allow multiple video resolutions with a selector in the video player. -- Add a block/unblock list with import/export functionality. -- Assign unique URLs to each video. -- Add a profile modal for each user/profile. -- Introduce a subscription mechanism with notifications. -- Add zaps to videos, profiles, and comments. -- Implement visibility filtering for videos: - - Show only videos whose magnet links have at least **one active peer online**. - - Integrate the filtering mechanism into the video list rendering process. - - Update the video list dynamically based on real-time peer availability. -- Add multi-language support for content and filtration. -- Create a settings menu for local account preferences, including relay, adult content, theme, and language. - -## Long-Term Goals - -- Add a system for creating high-quality, algorithm-driven content feeds. -- Thoroughly bug test the video editing and submission process. - -If you find a new bug thats not listed here. DM me on [Nostr](https://primal.net/p/npub13yarr7j6vjqjjkahd63dmr27curypehx45ucue286ac7sft27y0srnpmpe). diff --git a/refactoring/css/markdown.css b/refactoring/css/markdown.css deleted file mode 100644 index 50c9d17..0000000 --- a/refactoring/css/markdown.css +++ /dev/null @@ -1,111 +0,0 @@ -/* markdown.css */ - -/* - Give the markdown container a standard text color - that is easy to read on a white background -*/ -#markdown-container { - color: #333; - line-height: 1.6; - /* Padding & border radius come from your inline Tailwind classes */ -} - -/* Headings */ -#markdown-container h1 { - font-size: 1.875rem; /* ~ text-2xl in Tailwind */ - font-weight: 700; - margin-bottom: 1rem; - margin-top: 0.5rem; - color: #111; -} - -#markdown-container h2 { - font-size: 1.5rem; /* ~ text-xl */ - font-weight: 700; - margin-bottom: 0.75rem; - margin-top: 1.25rem; - color: #222; -} - -#markdown-container h3 { - font-size: 1.25rem; /* ~ text-lg */ - font-weight: 600; - margin-bottom: 0.75rem; - margin-top: 1rem; -} - -#markdown-container h4, -#markdown-container h5, -#markdown-container h6 { - font-weight: 600; - margin-top: 0.75rem; - margin-bottom: 0.5rem; -} - -/* Paragraphs */ -#markdown-container p { - margin-bottom: 1rem; -} - -/* Lists */ -#markdown-container ul, -#markdown-container ol { - margin-left: 1.25rem; - margin-bottom: 1rem; -} - -#markdown-container li { - margin-bottom: 0.5rem; -} - -/* Blockquotes */ -#markdown-container blockquote { - border-left: 4px solid #ccc; - padding-left: 1rem; - margin: 1rem 0; - color: #555; -} - -/* Inline code */ -#markdown-container code { - background-color: #f6f8fa; - color: #d63384; - padding: 0.2rem 0.4rem; - border-radius: 0.25rem; - font-family: Menlo, Monaco, "Courier New", monospace; - font-size: 0.875rem; -} - -/* Code blocks */ -#markdown-container pre { - background-color: #f6f8fa; - color: #333; - padding: 1rem; - border-radius: 0.25rem; - overflow-x: auto; - margin-bottom: 1rem; -} - -/* Links */ -#markdown-container a { - color: #bf5af2; /* pick a link color or use var(--color-primary) if you like */ - text-decoration: none; -} - -#markdown-container a:hover { - text-decoration: underline; -} - -/* Horizontal Rule */ -#markdown-container hr { - border: 0; - border-top: 1px solid #e5e7eb; - margin: 2rem 0; -} - -/* Images */ -#markdown-container img { - max-width: 100%; - height: auto; - margin-bottom: 1rem; -} diff --git a/refactoring/css/style.css b/refactoring/css/style.css deleted file mode 100644 index 67cc6c1..0000000 --- a/refactoring/css/style.css +++ /dev/null @@ -1,423 +0,0 @@ -/* css/style.css */ - -:root { - --color-bg: #0f172a; - --color-card: #1e293b; - --color-primary: #8b5cf6; - --color-secondary: #f43f5e; - --color-text: #f8fafc; - --color-muted: #94a3b8; - --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05); - --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1); - --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1); -} - -/* Core Styles */ -body { - font-family: system-ui, -apple-system, sans-serif; - background-color: var(--color-bg); - color: var(--color-text); - line-height: 1.5; -} - -header { - margin-bottom: 2rem; - padding: 1rem 0; - display: flex; - justify-content: flex-start; -} - -header img { - height: 6rem; - width: auto; - max-width: none; -} - -.container { - max-width: 1480px; - margin: 0 auto; - padding: 1rem; -} - -/* Video Grid */ -#videoList { - display: grid; - grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); - gap: 2rem; - padding: 1.5rem 0; -} - -/* Video Cards */ -.video-card { - background-color: var(--color-card); - border-radius: 0.75rem; - overflow: hidden; - transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1); - box-shadow: var(--shadow-md); -} - -.video-card:hover { - transform: translateY(-4px); - box-shadow: var(--shadow-lg); -} - -.video-card .thumbnail-container { - position: relative; - padding-top: 56.25%; - background-color: #0f172a; -} - -.video-card img.thumbnail { - position: absolute; - top: 0; - left: 0; - width: 100%; - height: 100%; - object-fit: cover; -} - -.video-card .details { - padding: 1.25rem; -} - -.video-card h3 { - font-size: 1.125rem; - font-weight: 600; - color: var(--color-text); - margin-bottom: 0.75rem; -} - -/* Modal Player */ -#playerModal { - position: fixed; - inset: 0; - background-color: rgb(0 0 0 / 0.9); - z-index: 50; - display: flex; - flex-direction: column; - overflow-y: auto; - overscroll-behavior: contain; -} - -/* Modal Content Container */ -.modal-content { - width: 100%; - height: 100%; - display: flex; - flex-direction: column; - background-color: #0f172a; -} - -/* Video Container */ -.video-container { - width: 100%; - background-color: black; - position: sticky; - top: 0; - z-index: 51; -} - -/* Modal Video */ -#modalVideo { - width: 100%; - aspect-ratio: 16/9; - background-color: black; -} - -/* Video Info Section */ -.video-info { - padding: 1rem; - flex: 1; - overflow-y: auto; -} - -/* Responsive Adjustments */ -@media (min-width: 768px) { - #playerModal { - padding: 2rem; - align-items: center; - justify-content: center; - } - - .modal-content { - max-width: 64rem; - max-height: calc(100vh - 4rem); /* Account for padding */ - border-radius: 0.5rem; - overflow: hidden; - } - - .video-container { - position: relative; - } -} - -/* Mobile-specific styles */ -@media (max-width: 767px) { - #playerModal { - padding: 0; - } - - .modal-content { - border-radius: 0; - } -} - -/* Custom Scrollbar */ -.video-info::-webkit-scrollbar { - width: 8px; -} - -.video-info::-webkit-scrollbar-track { - background: rgba(255, 255, 255, 0.1); -} - -.video-info::-webkit-scrollbar-thumb { - background: rgba(255, 255, 255, 0.3); - border-radius: 4px; -} - -.video-info::-webkit-scrollbar-thumb:hover { - background: rgba(255, 255, 255, 0.4); -} - -/* Progress Bars */ -.progress-bar { - width: 100%; - height: 0.5rem; - background-color: rgb(255 255 255 / 0.1); - border-radius: 9999px; - overflow: hidden; -} - -.progress-bar-fill { - height: 100%; - background-color: var(--color-primary); - transition: width 0.3s ease-out; -} - -/* Forms & Inputs */ -input, -textarea { - width: 100%; - padding: 0.75rem; - background-color: var(--color-bg); - border: 1px solid rgb(255 255 255 / 0.1); - border-radius: 0.5rem; - color: var(--color-text); - transition: border-color 0.2s; -} - -input:focus, -textarea:focus { - outline: none; - border-color: var(--color-primary); - ring: 2px var(--color-primary); -} - -/* Buttons */ -button { - padding: 0.75rem 1.5rem; - background-color: var(--color-primary); - color: white; - border-radius: 0.5rem; - font-weight: 500; - transition: all 0.2s; -} - -button:hover { - background-color: var(--color-secondary); - transform: translateY(-1px); -} - -button:focus { - outline: none; - ring: 2px var(--color-primary); -} - -/* Utility Classes */ -.line-clamp-2 { - display: -webkit-box; - -webkit-line-clamp: 2; - -webkit-box-orient: vertical; - overflow: hidden; -} - -.hidden { - display: none; -} - -/* Notifications */ -#errorContainer, -#successContainer { - border-radius: 0.5rem; - padding: 1rem; - margin-bottom: 1rem; - display: flex; - align-items: center; -} - -#errorContainer { - background-color: rgb(220 38 38 / 0.1); - color: #fecaca; - border: 1px solid rgb(220 38 38 / 0.2); -} - -#successContainer { - background-color: rgb(34 197 94 / 0.1); - color: #bbf7d0; - border: 1px solid rgb(34 197 94 / 0.2); -} - -/* Modal Display */ -#playerSection, -#playerModal { - display: none; -} - -#playerModal.flex { - display: flex; -} - -/* Responsive Design */ -@media (max-width: 640px) { - #videoList { - grid-template-columns: 1fr; - gap: 1rem; - } - - .container { - padding: 0.75rem; - } -} - -footer { - border-top: 1px solid rgba(255, 255, 255, 0.1); - margin-top: 4rem; - padding-top: 2rem; -} - -footer a { - text-decoration: none; -} - -footer a:hover { - text-decoration: underline; -} - -/* Disclaimer Modal Styles */ -#disclaimerModal { - position: fixed; - inset: 0; - background-color: rgb(0 0 0 / 0.9); - z-index: 50; - display: flex; - flex-direction: column; - overflow-y: auto; - overscroll-behavior: contain; -} - -#disclaimerModal .modal-content { - width: 100%; - height: 100%; - display: flex; - flex-direction: column; - background-color: var(--color-bg); -} - -#disclaimerModal .modal-scroll { - padding: 1.5rem; - flex: 1; - overflow-y: auto; -} - -/* Disclaimer Modal Scrollbar */ -#disclaimerModal .modal-scroll::-webkit-scrollbar { - width: 8px; -} - -#disclaimerModal .modal-scroll::-webkit-scrollbar-track { - background: rgba(255, 255, 255, 0.1); -} - -#disclaimerModal .modal-scroll::-webkit-scrollbar-thumb { - background: rgba(255, 255, 255, 0.3); - border-radius: 4px; -} - -#disclaimerModal .modal-scroll::-webkit-scrollbar-thumb:hover { - background: rgba(255, 255, 255, 0.4); -} - -/* Disclaimer Modal Button Container */ -#disclaimerModal .button-container { - padding: 1rem 1.5rem; - background-color: #1a2234; - border-top: 1px solid rgba(255, 255, 255, 0.1); -} - -/* Responsive Adjustments for Disclaimer Modal */ -@media (min-width: 768px) { - #disclaimerModal { - padding: 2rem; - align-items: center; - justify-content: center; - } - - #disclaimerModal .modal-content { - width: 100%; - height: auto; - max-width: 42rem; - max-height: 90vh; - border-radius: 0.5rem; - overflow: hidden; - margin: auto; - } - - #disclaimerModal .modal-scroll { - max-height: calc( - 90vh - 5rem - ); /* Account for button container and padding */ - } -} - -/* Mobile-specific styles for Disclaimer Modal */ -@media (max-width: 767px) { - #disclaimerModal { - padding: 0; - } - - #disclaimerModal .modal-content { - min-height: 100vh; - border-radius: 0; - } -} - -/* Override default button styles for back button */ -.back-button { - background: rgba(0, 0, 0, 0.5) !important; - padding: 0 !important; - color: rgb(209 213 219) !important; - transform: none !important; -} - -.back-button:hover { - background: rgba(0, 0, 0, 0.7) !important; - color: white !important; -} - -/* Modal Container */ -.modal-container { - padding: 0; -} - -@media (min-width: 768px) { - .modal-container { - padding: 2rem; - } -} - -/* Video info cards */ -.video-info .bg-gray-800\/50 { - background-color: rgb(31 41 55 / 0.5); - backdrop-filter: blur(4px); -} diff --git a/refactoring/getting-started.html b/refactoring/getting-started.html deleted file mode 100644 index 0d5a6d0..0000000 --- a/refactoring/getting-started.html +++ /dev/null @@ -1,207 +0,0 @@ - - - - - - bitvid | Getting Started - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/refactoring/index.html b/refactoring/index.html deleted file mode 100644 index e36153f..0000000 --- a/refactoring/index.html +++ /dev/null @@ -1,448 +0,0 @@ - - - - - - - - bitvid | Decentralized Video Sharing - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
-
- BitVid Logo -
-
- - -
-
- - -
-
- -
-
- - - - - - - - - - - - - - -
-
- -
-
- - -
- -
-

- seed. zap. subscribe. -

-
- - - - - - - - - - - - - - - - - - - - -
- - diff --git a/refactoring/ipns.html b/refactoring/ipns.html deleted file mode 100644 index bc384d7..0000000 --- a/refactoring/ipns.html +++ /dev/null @@ -1,206 +0,0 @@ - - - - - - bitvid | About - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/refactoring/js/accessControl.js b/refactoring/js/accessControl.js deleted file mode 100644 index 15d68bf..0000000 --- a/refactoring/js/accessControl.js +++ /dev/null @@ -1,154 +0,0 @@ -// js/accessControl.js - -import { isDevMode, isWhitelistEnabled } from "./config.js"; -import { initialWhitelist, initialBlacklist } from "./lists.js"; - -class AccessControl { - constructor() { - // Debug logging for initialization - console.log("DEBUG: AccessControl constructor called"); - console.log("DEBUG: initialWhitelist from import:", initialWhitelist); - console.log("DEBUG: typeof initialWhitelist:", typeof initialWhitelist); - console.log("DEBUG: initialWhitelist length:", initialWhitelist.length); - - // Initialize empty sets - this.whitelist = new Set(initialWhitelist); - this.blacklist = new Set(initialBlacklist.filter((x) => x)); // Filter out empty strings - - // Debug the sets - console.log("DEBUG: Whitelist after Set creation:", [...this.whitelist]); - console.log("DEBUG: Blacklist after Set creation:", [...this.blacklist]); - - // Save to localStorage - this.saveWhitelist(); - this.saveBlacklist(); - } - - // Rest of the class remains the same... - loadWhitelist() { - try { - const stored = localStorage.getItem("bitvid_whitelist"); - return stored ? JSON.parse(stored) : []; - } catch (error) { - console.error("Error loading whitelist:", error); - return []; - } - } - - loadBlacklist() { - try { - const stored = localStorage.getItem("bitvid_blacklist"); - return stored ? JSON.parse(stored) : []; - } catch (error) { - console.error("Error loading blacklist:", error); - return []; - } - } - - saveWhitelist() { - try { - localStorage.setItem( - "bitvid_whitelist", - JSON.stringify([...this.whitelist]) - ); - } catch (error) { - console.error("Error saving whitelist:", error); - } - } - - saveBlacklist() { - try { - localStorage.setItem( - "bitvid_blacklist", - JSON.stringify([...this.blacklist]) - ); - } catch (error) { - console.error("Error saving blacklist:", error); - } - } - - addToWhitelist(npub) { - if (!this.isValidNpub(npub)) { - throw new Error("Invalid npub format"); - } - this.whitelist.add(npub); - this.saveWhitelist(); - if (isDevMode) console.log(`Added ${npub} to whitelist`); - } - - removeFromWhitelist(npub) { - this.whitelist.delete(npub); - this.saveWhitelist(); - if (isDevMode) console.log(`Removed ${npub} from whitelist`); - } - - addToBlacklist(npub) { - if (!this.isValidNpub(npub)) { - throw new Error("Invalid npub format"); - } - this.blacklist.add(npub); - this.saveBlacklist(); - if (isDevMode) console.log(`Added ${npub} to blacklist`); - } - - removeFromBlacklist(npub) { - this.blacklist.delete(npub); - this.saveBlacklist(); - if (isDevMode) console.log(`Removed ${npub} from blacklist`); - } - - isWhitelisted(npub) { - const result = this.whitelist.has(npub); - if (isDevMode) - console.log( - `Checking if ${npub} is whitelisted:`, - result, - "Current whitelist:", - [...this.whitelist] - ); - return result; - } - - isBlacklisted(npub) { - return this.blacklist.has(npub); - } - - canAccess(npub) { - if (this.isBlacklisted(npub)) { - return false; - } - const canAccess = !isWhitelistEnabled || this.isWhitelisted(npub); - if (isDevMode) console.log(`Checking access for ${npub}:`, canAccess); - return canAccess; - } - - filterVideos(videos) { - return videos.filter((video) => { - try { - const npub = window.NostrTools.nip19.npubEncode(video.pubkey); - return !this.isBlacklisted(npub); - } catch (error) { - console.error("Error filtering video:", error); - return false; - } - }); - } - - isValidNpub(npub) { - try { - return npub.startsWith("npub1") && npub.length === 63; - } catch (error) { - return false; - } - } - - getWhitelist() { - return [...this.whitelist]; - } - - getBlacklist() { - return [...this.blacklist]; - } -} - -export const accessControl = new AccessControl(); diff --git a/refactoring/js/app.js b/refactoring/js/app.js deleted file mode 100644 index 7431f66..0000000 --- a/refactoring/js/app.js +++ /dev/null @@ -1,724 +0,0 @@ -// js/app.js - -import { nostrClient } from "./nostr.js"; -import { torrentClient } from "./webtorrent.js"; -import { isDevMode } from "./config.js"; -import { disclaimerModal } from "./disclaimer.js"; -import { videoPlayer } from "./components/VideoPlayer.js"; -import { videoList } from "./components/VideoList.js"; -import { formatTimeAgo } from "./utils/timeUtils.js"; - -class bitvidApp { - constructor() { - // Authentication Elements - this.loginButton = document.getElementById("loginButton"); - this.logoutButton = document.getElementById("logoutButton"); - this.userStatus = document.getElementById("userStatus"); - this.userPubKey = document.getElementById("userPubKey"); - - // Form Elements - this.submitForm = document.getElementById("submitForm"); - this.videoFormContainer = document.getElementById("videoFormContainer"); - - // Video Player Elements - this.playerSection = document.getElementById("playerSection"); - this.videoElement = document.getElementById("video"); - this.status = document.getElementById("status"); - this.progressBar = document.getElementById("progress"); - this.peers = document.getElementById("peers"); - this.speed = document.getElementById("speed"); - this.downloaded = document.getElementById("downloaded"); - - // Initialize these as null - they'll be set after modal loads - this.playerModal = null; - this.modalVideo = null; - this.modalStatus = null; - this.modalProgress = null; - this.modalPeers = null; - this.modalSpeed = null; - this.modalDownloaded = null; - this.closePlayerBtn = null; - this.videoTitle = null; - this.videoDescription = null; - this.videoTimestamp = null; - this.creatorAvatar = null; - this.creatorName = null; - this.creatorNpub = null; - - // Notification Containers - this.errorContainer = document.getElementById("errorContainer"); - this.successContainer = document.getElementById("successContainer"); - - this.pubkey = null; - this.currentMagnetUri = null; - - // Private Video Checkbox - this.isPrivateCheckbox = document.getElementById("isPrivate"); - } - - async init() { - try { - // Hide and reset player states - if (this.playerSection) { - this.playerSection.style.display = "none"; - } - - // Initialize Nostr client first - await nostrClient.init(); - - // Handle saved pubkey - const savedPubKey = localStorage.getItem("userPubKey"); - if (savedPubKey) { - this.login(savedPubKey, false); - } - - // Initialize modal - await videoPlayer.initModal(); - - // Initialize video list - await videoList.loadVideos(); - - // Initialize and show disclaimer modal - disclaimerModal.show(); - - // Set up event listeners after all initializations - this.setupEventListeners(); - } catch (error) { - console.error("Init failed:", error); - this.showError("Failed to connect to Nostr relay"); - } - } - - async initModal() { - try { - console.log("Starting modal initialization..."); - const response = await fetch("components/video-modal.html"); - - if (!response.ok) { - throw new Error(`HTTP error! status: ${response.status}`); - } - - const html = await response.text(); - console.log("Modal HTML loaded successfully"); - - const modalContainer = document.getElementById("modalContainer"); - if (!modalContainer) { - throw new Error("Modal container element not found!"); - } - - modalContainer.innerHTML = html; - console.log("Modal HTML inserted into DOM"); - - // Set up modal close handler - const closeButton = document.getElementById("closeModal"); - if (!closeButton) { - throw new Error("Close button element not found!"); - } - - closeButton.addEventListener("click", () => { - this.hideModal(); - }); - - // Set up scroll handler for nav show/hide - let lastScrollY = 0; - const modalNav = document.getElementById("modalNav"); - const playerModal = document.getElementById("playerModal"); - - if (!modalNav || !playerModal) { - throw new Error("Modal navigation elements not found!"); - } - - playerModal.addEventListener("scroll", (e) => { - const currentScrollY = e.target.scrollTop; - const shouldShowNav = - currentScrollY <= lastScrollY || currentScrollY < 50; - modalNav.style.transform = shouldShowNav - ? "translateY(0)" - : "translateY(-100%)"; - lastScrollY = currentScrollY; - }); - - console.log("Modal initialization completed successfully"); - return true; - } catch (error) { - console.error("Modal initialization failed:", error); - // You might want to show this error to the user - this.showError(`Failed to initialize video player: ${error.message}`); - return false; - } - } - - updateModalElements() { - // Update Modal Elements - this.playerModal = document.getElementById("playerModal"); - this.modalVideo = document.getElementById("modalVideo"); - this.modalStatus = document.getElementById("modalStatus"); - this.modalProgress = document.getElementById("modalProgress"); - this.modalPeers = document.getElementById("modalPeers"); - this.modalSpeed = document.getElementById("modalSpeed"); - this.modalDownloaded = document.getElementById("modalDownloaded"); - this.closePlayerBtn = document.getElementById("closeModal"); - - // Update Video Info Elements - this.videoTitle = document.getElementById("videoTitle"); - this.videoDescription = document.getElementById("videoDescription"); - this.videoTimestamp = document.getElementById("videoTimestamp"); - - // Update Creator Info Elements - this.creatorAvatar = document.getElementById("creatorAvatar"); - this.creatorName = document.getElementById("creatorName"); - this.creatorNpub = document.getElementById("creatorNpub"); - - // Add scroll behavior for nav - let lastScrollY = 0; - const modalNav = document.getElementById("modalNav"); - - if (this.playerModal && modalNav) { - this.playerModal.addEventListener("scroll", (e) => { - const currentScrollY = e.target.scrollTop; - const shouldShowNav = - currentScrollY <= lastScrollY || currentScrollY < 50; - modalNav.style.transform = shouldShowNav - ? "translateY(0)" - : "translateY(-100%)"; - lastScrollY = currentScrollY; - }); - } - } - - /** - * Sets up event listeners for various UI interactions. - */ - setupEventListeners() { - // Login Button - this.loginButton.addEventListener("click", async () => { - try { - const pubkey = await nostrClient.login(); - this.login(pubkey, true); - } catch (error) { - this.log("Login failed:", error); - this.showError("Failed to login. Please try again."); - } - }); - - // Logout Button - this.logoutButton.addEventListener("click", () => { - this.logout(); - }); - - // Form submission - this.submitForm.addEventListener("submit", (e) => this.handleSubmit(e)); - - // Close Modal Button - if (this.closePlayerBtn) { - this.closePlayerBtn.addEventListener("click", async () => { - await this.hideModal(); - }); - } - - // Close Modal by clicking outside content - if (this.playerModal) { - this.playerModal.addEventListener("click", async (e) => { - if (e.target === this.playerModal) { - await this.hideModal(); - } - }); - } - - // Video error handling - this.videoElement.addEventListener("error", (e) => { - const error = e.target.error; - this.log("Video error:", error); - if (error) { - this.showError( - `Video playback error: ${error.message || "Unknown error"}` - ); - } - }); - - // Detailed Modal Video Event Listeners - if (this.modalVideo) { - this.modalVideo.addEventListener("error", (e) => { - const error = e.target.error; - this.log("Modal video error:", error); - if (error) { - this.log("Error code:", error.code); - this.log("Error message:", error.message); - this.showError( - `Video playback error: ${error.message || "Unknown error"}` - ); - } - }); - - this.modalVideo.addEventListener("loadstart", () => { - this.log("Video loadstart event fired"); - }); - - this.modalVideo.addEventListener("loadedmetadata", () => { - this.log("Video loadedmetadata event fired"); - }); - - this.modalVideo.addEventListener("canplay", () => { - this.log("Video canplay event fired"); - }); - } - - // Cleanup on page unload - window.addEventListener("beforeunload", async () => { - await this.cleanup(); - }); - } - - /** - * Handles user login. - */ - login(pubkey, saveToStorage = true) { - this.pubkey = pubkey; - this.loginButton.classList.add("hidden"); - this.logoutButton.classList.remove("hidden"); - this.userStatus.classList.remove("hidden"); - this.userPubKey.textContent = pubkey; - this.videoFormContainer.classList.remove("hidden"); - this.log(`User logged in as: ${pubkey}`); - - // ADD: Update videoList pubkey - videoList.setPubkey(pubkey); - - if (saveToStorage) { - localStorage.setItem("userPubKey", pubkey); - } - } - - /** - * Handles user logout. - */ - logout() { - nostrClient.logout(); - this.pubkey = null; - this.loginButton.classList.remove("hidden"); - this.logoutButton.classList.add("hidden"); - this.userStatus.classList.add("hidden"); - this.userPubKey.textContent = ""; - this.videoFormContainer.classList.add("hidden"); - localStorage.removeItem("userPubKey"); - this.log("User logged out."); - } - - /** - * Cleans up video player and torrents. - */ - async cleanup() { - try { - if (this.videoElement) { - this.videoElement.pause(); - this.videoElement.src = ""; - this.videoElement.load(); - } - if (this.modalVideo) { - this.modalVideo.pause(); - this.modalVideo.src = ""; - this.modalVideo.load(); - } - await torrentClient.cleanup(); - } catch (error) { - this.log("Cleanup error:", error); - } - } - - /** - * Hides the video player section. - */ - async hideVideoPlayer() { - await this.cleanup(); - this.playerSection.classList.add("hidden"); - } - - /** - * Hides the video modal. - */ - async hideModal() { - await this.cleanup(); - this.playerModal.style.display = "none"; - this.playerModal.classList.add("hidden"); - } - - /** - * Handles video submission (with version, private listing). - */ - async handleSubmit(e) { - e.preventDefault(); - - if (!this.pubkey) { - this.showError("Please login to post a video."); - return; - } - - const descriptionElement = document.getElementById("description"); - - // ADDED FOR VERSIONING/PRIVATE/DELETE: - // If you have a checkbox with id="isPrivate" in HTML - const isPrivate = this.isPrivateCheckbox - ? this.isPrivateCheckbox.checked - : false; - - const formData = { - version: 2, // We set the version to 2 for new posts - title: document.getElementById("title")?.value.trim() || "", - magnet: document.getElementById("magnet")?.value.trim() || "", - thumbnail: document.getElementById("thumbnail")?.value.trim() || "", - description: descriptionElement?.value.trim() || "", - mode: isDevMode ? "dev" : "live", - isPrivate, // new field to handle private listings - }; - - this.log("Form Data Collected:", formData); - - if (!formData.title || !formData.magnet) { - this.showError("Title and Magnet URI are required."); - return; - } - - try { - await nostrClient.publishVideo(formData, this.pubkey); - this.submitForm.reset(); - - // If the private checkbox was checked, reset it - if (this.isPrivateCheckbox) { - this.isPrivateCheckbox.checked = false; - } - - // CHANGE: Use videoList component to refresh - await videoList.loadVideos(); // <-- Change this line - this.showSuccess("Video shared successfully!"); - } catch (error) { - this.log("Failed to publish video:", error.message); - this.showError("Failed to share video. Please try again later."); - } - } - - /** - * Gets a user-friendly error message. - */ - getErrorMessage(error) { - if (error.message.includes("404")) { - return "Service worker not found. Please check server configuration."; - } else if (error.message.includes("Brave")) { - return "Please disable Brave Shields for this site to play videos."; - } else if (error.message.includes("timeout")) { - return "Connection timeout. Please check your internet connection."; - } else { - return "Failed to play video. Please try again."; - } - } - - /** - * Shows an error message to the user. - */ - showError(message) { - if (this.errorContainer) { - this.errorContainer.textContent = message; - this.errorContainer.classList.remove("hidden"); - setTimeout(() => { - this.errorContainer.classList.add("hidden"); - this.errorContainer.textContent = ""; - }, 5000); - } else { - alert(message); - } - } - - /** - * Shows a success message to the user. - */ - showSuccess(message) { - if (this.successContainer) { - this.successContainer.textContent = message; - this.successContainer.classList.remove("hidden"); - setTimeout(() => { - this.successContainer.classList.add("hidden"); - this.successContainer.textContent = ""; - }, 5000); - } else { - alert(message); - } - } - - /** - * Logs messages to console. - */ - log(message) { - console.log(message); - } - - /** - * Plays a video given its magnet URI. - * This method handles the logic to initiate torrent download and play the video. - */ - async playVideo(magnetURI) { - try { - if (!magnetURI) { - this.showError("Invalid Magnet URI."); - return; - } - - const decodedMagnet = decodeURIComponent(magnetURI); - - if (this.currentMagnetUri === decodedMagnet) { - this.log("Same video requested - already playing"); - return; - } - this.currentMagnetUri = decodedMagnet; - - this.playerModal.style.display = "flex"; - this.playerModal.classList.remove("hidden"); - - // Re-fetch the latest from relays - const videos = await nostrClient.fetchVideos(); - const video = videos.find((v) => v.magnet === decodedMagnet); - - if (!video) { - this.showError("Video data not found."); - return; - } - - // Decrypt only once if user owns it - if ( - video.isPrivate && - video.pubkey === this.pubkey && - !video.alreadyDecrypted - ) { - this.log("User owns a private video => decrypting magnet link..."); - video.magnet = fakeDecrypt(video.magnet); - // Mark it so we don't do it again - video.alreadyDecrypted = true; - } - - const finalMagnet = video.magnet; - - // Profile fetch - let creatorProfile = { - name: "Unknown", - picture: `https://robohash.org/${video.pubkey}`, - }; - try { - const userEvents = await nostrClient.pool.list(nostrClient.relays, [ - { - kinds: [0], - authors: [video.pubkey], - limit: 1, - }, - ]); - - // Ensure userEvents isn't empty before accessing [0] - if (userEvents.length > 0 && userEvents[0]?.content) { - const profile = JSON.parse(userEvents[0].content); - creatorProfile = { - name: profile.name || profile.display_name || "Unknown", - picture: profile.picture || `https://robohash.org/${video.pubkey}`, - }; - } - } catch (error) { - this.log("Error fetching creator profile:", error); - } - - let creatorNpub = "Unknown"; - try { - creatorNpub = window.NostrTools.nip19.npubEncode(video.pubkey); - } catch (error) { - this.log("Error converting pubkey to npub:", error); - creatorNpub = video.pubkey; - } - - this.videoTitle.textContent = video.title || "Untitled"; - this.videoDescription.textContent = - video.description || "No description available."; - this.videoTimestamp.textContent = formatTimeAgo(video.created_at); - - this.creatorName.textContent = creatorProfile.name; - this.creatorNpub.textContent = `${creatorNpub.slice( - 0, - 8 - )}...${creatorNpub.slice(-4)}`; - this.creatorAvatar.src = creatorProfile.picture; - this.creatorAvatar.alt = creatorProfile.name; - - this.log("Starting video stream with:", finalMagnet); - await torrentClient.streamVideo(finalMagnet, this.modalVideo); - - const updateInterval = setInterval(() => { - if (!document.body.contains(this.modalVideo)) { - clearInterval(updateInterval); - return; - } - - const status = document.getElementById("status"); - const progress = document.getElementById("progress"); - const peers = document.getElementById("peers"); - const speed = document.getElementById("speed"); - const downloaded = document.getElementById("downloaded"); - - if (status) this.modalStatus.textContent = status.textContent; - if (progress) this.modalProgress.style.width = progress.style.width; - if (peers) this.modalPeers.textContent = peers.textContent; - if (speed) this.modalSpeed.textContent = speed.textContent; - if (downloaded) - this.modalDownloaded.textContent = downloaded.textContent; - }, 1000); - } catch (error) { - this.log("Error in playVideo:", error); - this.showError(`Playback error: ${error.message}`); - } - } - - updateTorrentStatus(torrent) { - if (!torrent) return; - - this.modalStatus.textContent = torrent.status; - this.modalProgress.style.width = `${(torrent.progress * 100).toFixed(2)}%`; - this.modalPeers.textContent = `Peers: ${torrent.numPeers}`; - this.modalSpeed.textContent = `${(torrent.downloadSpeed / 1024).toFixed( - 2 - )} KB/s`; - this.modalDownloaded.textContent = `${( - torrent.downloaded / - (1024 * 1024) - ).toFixed(2)} MB / ${(torrent.length / (1024 * 1024)).toFixed(2)} MB`; - - if (torrent.ready) { - this.modalStatus.textContent = "Ready to play"; - } else { - setTimeout(() => this.updateTorrentStatus(torrent), 1000); - } - } - - /** - * Allows the user to edit a video note (only if they are the owner). - * We reuse the note's existing d tag via nostrClient.editVideo. - */ - async handleEditVideo(index) { - try { - // CHANGE: Get videos through videoList component - const videos = await nostrClient.fetchVideos(); - const video = videos[index]; - - if (!this.pubkey) { - this.showError("Please login to edit videos."); - return; - } - if (video.pubkey !== this.pubkey) { - this.showError("You do not own this video."); - return; - } - - // Prompt for new fields or keep old - const newTitle = prompt( - "New Title? (Leave blank to keep existing)", - video.title - ); - const newMagnet = prompt( - "New Magnet? (Leave blank to keep existing)", - video.magnet - ); - const newThumbnail = prompt( - "New Thumbnail? (Leave blank to keep existing)", - video.thumbnail - ); - const newDescription = prompt( - "New Description? (Leave blank to keep existing)", - video.description - ); - - // Ask user if they want the note private or public - const wantPrivate = confirm("Make this video private? OK=Yes, Cancel=No"); - - // Fallback to old if user typed nothing - const title = - newTitle === null || newTitle.trim() === "" - ? video.title - : newTitle.trim(); - const magnet = - newMagnet === null || newMagnet.trim() === "" - ? video.magnet - : newMagnet.trim(); - const thumbnail = - newThumbnail === null || newThumbnail.trim() === "" - ? video.thumbnail - : newThumbnail.trim(); - const description = - newDescription === null || newDescription.trim() === "" - ? video.description - : newDescription.trim(); - - // Build final updated data - const updatedData = { - version: video.version || 2, // keep old version or set 2 - isPrivate: wantPrivate, - title, - magnet, - thumbnail, - description, - mode: isDevMode ? "dev" : "live", - }; - - // Edit - const originalEvent = { - id: video.id, - pubkey: video.pubkey, - tags: video.tags, - }; - await nostrClient.editVideo(originalEvent, updatedData, this.pubkey); - this.showSuccess("Video updated successfully!"); - await videoList.loadVideos(); - } catch (err) { - this.log("Failed to edit video:", err.message); - this.showError("Failed to edit video. Please try again later."); - } - } - - /** - * ADDED FOR VERSIONING/PRIVATE/DELETE: - * Allows the user to delete (soft-delete) a video by marking it as deleted. - */ - async handleDeleteVideo(index) { - try { - // CHANGE: Get videos through videoList component - const videos = await nostrClient.fetchVideos(); - const video = videos[index]; - - if (!this.pubkey) { - this.showError("Please login to delete videos."); - return; - } - if (video.pubkey !== this.pubkey) { - this.showError("You do not own this video."); - return; - } - - if ( - !confirm( - `Are you sure you want to delete "${video.title}"? This action cannot be undone.` - ) - ) { - return; - } - - const originalEvent = { - id: video.id, - pubkey: video.pubkey, - tags: video.tags, - }; - - await nostrClient.deleteVideo(originalEvent, this.pubkey); - this.showSuccess("Video deleted (hidden) successfully!"); - // CHANGE: Use videoList component to refresh - await videoList.loadVideos(); - } catch (err) { - this.log("Failed to delete video:", err.message); - this.showError("Failed to delete video. Please try again later."); - } - } -} - -export const app = new bitvidApp(); -app.init(); -window.app = app; diff --git a/refactoring/js/components/VideoList.js b/refactoring/js/components/VideoList.js deleted file mode 100644 index 9de08be..0000000 --- a/refactoring/js/components/VideoList.js +++ /dev/null @@ -1,285 +0,0 @@ -// js/components/VideoList.js -import { nostrClient } from "../nostr.js"; -import { formatTimeAgo } from "../utils/timeUtils.js"; -import { escapeHTML } from "../utils/htmlUtils.js"; - -export class VideoList { - constructor() { - this.videoList = document.getElementById("videoList"); - this.pubkey = null; // We'll need this for private video filtering - } - - setPubkey(pubkey) { - this.pubkey = pubkey; - } - - async loadVideos() { - console.log("Starting loadVideos..."); - try { - const videos = await nostrClient.fetchVideos(); - console.log("Raw videos from nostrClient:", videos); - - if (!videos) { - console.log("No videos received"); - throw new Error("No videos received from relays"); - } - - // Convert to array if not already - const videosArray = Array.isArray(videos) ? videos : [videos]; - - // Filter private videos - const displayedVideos = videosArray.filter((video) => { - if (!video.isPrivate) { - return true; - } - return this.pubkey && video.pubkey === this.pubkey; - }); - - if (displayedVideos.length === 0) { - console.log("No valid videos found after filtering."); - this.renderEmptyState( - "No public videos available yet. Be the first to upload one!" - ); - return; - } - - console.log("Processing filtered videos:", displayedVideos); - await this.renderVideoList(displayedVideos); - console.log(`Rendered ${displayedVideos.length} videos successfully`); - } catch (error) { - console.log("Failed to fetch videos:", error); - this.renderEmptyState( - "No videos available at the moment. Please try again later." - ); - } - } - - renderEmptyState(message) { - if (this.videoList) { - this.videoList.innerHTML = ` -

- ${escapeHTML(message)} -

`; - } - } - - async renderVideoList(videos) { - try { - console.log("RENDER VIDEO LIST - Start", { - videosReceived: videos, - videosCount: videos ? videos.length : "N/A", - videosType: typeof videos, - }); - - if (!videos || videos.length === 0) { - this.renderEmptyState("No videos found."); - return; - } - - // Sort by creation date - const videoArray = [...videos].sort( - (a, b) => b.created_at - a.created_at - ); - - // Fetch user profiles - const userProfiles = await this.fetchUserProfiles(videoArray); - - // Build HTML for each video - const renderedVideos = videoArray - .map((video, index) => this.renderVideoCard(video, index, userProfiles)) - .filter(Boolean); - - if (renderedVideos.length === 0) { - this.renderEmptyState("No valid videos to display."); - return; - } - - this.videoList.innerHTML = renderedVideos.join(""); - console.log("Videos rendered successfully"); - } catch (error) { - console.error("Rendering error:", error); - this.renderEmptyState("Error loading videos."); - } - } - - async fetchUserProfiles(videos) { - const userProfiles = new Map(); - const uniquePubkeys = [...new Set(videos.map((v) => v.pubkey))]; - - for (const pubkey of uniquePubkeys) { - try { - const profile = await nostrClient.fetchUserProfile(pubkey); - userProfiles.set(pubkey, profile); - } catch (error) { - console.error(`Profile fetch error for ${pubkey}:`, error); - userProfiles.set(pubkey, { - name: "Unknown", - picture: `https://robohash.org/${pubkey}`, - }); - } - } - - return userProfiles; - } - - renderVideoCard(video, index, userProfiles) { - try { - if (!this.validateVideo(video, index)) { - console.error(`Invalid video: ${video.title}`); - return ""; - } - - const profile = userProfiles.get(video.pubkey) || { - name: "Unknown", - picture: `https://robohash.org/${video.pubkey}`, - }; - - const canEdit = video.pubkey === this.pubkey; - const highlightClass = - video.isPrivate && canEdit - ? "border-2 border-yellow-500" - : "border-none"; - - return ` -
- ${this.renderThumbnail(video)} - ${this.renderCardInfo(video, profile)} -
- `; - } catch (error) { - console.error(`Error processing video ${index}:`, error); - return ""; - } - } - - renderThumbnail(video) { - return ` -
- ${ - video.thumbnail - ? this.renderThumbnailImage(video) - : this.renderPlaceholderThumbnail() - } -
-
- `; - } - - renderThumbnailImage(video) { - return ` - ${escapeHTML(video.title)} - `; - } - - renderPlaceholderThumbnail() { - return ` -
- - - - -
- `; - } - - renderCardInfo(video, profile) { - const timeAgo = formatTimeAgo(video.created_at); - const canEdit = video.pubkey === this.pubkey; - - return ` -
-

- ${escapeHTML(video.title)} -

- -
-
-
- ${profile.name} -
-
-

- ${escapeHTML(profile.name)} -

-
- ${timeAgo} -
-
-
- ${this.renderGearMenu(video, canEdit)} -
-
- `; - } - - renderGearMenu(video, canEdit) { - if (!canEdit) return ""; - - return ` -
- - -
- `; - } - - validateVideo(video, index) { - const validationResults = { - hasId: Boolean(video?.id), - isValidId: typeof video?.id === "string" && video.id.trim().length > 0, - hasVideo: Boolean(video), - hasTitle: Boolean(video?.title), - hasMagnet: Boolean(video?.magnet), - hasMode: Boolean(video?.mode), - hasPubkey: Boolean(video?.pubkey), - isValidTitle: typeof video?.title === "string" && video.title.length > 0, - isValidMagnet: - typeof video?.magnet === "string" && video.magnet.length > 0, - isValidMode: - typeof video?.mode === "string" && ["dev", "live"].includes(video.mode), - }; - - const passed = Object.values(validationResults).every(Boolean); - console.log( - `Video ${video?.title} validation results:`, - validationResults, - passed ? "PASSED" : "FAILED" - ); - - return passed; - } -} - -export const videoList = new VideoList(); diff --git a/refactoring/js/components/VideoPlayer.js b/refactoring/js/components/VideoPlayer.js deleted file mode 100644 index be56674..0000000 --- a/refactoring/js/components/VideoPlayer.js +++ /dev/null @@ -1,187 +0,0 @@ -// js/components/VideoPlayer.js - -export class VideoPlayer { - constructor() { - // Initialize these as null - they'll be set after modal loads - this.playerModal = null; - this.modalVideo = null; - this.modalStatus = null; - this.modalProgress = null; - this.modalPeers = null; - this.modalSpeed = null; - this.modalDownloaded = null; - this.closePlayerBtn = null; - this.videoTitle = null; - this.videoDescription = null; - this.videoTimestamp = null; - this.creatorAvatar = null; - this.creatorName = null; - this.creatorNpub = null; - this.currentMagnetUri = null; - } - - async initModal() { - try { - console.log("Starting modal initialization..."); - const response = await fetch("components/video-modal.html"); - - if (!response.ok) { - throw new Error(`HTTP error! status: ${response.status}`); - } - - const html = await response.text(); - console.log("Modal HTML loaded successfully"); - - const modalContainer = document.getElementById("modalContainer"); - if (!modalContainer) { - throw new Error("Modal container element not found!"); - } - - modalContainer.innerHTML = html; - console.log("Modal HTML inserted into DOM"); - - this.updateModalElements(); - await this.setupEventListeners(); - - console.log("Modal initialization completed successfully"); - return true; - } catch (error) { - console.error("Modal initialization failed:", error); - throw error; - } - } - - updateModalElements() { - // Update Modal Elements - this.playerModal = document.getElementById("playerModal"); - this.modalVideo = document.getElementById("modalVideo"); - this.modalStatus = document.getElementById("modalStatus"); - this.modalProgress = document.getElementById("modalProgress"); - this.modalPeers = document.getElementById("modalPeers"); - this.modalSpeed = document.getElementById("modalSpeed"); - this.modalDownloaded = document.getElementById("modalDownloaded"); - this.closePlayerBtn = document.getElementById("closeModal"); - - // Update Video Info Elements - this.videoTitle = document.getElementById("videoTitle"); - this.videoDescription = document.getElementById("videoDescription"); - this.videoTimestamp = document.getElementById("videoTimestamp"); - - // Update Creator Info Elements - this.creatorAvatar = document.getElementById("creatorAvatar"); - this.creatorName = document.getElementById("creatorName"); - this.creatorNpub = document.getElementById("creatorNpub"); - - this.setupScrollBehavior(); - } - - setupScrollBehavior() { - // Add scroll behavior for nav - let lastScrollY = 0; - const modalNav = document.getElementById("modalNav"); - - if (this.playerModal && modalNav) { - this.playerModal.addEventListener("scroll", (e) => { - const currentScrollY = e.target.scrollTop; - const shouldShowNav = - currentScrollY <= lastScrollY || currentScrollY < 50; - modalNav.style.transform = shouldShowNav - ? "translateY(0)" - : "translateY(-100%)"; - lastScrollY = currentScrollY; - }); - } - } - - async setupEventListeners() { - // Set up modal close handler - if (this.closePlayerBtn) { - this.closePlayerBtn.addEventListener("click", () => this.hide()); - } - - // Close Modal by clicking outside content - if (this.playerModal) { - this.playerModal.addEventListener("click", async (e) => { - if (e.target === this.playerModal) { - await this.hide(); - } - }); - } - - // Video error handling - if (this.modalVideo) { - this.setupVideoEventListeners(); - } - } - - setupVideoEventListeners() { - this.modalVideo.addEventListener("error", (e) => { - const error = e.target.error; - console.log("Modal video error:", error); - if (error) { - console.log("Error code:", error.code); - console.log("Error message:", error.message); - // You'll need to implement showError or pass it as a callback - // this.showError(`Video playback error: ${error.message || "Unknown error"}`); - } - }); - - this.modalVideo.addEventListener("loadstart", () => { - console.log("Video loadstart event fired"); - }); - - this.modalVideo.addEventListener("loadedmetadata", () => { - console.log("Video loadedmetadata event fired"); - }); - - this.modalVideo.addEventListener("canplay", () => { - console.log("Video canplay event fired"); - }); - } - - async hide() { - await this.cleanup(); - if (this.playerModal) { - this.playerModal.style.display = "none"; - this.playerModal.classList.add("hidden"); - } - } - - async cleanup() { - if (this.modalVideo) { - this.modalVideo.pause(); - this.modalVideo.src = ""; - this.modalVideo.load(); - } - } - - show() { - if (this.playerModal) { - this.playerModal.style.display = "flex"; - this.playerModal.classList.remove("hidden"); - } - } - - updateTorrentStatus(torrent) { - if (!torrent) return; - - this.modalStatus.textContent = torrent.status; - this.modalProgress.style.width = `${(torrent.progress * 100).toFixed(2)}%`; - this.modalPeers.textContent = `Peers: ${torrent.numPeers}`; - this.modalSpeed.textContent = `${(torrent.downloadSpeed / 1024).toFixed( - 2 - )} KB/s`; - this.modalDownloaded.textContent = `${( - torrent.downloaded / - (1024 * 1024) - ).toFixed(2)} MB / ${(torrent.length / (1024 * 1024)).toFixed(2)} MB`; - - if (torrent.ready) { - this.modalStatus.textContent = "Ready to play"; - } else { - setTimeout(() => this.updateTorrentStatus(torrent), 1000); - } - } -} - -export const videoPlayer = new VideoPlayer(); diff --git a/refactoring/js/config.js b/refactoring/js/config.js deleted file mode 100644 index 7363993..0000000 --- a/refactoring/js/config.js +++ /dev/null @@ -1,4 +0,0 @@ -// js/config.js - -export const isDevMode = true; // Set to false for production -export const isWhitelistEnabled = true; // Set to false to allow all non-blacklisted users diff --git a/refactoring/js/disclaimer.js b/refactoring/js/disclaimer.js deleted file mode 100644 index 435ea40..0000000 --- a/refactoring/js/disclaimer.js +++ /dev/null @@ -1,29 +0,0 @@ -class DisclaimerModal { - constructor() { - this.modal = document.getElementById("disclaimerModal"); - this.acceptButton = document.getElementById("acceptDisclaimer"); - this.hasSeenDisclaimer = localStorage.getItem("hasSeenDisclaimer"); - - this.setupEventListeners(); - } - - setupEventListeners() { - const closeModal = () => { - this.modal.style.display = "none"; - document.body.style.overflow = "unset"; - localStorage.setItem("hasSeenDisclaimer", "true"); - }; - - // Only keep the accept button event listener - this.acceptButton.addEventListener("click", closeModal); - } - - show() { - if (!this.hasSeenDisclaimer) { - this.modal.style.display = "flex"; - document.body.style.overflow = "hidden"; - } - } -} - -export const disclaimerModal = new DisclaimerModal(); diff --git a/refactoring/js/libs/nostr.bundle.js b/refactoring/js/libs/nostr.bundle.js deleted file mode 100644 index 4342b2b..0000000 --- a/refactoring/js/libs/nostr.bundle.js +++ /dev/null @@ -1,8676 +0,0 @@ -"use strict"; -var NostrTools = (() => { - var __create = Object.create; - var __defProp = Object.defineProperty; - var __getOwnPropDesc = Object.getOwnPropertyDescriptor; - var __getOwnPropNames = Object.getOwnPropertyNames; - var __getProtoOf = Object.getPrototypeOf; - var __hasOwnProp = Object.prototype.hasOwnProperty; - var __esm = (fn, res) => function __init() { - return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res; - }; - var __commonJS = (cb, mod3) => function __require() { - return mod3 || (0, cb[__getOwnPropNames(cb)[0]])((mod3 = { exports: {} }).exports, mod3), mod3.exports; - }; - var __export = (target, all) => { - for (var name in all) - __defProp(target, name, { get: all[name], enumerable: true }); - }; - var __copyProps = (to, from, except, desc) => { - if (from && typeof from === "object" || typeof from === "function") { - for (let key of __getOwnPropNames(from)) - if (!__hasOwnProp.call(to, key) && key !== except) - __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); - } - return to; - }; - var __toESM = (mod3, isNodeMode, target) => (target = mod3 != null ? __create(__getProtoOf(mod3)) : {}, __copyProps( - isNodeMode || !mod3 || !mod3.__esModule ? __defProp(target, "default", { value: mod3, enumerable: true }) : target, - mod3 - )); - var __toCommonJS = (mod3) => __copyProps(__defProp({}, "__esModule", { value: true }), mod3); - - // - var init_define_process = __esm({ - ""() { - } - }); - - // (disabled):crypto - var require_crypto = __commonJS({ - "(disabled):crypto"() { - init_define_process(); - } - }); - - // node_modules/@scure/bip39/wordlists/english.js - var require_english = __commonJS({ - "node_modules/@scure/bip39/wordlists/english.js"(exports) { - "use strict"; - init_define_process(); - Object.defineProperty(exports, "__esModule", { value: true }); - exports.wordlist = void 0; - exports.wordlist = `abandon -ability -able -about -above -absent -absorb -abstract -absurd -abuse -access -accident -account -accuse -achieve -acid -acoustic -acquire -across -act -action -actor -actress -actual -adapt -add -addict -address -adjust -admit -adult -advance -advice -aerobic -affair -afford -afraid -again -age -agent -agree -ahead -aim -air -airport -aisle -alarm -album -alcohol -alert -alien -all -alley -allow -almost -alone -alpha -already -also -alter -always -amateur -amazing -among -amount -amused -analyst -anchor -ancient -anger -angle -angry -animal -ankle -announce -annual -another -answer -antenna -antique -anxiety -any -apart -apology -appear -apple -approve -april -arch -arctic -area -arena -argue -arm -armed -armor -army -around -arrange -arrest -arrive -arrow -art -artefact -artist -artwork -ask -aspect -assault -asset -assist -assume -asthma -athlete -atom -attack -attend -attitude -attract -auction -audit -august -aunt -author -auto -autumn -average -avocado -avoid -awake -aware -away -awesome -awful -awkward -axis -baby -bachelor -bacon -badge -bag -balance -balcony -ball -bamboo -banana -banner -bar -barely -bargain -barrel -base -basic -basket -battle -beach -bean -beauty -because -become -beef -before -begin -behave -behind -believe -below -belt -bench -benefit -best -betray -better -between -beyond -bicycle -bid -bike -bind -biology -bird -birth -bitter -black -blade -blame -blanket -blast -bleak -bless -blind -blood -blossom -blouse -blue -blur -blush -board -boat -body -boil -bomb -bone -bonus -book -boost -border -boring -borrow -boss -bottom -bounce -box -boy -bracket -brain -brand -brass -brave -bread -breeze -brick -bridge -brief -bright -bring -brisk -broccoli -broken -bronze -broom -brother -brown -brush -bubble -buddy -budget -buffalo -build -bulb -bulk -bullet -bundle -bunker -burden -burger -burst -bus -business -busy -butter -buyer -buzz -cabbage -cabin -cable -cactus -cage -cake -call -calm -camera -camp -can -canal -cancel -candy -cannon -canoe -canvas -canyon -capable -capital -captain -car -carbon -card -cargo -carpet -carry -cart -case -cash -casino -castle -casual -cat -catalog -catch -category -cattle -caught -cause -caution -cave -ceiling -celery -cement -census -century -cereal -certain -chair -chalk -champion -change -chaos -chapter -charge -chase -chat -cheap -check -cheese -chef -cherry -chest -chicken -chief -child -chimney -choice -choose -chronic -chuckle -chunk -churn -cigar -cinnamon -circle -citizen -city -civil -claim -clap -clarify -claw -clay -clean -clerk -clever -click -client -cliff -climb -clinic -clip -clock -clog -close -cloth -cloud -clown -club -clump -cluster -clutch -coach -coast -coconut -code -coffee -coil -coin -collect -color -column -combine -come -comfort -comic -common -company -concert -conduct -confirm -congress -connect -consider -control -convince -cook -cool -copper -copy -coral -core -corn -correct -cost -cotton -couch -country -couple -course -cousin -cover -coyote -crack -cradle -craft -cram -crane -crash -crater -crawl -crazy -cream -credit -creek -crew -cricket -crime -crisp -critic -crop -cross -crouch -crowd -crucial -cruel -cruise -crumble -crunch -crush -cry -crystal -cube -culture -cup -cupboard -curious -current -curtain -curve -cushion -custom -cute -cycle -dad -damage -damp -dance -danger -daring -dash -daughter -dawn -day -deal -debate -debris -decade -december -decide -decline -decorate -decrease -deer -defense -define -defy -degree -delay -deliver -demand -demise -denial -dentist -deny -depart -depend -deposit -depth -deputy -derive -describe -desert -design -desk -despair -destroy -detail -detect -develop -device -devote -diagram -dial -diamond -diary -dice -diesel -diet -differ -digital -dignity -dilemma -dinner -dinosaur -direct -dirt -disagree -discover -disease -dish -dismiss -disorder -display -distance -divert -divide -divorce -dizzy -doctor -document -dog -doll -dolphin -domain -donate -donkey -donor -door -dose -double -dove -draft -dragon -drama -drastic -draw -dream -dress -drift -drill -drink -drip -drive -drop -drum -dry -duck -dumb -dune -during -dust -dutch -duty -dwarf -dynamic -eager -eagle -early -earn -earth -easily -east -easy -echo -ecology -economy -edge -edit -educate -effort -egg -eight -either -elbow -elder -electric -elegant -element -elephant -elevator -elite -else -embark -embody -embrace -emerge -emotion -employ -empower -empty -enable -enact -end -endless -endorse -enemy -energy -enforce -engage -engine -enhance -enjoy -enlist -enough -enrich -enroll -ensure -enter -entire -entry -envelope -episode -equal -equip -era -erase -erode -erosion -error -erupt -escape -essay -essence -estate -eternal -ethics -evidence -evil -evoke -evolve -exact -example -excess -exchange -excite -exclude -excuse -execute -exercise -exhaust -exhibit -exile -exist -exit -exotic -expand -expect -expire -explain -expose -express -extend -extra -eye -eyebrow -fabric -face -faculty -fade -faint -faith -fall -false -fame -family -famous -fan -fancy -fantasy -farm -fashion -fat -fatal -father -fatigue -fault -favorite -feature -february -federal -fee -feed -feel -female -fence -festival -fetch -fever -few -fiber -fiction -field -figure -file -film -filter -final -find -fine -finger -finish -fire -firm -first -fiscal -fish -fit -fitness -fix -flag -flame -flash -flat -flavor -flee -flight -flip -float -flock -floor -flower -fluid -flush -fly -foam -focus -fog -foil -fold -follow -food -foot -force -forest -forget -fork -fortune -forum -forward -fossil -foster -found -fox -fragile -frame -frequent -fresh -friend -fringe -frog -front -frost -frown -frozen -fruit -fuel -fun -funny -furnace -fury -future -gadget -gain -galaxy -gallery -game -gap -garage -garbage -garden -garlic -garment -gas -gasp -gate -gather -gauge -gaze -general -genius -genre -gentle -genuine -gesture -ghost -giant -gift -giggle -ginger -giraffe -girl -give -glad -glance -glare -glass -glide -glimpse -globe -gloom -glory -glove -glow -glue -goat -goddess -gold -good -goose -gorilla -gospel -gossip -govern -gown -grab -grace -grain -grant -grape -grass -gravity -great -green -grid -grief -grit -grocery -group -grow -grunt -guard -guess -guide -guilt -guitar -gun -gym -habit -hair -half -hammer -hamster -hand -happy -harbor -hard -harsh -harvest -hat -have -hawk -hazard -head -health -heart -heavy -hedgehog -height -hello -helmet -help -hen -hero -hidden -high -hill -hint -hip -hire -history -hobby -hockey -hold -hole -holiday -hollow -home -honey -hood -hope -horn -horror -horse -hospital -host -hotel -hour -hover -hub -huge -human -humble -humor -hundred -hungry -hunt -hurdle -hurry -hurt -husband -hybrid -ice -icon -idea -identify -idle -ignore -ill -illegal -illness -image -imitate -immense -immune -impact -impose -improve -impulse -inch -include -income -increase -index -indicate -indoor -industry -infant -inflict -inform -inhale -inherit -initial -inject -injury -inmate -inner -innocent -input -inquiry -insane -insect -inside -inspire -install -intact -interest -into -invest -invite -involve -iron -island -isolate -issue -item -ivory -jacket -jaguar -jar -jazz -jealous -jeans -jelly -jewel -job -join -joke -journey -joy -judge -juice -jump -jungle -junior -junk -just -kangaroo -keen -keep -ketchup -key -kick -kid -kidney -kind -kingdom -kiss -kit -kitchen -kite -kitten -kiwi -knee -knife -knock -know -lab -label -labor -ladder -lady -lake -lamp -language -laptop -large -later -latin -laugh -laundry -lava -law -lawn -lawsuit -layer -lazy -leader -leaf -learn -leave -lecture -left -leg -legal -legend -leisure -lemon -lend -length -lens -leopard -lesson -letter -level -liar -liberty -library -license -life -lift -light -like -limb -limit -link -lion -liquid -list -little -live -lizard -load -loan -lobster -local -lock -logic -lonely -long -loop -lottery -loud -lounge -love -loyal -lucky -luggage -lumber -lunar -lunch -luxury -lyrics -machine -mad -magic -magnet -maid -mail -main -major -make -mammal -man -manage -mandate -mango -mansion -manual -maple -marble -march -margin -marine -market -marriage -mask -mass -master -match -material -math -matrix -matter -maximum -maze -meadow -mean -measure -meat -mechanic -medal -media -melody -melt -member -memory -mention -menu -mercy -merge -merit -merry -mesh -message -metal -method -middle -midnight -milk -million -mimic -mind -minimum -minor -minute -miracle -mirror -misery -miss -mistake -mix -mixed -mixture -mobile -model -modify -mom -moment -monitor -monkey -monster -month -moon -moral -more -morning -mosquito -mother -motion -motor -mountain -mouse -move -movie -much -muffin -mule -multiply -muscle -museum -mushroom -music -must -mutual -myself -mystery -myth -naive -name -napkin -narrow -nasty -nation -nature -near -neck -need -negative -neglect -neither -nephew -nerve -nest -net -network -neutral -never -news -next -nice -night -noble -noise -nominee -noodle -normal -north -nose -notable -note -nothing -notice -novel -now -nuclear -number -nurse -nut -oak -obey -object -oblige -obscure -observe -obtain -obvious -occur -ocean -october -odor -off -offer -office -often -oil -okay -old -olive -olympic -omit -once -one -onion -online -only -open -opera -opinion -oppose -option -orange -orbit -orchard -order -ordinary -organ -orient -original -orphan -ostrich -other -outdoor -outer -output -outside -oval -oven -over -own -owner -oxygen -oyster -ozone -pact -paddle -page -pair -palace -palm -panda -panel -panic -panther -paper -parade -parent -park -parrot -party -pass -patch -path -patient -patrol -pattern -pause -pave -payment -peace -peanut -pear -peasant -pelican -pen -penalty -pencil -people -pepper -perfect -permit -person -pet -phone -photo -phrase -physical -piano -picnic -picture -piece -pig -pigeon -pill -pilot -pink -pioneer -pipe -pistol -pitch -pizza -place -planet -plastic -plate -play -please -pledge -pluck -plug -plunge -poem -poet -point -polar -pole -police -pond -pony -pool -popular -portion -position -possible -post -potato -pottery -poverty -powder -power -practice -praise -predict -prefer -prepare -present -pretty -prevent -price -pride -primary -print -priority -prison -private -prize -problem -process -produce -profit -program -project -promote -proof -property -prosper -protect -proud -provide -public -pudding -pull -pulp -pulse -pumpkin -punch -pupil -puppy -purchase -purity -purpose -purse -push -put -puzzle -pyramid -quality -quantum -quarter -question -quick -quit -quiz -quote -rabbit -raccoon -race -rack -radar -radio -rail -rain -raise -rally -ramp -ranch -random -range -rapid -rare -rate -rather -raven -raw -razor -ready -real -reason -rebel -rebuild -recall -receive -recipe -record -recycle -reduce -reflect -reform -refuse -region -regret -regular -reject -relax -release -relief -rely -remain -remember -remind -remove -render -renew -rent -reopen -repair -repeat -replace -report -require -rescue -resemble -resist -resource -response -result -retire -retreat -return -reunion -reveal -review -reward -rhythm -rib -ribbon -rice -rich -ride -ridge -rifle -right -rigid -ring -riot -ripple -risk -ritual -rival -river -road -roast -robot -robust -rocket -romance -roof -rookie -room -rose -rotate -rough -round -route -royal -rubber -rude -rug -rule -run -runway -rural -sad -saddle -sadness -safe -sail -salad -salmon -salon -salt -salute -same -sample -sand -satisfy -satoshi -sauce -sausage -save -say -scale -scan -scare -scatter -scene -scheme -school -science -scissors -scorpion -scout -scrap -screen -script -scrub -sea -search -season -seat -second -secret -section -security -seed -seek -segment -select -sell -seminar -senior -sense -sentence -series -service -session -settle -setup -seven -shadow -shaft -shallow -share -shed -shell -sheriff -shield -shift -shine -ship -shiver -shock -shoe -shoot -shop -short -shoulder -shove -shrimp -shrug -shuffle -shy -sibling -sick -side -siege -sight -sign -silent -silk -silly -silver -similar -simple -since -sing -siren -sister -situate -six -size -skate -sketch -ski -skill -skin -skirt -skull -slab -slam -sleep -slender -slice -slide -slight -slim -slogan -slot -slow -slush -small -smart -smile -smoke -smooth -snack -snake -snap -sniff -snow -soap -soccer -social -sock -soda -soft -solar -soldier -solid -solution -solve -someone -song -soon -sorry -sort -soul -sound -soup -source -south -space -spare -spatial -spawn -speak -special -speed -spell -spend -sphere -spice -spider -spike -spin -spirit -split -spoil -sponsor -spoon -sport -spot -spray -spread -spring -spy -square -squeeze -squirrel -stable -stadium -staff -stage -stairs -stamp -stand -start -state -stay -steak -steel -stem -step -stereo -stick -still -sting -stock -stomach -stone -stool -story -stove -strategy -street -strike -strong -struggle -student -stuff -stumble -style -subject -submit -subway -success -such -sudden -suffer -sugar -suggest -suit -summer -sun -sunny -sunset -super -supply -supreme -sure -surface -surge -surprise -surround -survey -suspect -sustain -swallow -swamp -swap -swarm -swear -sweet -swift -swim -swing -switch -sword -symbol -symptom -syrup -system -table -tackle -tag -tail -talent -talk -tank -tape -target -task -taste -tattoo -taxi -teach -team -tell -ten -tenant -tennis -tent -term -test -text -thank -that -theme -then -theory -there -they -thing -this -thought -three -thrive -throw -thumb -thunder -ticket -tide -tiger -tilt -timber -time -tiny -tip -tired -tissue -title -toast -tobacco -today -toddler -toe -together -toilet -token -tomato -tomorrow -tone -tongue -tonight -tool -tooth -top -topic -topple -torch -tornado -tortoise -toss -total -tourist -toward -tower -town -toy -track -trade -traffic -tragic -train -transfer -trap -trash -travel -tray -treat -tree -trend -trial -tribe -trick -trigger -trim -trip -trophy -trouble -truck -true -truly -trumpet -trust -truth -try -tube -tuition -tumble -tuna -tunnel -turkey -turn -turtle -twelve -twenty -twice -twin -twist -two -type -typical -ugly -umbrella -unable -unaware -uncle -uncover -under -undo -unfair -unfold -unhappy -uniform -unique -unit -universe -unknown -unlock -until -unusual -unveil -update -upgrade -uphold -upon -upper -upset -urban -urge -usage -use -used -useful -useless -usual -utility -vacant -vacuum -vague -valid -valley -valve -van -vanish -vapor -various -vast -vault -vehicle -velvet -vendor -venture -venue -verb -verify -version -very -vessel -veteran -viable -vibrant -vicious -victory -video -view -village -vintage -violin -virtual -virus -visa -visit -visual -vital -vivid -vocal -voice -void -volcano -volume -vote -voyage -wage -wagon -wait -walk -wall -walnut -want -warfare -warm -warrior -wash -wasp -waste -water -wave -way -wealth -weapon -wear -weasel -weather -web -wedding -weekend -weird -welcome -west -wet -whale -what -wheat -wheel -when -where -whip -whisper -wide -width -wife -wild -will -win -window -wine -wing -wink -winner -winter -wire -wisdom -wise -wish -witness -wolf -woman -wonder -wood -wool -word -work -world -worry -worth -wrap -wreck -wrestle -wrist -write -wrong -yard -year -yellow -you -young -youth -zebra -zero -zone -zoo`.split("\n"); - } - }); - - // node_modules/@scure/bip39/node_modules/@noble/hashes/_assert.js - var require_assert = __commonJS({ - "node_modules/@scure/bip39/node_modules/@noble/hashes/_assert.js"(exports) { - "use strict"; - init_define_process(); - Object.defineProperty(exports, "__esModule", { value: true }); - exports.output = exports.exists = exports.hash = exports.bytes = exports.bool = exports.number = void 0; - function number2(n) { - if (!Number.isSafeInteger(n) || n < 0) - throw new Error(`Wrong positive integer: ${n}`); - } - exports.number = number2; - function bool2(b) { - if (typeof b !== "boolean") - throw new Error(`Expected boolean, not ${b}`); - } - exports.bool = bool2; - function bytes2(b, ...lengths) { - if (!(b instanceof Uint8Array)) - throw new TypeError("Expected Uint8Array"); - if (lengths.length > 0 && !lengths.includes(b.length)) - throw new TypeError(`Expected Uint8Array of length ${lengths}, not of length=${b.length}`); - } - exports.bytes = bytes2; - function hash2(hash3) { - if (typeof hash3 !== "function" || typeof hash3.create !== "function") - throw new Error("Hash should be wrapped by utils.wrapConstructor"); - number2(hash3.outputLen); - number2(hash3.blockLen); - } - exports.hash = hash2; - function exists2(instance, checkFinished = true) { - if (instance.destroyed) - throw new Error("Hash instance has been destroyed"); - if (checkFinished && instance.finished) - throw new Error("Hash#digest() has already been called"); - } - exports.exists = exists2; - function output2(out, instance) { - bytes2(out); - const min = instance.outputLen; - if (out.length < min) { - throw new Error(`digestInto() expects output buffer of length at least ${min}`); - } - } - exports.output = output2; - var assert2 = { - number: number2, - bool: bool2, - bytes: bytes2, - hash: hash2, - exists: exists2, - output: output2 - }; - exports.default = assert2; - } - }); - - // node_modules/@scure/bip39/node_modules/@noble/hashes/cryptoBrowser.js - var require_cryptoBrowser = __commonJS({ - "node_modules/@scure/bip39/node_modules/@noble/hashes/cryptoBrowser.js"(exports) { - "use strict"; - init_define_process(); - Object.defineProperty(exports, "__esModule", { value: true }); - exports.crypto = void 0; - exports.crypto = { - node: void 0, - web: typeof self === "object" && "crypto" in self ? self.crypto : void 0 - }; - } - }); - - // node_modules/@scure/bip39/node_modules/@noble/hashes/utils.js - var require_utils = __commonJS({ - "node_modules/@scure/bip39/node_modules/@noble/hashes/utils.js"(exports) { - "use strict"; - init_define_process(); - Object.defineProperty(exports, "__esModule", { value: true }); - exports.randomBytes = exports.wrapConstructorWithOpts = exports.wrapConstructor = exports.checkOpts = exports.Hash = exports.concatBytes = exports.toBytes = exports.utf8ToBytes = exports.asyncLoop = exports.nextTick = exports.hexToBytes = exports.bytesToHex = exports.isLE = exports.rotr = exports.createView = exports.u32 = exports.u8 = void 0; - var crypto_1 = require_cryptoBrowser(); - var u8 = (arr) => new Uint8Array(arr.buffer, arr.byteOffset, arr.byteLength); - exports.u8 = u8; - var u32 = (arr) => new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4)); - exports.u32 = u32; - var createView3 = (arr) => new DataView(arr.buffer, arr.byteOffset, arr.byteLength); - exports.createView = createView3; - var rotr3 = (word, shift) => word << 32 - shift | word >>> shift; - exports.rotr = rotr3; - exports.isLE = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68; - if (!exports.isLE) - throw new Error("Non little-endian hardware is not supported"); - var hexes5 = Array.from({ length: 256 }, (v, i) => i.toString(16).padStart(2, "0")); - function bytesToHex4(uint8a) { - if (!(uint8a instanceof Uint8Array)) - throw new Error("Uint8Array expected"); - let hex2 = ""; - for (let i = 0; i < uint8a.length; i++) { - hex2 += hexes5[uint8a[i]]; - } - return hex2; - } - exports.bytesToHex = bytesToHex4; - function hexToBytes4(hex2) { - if (typeof hex2 !== "string") { - throw new TypeError("hexToBytes: expected string, got " + typeof hex2); - } - if (hex2.length % 2) - throw new Error("hexToBytes: received invalid unpadded hex"); - const array = new Uint8Array(hex2.length / 2); - for (let i = 0; i < array.length; i++) { - const j = i * 2; - const hexByte = hex2.slice(j, j + 2); - const byte = Number.parseInt(hexByte, 16); - if (Number.isNaN(byte) || byte < 0) - throw new Error("Invalid byte sequence"); - array[i] = byte; - } - return array; - } - exports.hexToBytes = hexToBytes4; - var nextTick2 = async () => { - }; - exports.nextTick = nextTick2; - async function asyncLoop(iters, tick, cb) { - let ts = Date.now(); - for (let i = 0; i < iters; i++) { - cb(i); - const diff = Date.now() - ts; - if (diff >= 0 && diff < tick) - continue; - await (0, exports.nextTick)(); - ts += diff; - } - } - exports.asyncLoop = asyncLoop; - function utf8ToBytes3(str) { - if (typeof str !== "string") { - throw new TypeError(`utf8ToBytes expected string, got ${typeof str}`); - } - return new TextEncoder().encode(str); - } - exports.utf8ToBytes = utf8ToBytes3; - function toBytes3(data) { - if (typeof data === "string") - data = utf8ToBytes3(data); - if (!(data instanceof Uint8Array)) - throw new TypeError(`Expected input type is Uint8Array (got ${typeof data})`); - return data; - } - exports.toBytes = toBytes3; - function concatBytes4(...arrays) { - if (!arrays.every((a) => a instanceof Uint8Array)) - throw new Error("Uint8Array list expected"); - if (arrays.length === 1) - return arrays[0]; - const length = arrays.reduce((a, arr) => a + arr.length, 0); - const result = new Uint8Array(length); - for (let i = 0, pad = 0; i < arrays.length; i++) { - const arr = arrays[i]; - result.set(arr, pad); - pad += arr.length; - } - return result; - } - exports.concatBytes = concatBytes4; - var Hash3 = class { - clone() { - return this._cloneInto(); - } - }; - exports.Hash = Hash3; - var isPlainObject = (obj) => Object.prototype.toString.call(obj) === "[object Object]" && obj.constructor === Object; - function checkOpts(defaults, opts) { - if (opts !== void 0 && (typeof opts !== "object" || !isPlainObject(opts))) - throw new TypeError("Options should be object or undefined"); - const merged = Object.assign(defaults, opts); - return merged; - } - exports.checkOpts = checkOpts; - function wrapConstructor3(hashConstructor) { - const hashC = (message) => hashConstructor().update(toBytes3(message)).digest(); - const tmp = hashConstructor(); - hashC.outputLen = tmp.outputLen; - hashC.blockLen = tmp.blockLen; - hashC.create = () => hashConstructor(); - return hashC; - } - exports.wrapConstructor = wrapConstructor3; - function wrapConstructorWithOpts(hashCons) { - const hashC = (msg, opts) => hashCons(opts).update(toBytes3(msg)).digest(); - const tmp = hashCons({}); - hashC.outputLen = tmp.outputLen; - hashC.blockLen = tmp.blockLen; - hashC.create = (opts) => hashCons(opts); - return hashC; - } - exports.wrapConstructorWithOpts = wrapConstructorWithOpts; - function randomBytes2(bytesLength = 32) { - if (crypto_1.crypto.web) { - return crypto_1.crypto.web.getRandomValues(new Uint8Array(bytesLength)); - } else if (crypto_1.crypto.node) { - return new Uint8Array(crypto_1.crypto.node.randomBytes(bytesLength).buffer); - } else { - throw new Error("The environment doesn't have randomBytes function"); - } - } - exports.randomBytes = randomBytes2; - } - }); - - // node_modules/@scure/bip39/node_modules/@noble/hashes/hmac.js - var require_hmac = __commonJS({ - "node_modules/@scure/bip39/node_modules/@noble/hashes/hmac.js"(exports) { - "use strict"; - init_define_process(); - Object.defineProperty(exports, "__esModule", { value: true }); - exports.hmac = void 0; - var _assert_js_1 = require_assert(); - var utils_js_1 = require_utils(); - var HMAC3 = class extends utils_js_1.Hash { - constructor(hash2, _key) { - super(); - this.finished = false; - this.destroyed = false; - _assert_js_1.default.hash(hash2); - const key = (0, utils_js_1.toBytes)(_key); - this.iHash = hash2.create(); - if (typeof this.iHash.update !== "function") - throw new TypeError("Expected instance of class which extends utils.Hash"); - this.blockLen = this.iHash.blockLen; - this.outputLen = this.iHash.outputLen; - const blockLen = this.blockLen; - const pad = new Uint8Array(blockLen); - pad.set(key.length > blockLen ? hash2.create().update(key).digest() : key); - for (let i = 0; i < pad.length; i++) - pad[i] ^= 54; - this.iHash.update(pad); - this.oHash = hash2.create(); - for (let i = 0; i < pad.length; i++) - pad[i] ^= 54 ^ 92; - this.oHash.update(pad); - pad.fill(0); - } - update(buf) { - _assert_js_1.default.exists(this); - this.iHash.update(buf); - return this; - } - digestInto(out) { - _assert_js_1.default.exists(this); - _assert_js_1.default.bytes(out, this.outputLen); - this.finished = true; - this.iHash.digestInto(out); - this.oHash.update(out); - this.oHash.digestInto(out); - this.destroy(); - } - digest() { - const out = new Uint8Array(this.oHash.outputLen); - this.digestInto(out); - return out; - } - _cloneInto(to) { - to || (to = Object.create(Object.getPrototypeOf(this), {})); - const { oHash, iHash, finished, destroyed, blockLen, outputLen } = this; - to = to; - to.finished = finished; - to.destroyed = destroyed; - to.blockLen = blockLen; - to.outputLen = outputLen; - to.oHash = oHash._cloneInto(to.oHash); - to.iHash = iHash._cloneInto(to.iHash); - return to; - } - destroy() { - this.destroyed = true; - this.oHash.destroy(); - this.iHash.destroy(); - } - }; - var hmac3 = (hash2, key, message) => new HMAC3(hash2, key).update(message).digest(); - exports.hmac = hmac3; - exports.hmac.create = (hash2, key) => new HMAC3(hash2, key); - } - }); - - // node_modules/@scure/bip39/node_modules/@noble/hashes/pbkdf2.js - var require_pbkdf2 = __commonJS({ - "node_modules/@scure/bip39/node_modules/@noble/hashes/pbkdf2.js"(exports) { - "use strict"; - init_define_process(); - Object.defineProperty(exports, "__esModule", { value: true }); - exports.pbkdf2Async = exports.pbkdf2 = void 0; - var _assert_js_1 = require_assert(); - var hmac_js_1 = require_hmac(); - var utils_js_1 = require_utils(); - function pbkdf2Init(hash2, _password, _salt, _opts) { - _assert_js_1.default.hash(hash2); - const opts = (0, utils_js_1.checkOpts)({ dkLen: 32, asyncTick: 10 }, _opts); - const { c, dkLen, asyncTick } = opts; - _assert_js_1.default.number(c); - _assert_js_1.default.number(dkLen); - _assert_js_1.default.number(asyncTick); - if (c < 1) - throw new Error("PBKDF2: iterations (c) should be >= 1"); - const password = (0, utils_js_1.toBytes)(_password); - const salt = (0, utils_js_1.toBytes)(_salt); - const DK = new Uint8Array(dkLen); - const PRF = hmac_js_1.hmac.create(hash2, password); - const PRFSalt = PRF._cloneInto().update(salt); - return { c, dkLen, asyncTick, DK, PRF, PRFSalt }; - } - function pbkdf2Output(PRF, PRFSalt, DK, prfW, u) { - PRF.destroy(); - PRFSalt.destroy(); - if (prfW) - prfW.destroy(); - u.fill(0); - return DK; - } - function pbkdf2(hash2, password, salt, opts) { - const { c, dkLen, DK, PRF, PRFSalt } = pbkdf2Init(hash2, password, salt, opts); - let prfW; - const arr = new Uint8Array(4); - const view = (0, utils_js_1.createView)(arr); - const u = new Uint8Array(PRF.outputLen); - for (let ti = 1, pos = 0; pos < dkLen; ti++, pos += PRF.outputLen) { - const Ti = DK.subarray(pos, pos + PRF.outputLen); - view.setInt32(0, ti, false); - (prfW = PRFSalt._cloneInto(prfW)).update(arr).digestInto(u); - Ti.set(u.subarray(0, Ti.length)); - for (let ui = 1; ui < c; ui++) { - PRF._cloneInto(prfW).update(u).digestInto(u); - for (let i = 0; i < Ti.length; i++) - Ti[i] ^= u[i]; - } - } - return pbkdf2Output(PRF, PRFSalt, DK, prfW, u); - } - exports.pbkdf2 = pbkdf2; - async function pbkdf2Async(hash2, password, salt, opts) { - const { c, dkLen, asyncTick, DK, PRF, PRFSalt } = pbkdf2Init(hash2, password, salt, opts); - let prfW; - const arr = new Uint8Array(4); - const view = (0, utils_js_1.createView)(arr); - const u = new Uint8Array(PRF.outputLen); - for (let ti = 1, pos = 0; pos < dkLen; ti++, pos += PRF.outputLen) { - const Ti = DK.subarray(pos, pos + PRF.outputLen); - view.setInt32(0, ti, false); - (prfW = PRFSalt._cloneInto(prfW)).update(arr).digestInto(u); - Ti.set(u.subarray(0, Ti.length)); - await (0, utils_js_1.asyncLoop)(c - 1, asyncTick, (i) => { - PRF._cloneInto(prfW).update(u).digestInto(u); - for (let i2 = 0; i2 < Ti.length; i2++) - Ti[i2] ^= u[i2]; - }); - } - return pbkdf2Output(PRF, PRFSalt, DK, prfW, u); - } - exports.pbkdf2Async = pbkdf2Async; - } - }); - - // node_modules/@scure/bip39/node_modules/@noble/hashes/_sha2.js - var require_sha2 = __commonJS({ - "node_modules/@scure/bip39/node_modules/@noble/hashes/_sha2.js"(exports) { - "use strict"; - init_define_process(); - Object.defineProperty(exports, "__esModule", { value: true }); - exports.SHA2 = void 0; - var _assert_js_1 = require_assert(); - var utils_js_1 = require_utils(); - function setBigUint643(view, byteOffset, value, isLE3) { - if (typeof view.setBigUint64 === "function") - return view.setBigUint64(byteOffset, value, isLE3); - const _32n2 = BigInt(32); - const _u32_max = BigInt(4294967295); - const wh = Number(value >> _32n2 & _u32_max); - const wl = Number(value & _u32_max); - const h = isLE3 ? 4 : 0; - const l = isLE3 ? 0 : 4; - view.setUint32(byteOffset + h, wh, isLE3); - view.setUint32(byteOffset + l, wl, isLE3); - } - var SHA23 = class extends utils_js_1.Hash { - constructor(blockLen, outputLen, padOffset, isLE3) { - super(); - this.blockLen = blockLen; - this.outputLen = outputLen; - this.padOffset = padOffset; - this.isLE = isLE3; - this.finished = false; - this.length = 0; - this.pos = 0; - this.destroyed = false; - this.buffer = new Uint8Array(blockLen); - this.view = (0, utils_js_1.createView)(this.buffer); - } - update(data) { - _assert_js_1.default.exists(this); - const { view, buffer, blockLen } = this; - data = (0, utils_js_1.toBytes)(data); - const len = data.length; - for (let pos = 0; pos < len; ) { - const take = Math.min(blockLen - this.pos, len - pos); - if (take === blockLen) { - const dataView = (0, utils_js_1.createView)(data); - for (; blockLen <= len - pos; pos += blockLen) - this.process(dataView, pos); - continue; - } - buffer.set(data.subarray(pos, pos + take), this.pos); - this.pos += take; - pos += take; - if (this.pos === blockLen) { - this.process(view, 0); - this.pos = 0; - } - } - this.length += data.length; - this.roundClean(); - return this; - } - digestInto(out) { - _assert_js_1.default.exists(this); - _assert_js_1.default.output(out, this); - this.finished = true; - const { buffer, view, blockLen, isLE: isLE3 } = this; - let { pos } = this; - buffer[pos++] = 128; - this.buffer.subarray(pos).fill(0); - if (this.padOffset > blockLen - pos) { - this.process(view, 0); - pos = 0; - } - for (let i = pos; i < blockLen; i++) - buffer[i] = 0; - setBigUint643(view, blockLen - 8, BigInt(this.length * 8), isLE3); - this.process(view, 0); - const oview = (0, utils_js_1.createView)(out); - const len = this.outputLen; - if (len % 4) - throw new Error("_sha2: outputLen should be aligned to 32bit"); - const outLen = len / 4; - const state = this.get(); - if (outLen > state.length) - throw new Error("_sha2: outputLen bigger than state"); - for (let i = 0; i < outLen; i++) - oview.setUint32(4 * i, state[i], isLE3); - } - digest() { - const { buffer, outputLen } = this; - this.digestInto(buffer); - const res = buffer.slice(0, outputLen); - this.destroy(); - return res; - } - _cloneInto(to) { - to || (to = new this.constructor()); - to.set(...this.get()); - const { blockLen, buffer, length, finished, destroyed, pos } = this; - to.length = length; - to.pos = pos; - to.finished = finished; - to.destroyed = destroyed; - if (length % blockLen) - to.buffer.set(buffer); - return to; - } - }; - exports.SHA2 = SHA23; - } - }); - - // node_modules/@scure/bip39/node_modules/@noble/hashes/sha256.js - var require_sha256 = __commonJS({ - "node_modules/@scure/bip39/node_modules/@noble/hashes/sha256.js"(exports) { - "use strict"; - init_define_process(); - Object.defineProperty(exports, "__esModule", { value: true }); - exports.sha224 = exports.sha256 = void 0; - var _sha2_js_1 = require_sha2(); - var utils_js_1 = require_utils(); - var Chi3 = (a, b, c) => a & b ^ ~a & c; - var Maj3 = (a, b, c) => a & b ^ a & c ^ b & c; - var SHA256_K3 = new Uint32Array([ - 1116352408, - 1899447441, - 3049323471, - 3921009573, - 961987163, - 1508970993, - 2453635748, - 2870763221, - 3624381080, - 310598401, - 607225278, - 1426881987, - 1925078388, - 2162078206, - 2614888103, - 3248222580, - 3835390401, - 4022224774, - 264347078, - 604807628, - 770255983, - 1249150122, - 1555081692, - 1996064986, - 2554220882, - 2821834349, - 2952996808, - 3210313671, - 3336571891, - 3584528711, - 113926993, - 338241895, - 666307205, - 773529912, - 1294757372, - 1396182291, - 1695183700, - 1986661051, - 2177026350, - 2456956037, - 2730485921, - 2820302411, - 3259730800, - 3345764771, - 3516065817, - 3600352804, - 4094571909, - 275423344, - 430227734, - 506948616, - 659060556, - 883997877, - 958139571, - 1322822218, - 1537002063, - 1747873779, - 1955562222, - 2024104815, - 2227730452, - 2361852424, - 2428436474, - 2756734187, - 3204031479, - 3329325298 - ]); - var IV3 = new Uint32Array([ - 1779033703, - 3144134277, - 1013904242, - 2773480762, - 1359893119, - 2600822924, - 528734635, - 1541459225 - ]); - var SHA256_W3 = new Uint32Array(64); - var SHA2563 = class extends _sha2_js_1.SHA2 { - constructor() { - super(64, 32, 8, false); - this.A = IV3[0] | 0; - this.B = IV3[1] | 0; - this.C = IV3[2] | 0; - this.D = IV3[3] | 0; - this.E = IV3[4] | 0; - this.F = IV3[5] | 0; - this.G = IV3[6] | 0; - this.H = IV3[7] | 0; - } - get() { - const { A, B, C, D, E, F, G, H } = this; - return [A, B, C, D, E, F, G, H]; - } - set(A, B, C, D, E, F, G, H) { - this.A = A | 0; - this.B = B | 0; - this.C = C | 0; - this.D = D | 0; - this.E = E | 0; - this.F = F | 0; - this.G = G | 0; - this.H = H | 0; - } - process(view, offset) { - for (let i = 0; i < 16; i++, offset += 4) - SHA256_W3[i] = view.getUint32(offset, false); - for (let i = 16; i < 64; i++) { - const W15 = SHA256_W3[i - 15]; - const W2 = SHA256_W3[i - 2]; - const s0 = (0, utils_js_1.rotr)(W15, 7) ^ (0, utils_js_1.rotr)(W15, 18) ^ W15 >>> 3; - const s1 = (0, utils_js_1.rotr)(W2, 17) ^ (0, utils_js_1.rotr)(W2, 19) ^ W2 >>> 10; - SHA256_W3[i] = s1 + SHA256_W3[i - 7] + s0 + SHA256_W3[i - 16] | 0; - } - let { A, B, C, D, E, F, G, H } = this; - for (let i = 0; i < 64; i++) { - const sigma1 = (0, utils_js_1.rotr)(E, 6) ^ (0, utils_js_1.rotr)(E, 11) ^ (0, utils_js_1.rotr)(E, 25); - const T1 = H + sigma1 + Chi3(E, F, G) + SHA256_K3[i] + SHA256_W3[i] | 0; - const sigma0 = (0, utils_js_1.rotr)(A, 2) ^ (0, utils_js_1.rotr)(A, 13) ^ (0, utils_js_1.rotr)(A, 22); - const T2 = sigma0 + Maj3(A, B, C) | 0; - H = G; - G = F; - F = E; - E = D + T1 | 0; - D = C; - C = B; - B = A; - A = T1 + T2 | 0; - } - A = A + this.A | 0; - B = B + this.B | 0; - C = C + this.C | 0; - D = D + this.D | 0; - E = E + this.E | 0; - F = F + this.F | 0; - G = G + this.G | 0; - H = H + this.H | 0; - this.set(A, B, C, D, E, F, G, H); - } - roundClean() { - SHA256_W3.fill(0); - } - destroy() { - this.set(0, 0, 0, 0, 0, 0, 0, 0); - this.buffer.fill(0); - } - }; - var SHA2242 = class extends SHA2563 { - constructor() { - super(); - this.A = 3238371032 | 0; - this.B = 914150663 | 0; - this.C = 812702999 | 0; - this.D = 4144912697 | 0; - this.E = 4290775857 | 0; - this.F = 1750603025 | 0; - this.G = 1694076839 | 0; - this.H = 3204075428 | 0; - this.outputLen = 28; - } - }; - exports.sha256 = (0, utils_js_1.wrapConstructor)(() => new SHA2563()); - exports.sha224 = (0, utils_js_1.wrapConstructor)(() => new SHA2242()); - } - }); - - // node_modules/@scure/bip39/node_modules/@noble/hashes/_u64.js - var require_u64 = __commonJS({ - "node_modules/@scure/bip39/node_modules/@noble/hashes/_u64.js"(exports) { - "use strict"; - init_define_process(); - Object.defineProperty(exports, "__esModule", { value: true }); - exports.add = exports.toBig = exports.split = exports.fromBig = void 0; - var U32_MASK642 = BigInt(2 ** 32 - 1); - var _32n2 = BigInt(32); - function fromBig2(n, le = false) { - if (le) - return { h: Number(n & U32_MASK642), l: Number(n >> _32n2 & U32_MASK642) }; - return { h: Number(n >> _32n2 & U32_MASK642) | 0, l: Number(n & U32_MASK642) | 0 }; - } - exports.fromBig = fromBig2; - function split2(lst, le = false) { - let Ah = new Uint32Array(lst.length); - let Al = new Uint32Array(lst.length); - for (let i = 0; i < lst.length; i++) { - const { h, l } = fromBig2(lst[i], le); - [Ah[i], Al[i]] = [h, l]; - } - return [Ah, Al]; - } - exports.split = split2; - var toBig2 = (h, l) => BigInt(h >>> 0) << _32n2 | BigInt(l >>> 0); - exports.toBig = toBig2; - var shrSH2 = (h, l, s) => h >>> s; - var shrSL2 = (h, l, s) => h << 32 - s | l >>> s; - var rotrSH2 = (h, l, s) => h >>> s | l << 32 - s; - var rotrSL2 = (h, l, s) => h << 32 - s | l >>> s; - var rotrBH2 = (h, l, s) => h << 64 - s | l >>> s - 32; - var rotrBL2 = (h, l, s) => h >>> s - 32 | l << 64 - s; - var rotr32H2 = (h, l) => l; - var rotr32L2 = (h, l) => h; - var rotlSH2 = (h, l, s) => h << s | l >>> 32 - s; - var rotlSL2 = (h, l, s) => l << s | h >>> 32 - s; - var rotlBH2 = (h, l, s) => l << s - 32 | h >>> 64 - s; - var rotlBL2 = (h, l, s) => h << s - 32 | l >>> 64 - s; - function add2(Ah, Al, Bh, Bl) { - const l = (Al >>> 0) + (Bl >>> 0); - return { h: Ah + Bh + (l / 2 ** 32 | 0) | 0, l: l | 0 }; - } - exports.add = add2; - var add3L2 = (Al, Bl, Cl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0); - var add3H2 = (low, Ah, Bh, Ch) => Ah + Bh + Ch + (low / 2 ** 32 | 0) | 0; - var add4L2 = (Al, Bl, Cl, Dl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0); - var add4H2 = (low, Ah, Bh, Ch, Dh) => Ah + Bh + Ch + Dh + (low / 2 ** 32 | 0) | 0; - var add5L2 = (Al, Bl, Cl, Dl, El) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0) + (El >>> 0); - var add5H2 = (low, Ah, Bh, Ch, Dh, Eh) => Ah + Bh + Ch + Dh + Eh + (low / 2 ** 32 | 0) | 0; - var u642 = { - fromBig: fromBig2, - split: split2, - toBig: exports.toBig, - shrSH: shrSH2, - shrSL: shrSL2, - rotrSH: rotrSH2, - rotrSL: rotrSL2, - rotrBH: rotrBH2, - rotrBL: rotrBL2, - rotr32H: rotr32H2, - rotr32L: rotr32L2, - rotlSH: rotlSH2, - rotlSL: rotlSL2, - rotlBH: rotlBH2, - rotlBL: rotlBL2, - add: add2, - add3L: add3L2, - add3H: add3H2, - add4L: add4L2, - add4H: add4H2, - add5H: add5H2, - add5L: add5L2 - }; - exports.default = u642; - } - }); - - // node_modules/@scure/bip39/node_modules/@noble/hashes/sha512.js - var require_sha512 = __commonJS({ - "node_modules/@scure/bip39/node_modules/@noble/hashes/sha512.js"(exports) { - "use strict"; - init_define_process(); - Object.defineProperty(exports, "__esModule", { value: true }); - exports.sha384 = exports.sha512_256 = exports.sha512_224 = exports.sha512 = exports.SHA512 = void 0; - var _sha2_js_1 = require_sha2(); - var _u64_js_1 = require_u64(); - var utils_js_1 = require_utils(); - var [SHA512_Kh2, SHA512_Kl2] = _u64_js_1.default.split([ - "0x428a2f98d728ae22", - "0x7137449123ef65cd", - "0xb5c0fbcfec4d3b2f", - "0xe9b5dba58189dbbc", - "0x3956c25bf348b538", - "0x59f111f1b605d019", - "0x923f82a4af194f9b", - "0xab1c5ed5da6d8118", - "0xd807aa98a3030242", - "0x12835b0145706fbe", - "0x243185be4ee4b28c", - "0x550c7dc3d5ffb4e2", - "0x72be5d74f27b896f", - "0x80deb1fe3b1696b1", - "0x9bdc06a725c71235", - "0xc19bf174cf692694", - "0xe49b69c19ef14ad2", - "0xefbe4786384f25e3", - "0x0fc19dc68b8cd5b5", - "0x240ca1cc77ac9c65", - "0x2de92c6f592b0275", - "0x4a7484aa6ea6e483", - "0x5cb0a9dcbd41fbd4", - "0x76f988da831153b5", - "0x983e5152ee66dfab", - "0xa831c66d2db43210", - "0xb00327c898fb213f", - "0xbf597fc7beef0ee4", - "0xc6e00bf33da88fc2", - "0xd5a79147930aa725", - "0x06ca6351e003826f", - "0x142929670a0e6e70", - "0x27b70a8546d22ffc", - "0x2e1b21385c26c926", - "0x4d2c6dfc5ac42aed", - "0x53380d139d95b3df", - "0x650a73548baf63de", - "0x766a0abb3c77b2a8", - "0x81c2c92e47edaee6", - "0x92722c851482353b", - "0xa2bfe8a14cf10364", - "0xa81a664bbc423001", - "0xc24b8b70d0f89791", - "0xc76c51a30654be30", - "0xd192e819d6ef5218", - "0xd69906245565a910", - "0xf40e35855771202a", - "0x106aa07032bbd1b8", - "0x19a4c116b8d2d0c8", - "0x1e376c085141ab53", - "0x2748774cdf8eeb99", - "0x34b0bcb5e19b48a8", - "0x391c0cb3c5c95a63", - "0x4ed8aa4ae3418acb", - "0x5b9cca4f7763e373", - "0x682e6ff3d6b2b8a3", - "0x748f82ee5defb2fc", - "0x78a5636f43172f60", - "0x84c87814a1f0ab72", - "0x8cc702081a6439ec", - "0x90befffa23631e28", - "0xa4506cebde82bde9", - "0xbef9a3f7b2c67915", - "0xc67178f2e372532b", - "0xca273eceea26619c", - "0xd186b8c721c0c207", - "0xeada7dd6cde0eb1e", - "0xf57d4f7fee6ed178", - "0x06f067aa72176fba", - "0x0a637dc5a2c898a6", - "0x113f9804bef90dae", - "0x1b710b35131c471b", - "0x28db77f523047d84", - "0x32caab7b40c72493", - "0x3c9ebe0a15c9bebc", - "0x431d67c49c100d4c", - "0x4cc5d4becb3e42b6", - "0x597f299cfc657e2a", - "0x5fcb6fab3ad6faec", - "0x6c44198c4a475817" - ].map((n) => BigInt(n))); - var SHA512_W_H2 = new Uint32Array(80); - var SHA512_W_L2 = new Uint32Array(80); - var SHA5122 = class extends _sha2_js_1.SHA2 { - constructor() { - super(128, 64, 16, false); - this.Ah = 1779033703 | 0; - this.Al = 4089235720 | 0; - this.Bh = 3144134277 | 0; - this.Bl = 2227873595 | 0; - this.Ch = 1013904242 | 0; - this.Cl = 4271175723 | 0; - this.Dh = 2773480762 | 0; - this.Dl = 1595750129 | 0; - this.Eh = 1359893119 | 0; - this.El = 2917565137 | 0; - this.Fh = 2600822924 | 0; - this.Fl = 725511199 | 0; - this.Gh = 528734635 | 0; - this.Gl = 4215389547 | 0; - this.Hh = 1541459225 | 0; - this.Hl = 327033209 | 0; - } - get() { - const { Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this; - return [Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl]; - } - set(Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl) { - this.Ah = Ah | 0; - this.Al = Al | 0; - this.Bh = Bh | 0; - this.Bl = Bl | 0; - this.Ch = Ch | 0; - this.Cl = Cl | 0; - this.Dh = Dh | 0; - this.Dl = Dl | 0; - this.Eh = Eh | 0; - this.El = El | 0; - this.Fh = Fh | 0; - this.Fl = Fl | 0; - this.Gh = Gh | 0; - this.Gl = Gl | 0; - this.Hh = Hh | 0; - this.Hl = Hl | 0; - } - process(view, offset) { - for (let i = 0; i < 16; i++, offset += 4) { - SHA512_W_H2[i] = view.getUint32(offset); - SHA512_W_L2[i] = view.getUint32(offset += 4); - } - for (let i = 16; i < 80; i++) { - const W15h = SHA512_W_H2[i - 15] | 0; - const W15l = SHA512_W_L2[i - 15] | 0; - const s0h = _u64_js_1.default.rotrSH(W15h, W15l, 1) ^ _u64_js_1.default.rotrSH(W15h, W15l, 8) ^ _u64_js_1.default.shrSH(W15h, W15l, 7); - const s0l = _u64_js_1.default.rotrSL(W15h, W15l, 1) ^ _u64_js_1.default.rotrSL(W15h, W15l, 8) ^ _u64_js_1.default.shrSL(W15h, W15l, 7); - const W2h = SHA512_W_H2[i - 2] | 0; - const W2l = SHA512_W_L2[i - 2] | 0; - const s1h = _u64_js_1.default.rotrSH(W2h, W2l, 19) ^ _u64_js_1.default.rotrBH(W2h, W2l, 61) ^ _u64_js_1.default.shrSH(W2h, W2l, 6); - const s1l = _u64_js_1.default.rotrSL(W2h, W2l, 19) ^ _u64_js_1.default.rotrBL(W2h, W2l, 61) ^ _u64_js_1.default.shrSL(W2h, W2l, 6); - const SUMl = _u64_js_1.default.add4L(s0l, s1l, SHA512_W_L2[i - 7], SHA512_W_L2[i - 16]); - const SUMh = _u64_js_1.default.add4H(SUMl, s0h, s1h, SHA512_W_H2[i - 7], SHA512_W_H2[i - 16]); - SHA512_W_H2[i] = SUMh | 0; - SHA512_W_L2[i] = SUMl | 0; - } - let { Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this; - for (let i = 0; i < 80; i++) { - const sigma1h = _u64_js_1.default.rotrSH(Eh, El, 14) ^ _u64_js_1.default.rotrSH(Eh, El, 18) ^ _u64_js_1.default.rotrBH(Eh, El, 41); - const sigma1l = _u64_js_1.default.rotrSL(Eh, El, 14) ^ _u64_js_1.default.rotrSL(Eh, El, 18) ^ _u64_js_1.default.rotrBL(Eh, El, 41); - const CHIh = Eh & Fh ^ ~Eh & Gh; - const CHIl = El & Fl ^ ~El & Gl; - const T1ll = _u64_js_1.default.add5L(Hl, sigma1l, CHIl, SHA512_Kl2[i], SHA512_W_L2[i]); - const T1h = _u64_js_1.default.add5H(T1ll, Hh, sigma1h, CHIh, SHA512_Kh2[i], SHA512_W_H2[i]); - const T1l = T1ll | 0; - const sigma0h = _u64_js_1.default.rotrSH(Ah, Al, 28) ^ _u64_js_1.default.rotrBH(Ah, Al, 34) ^ _u64_js_1.default.rotrBH(Ah, Al, 39); - const sigma0l = _u64_js_1.default.rotrSL(Ah, Al, 28) ^ _u64_js_1.default.rotrBL(Ah, Al, 34) ^ _u64_js_1.default.rotrBL(Ah, Al, 39); - const MAJh = Ah & Bh ^ Ah & Ch ^ Bh & Ch; - const MAJl = Al & Bl ^ Al & Cl ^ Bl & Cl; - Hh = Gh | 0; - Hl = Gl | 0; - Gh = Fh | 0; - Gl = Fl | 0; - Fh = Eh | 0; - Fl = El | 0; - ({ h: Eh, l: El } = _u64_js_1.default.add(Dh | 0, Dl | 0, T1h | 0, T1l | 0)); - Dh = Ch | 0; - Dl = Cl | 0; - Ch = Bh | 0; - Cl = Bl | 0; - Bh = Ah | 0; - Bl = Al | 0; - const All = _u64_js_1.default.add3L(T1l, sigma0l, MAJl); - Ah = _u64_js_1.default.add3H(All, T1h, sigma0h, MAJh); - Al = All | 0; - } - ({ h: Ah, l: Al } = _u64_js_1.default.add(this.Ah | 0, this.Al | 0, Ah | 0, Al | 0)); - ({ h: Bh, l: Bl } = _u64_js_1.default.add(this.Bh | 0, this.Bl | 0, Bh | 0, Bl | 0)); - ({ h: Ch, l: Cl } = _u64_js_1.default.add(this.Ch | 0, this.Cl | 0, Ch | 0, Cl | 0)); - ({ h: Dh, l: Dl } = _u64_js_1.default.add(this.Dh | 0, this.Dl | 0, Dh | 0, Dl | 0)); - ({ h: Eh, l: El } = _u64_js_1.default.add(this.Eh | 0, this.El | 0, Eh | 0, El | 0)); - ({ h: Fh, l: Fl } = _u64_js_1.default.add(this.Fh | 0, this.Fl | 0, Fh | 0, Fl | 0)); - ({ h: Gh, l: Gl } = _u64_js_1.default.add(this.Gh | 0, this.Gl | 0, Gh | 0, Gl | 0)); - ({ h: Hh, l: Hl } = _u64_js_1.default.add(this.Hh | 0, this.Hl | 0, Hh | 0, Hl | 0)); - this.set(Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl); - } - roundClean() { - SHA512_W_H2.fill(0); - SHA512_W_L2.fill(0); - } - destroy() { - this.buffer.fill(0); - this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); - } - }; - exports.SHA512 = SHA5122; - var SHA512_2242 = class extends SHA5122 { - constructor() { - super(); - this.Ah = 2352822216 | 0; - this.Al = 424955298 | 0; - this.Bh = 1944164710 | 0; - this.Bl = 2312950998 | 0; - this.Ch = 502970286 | 0; - this.Cl = 855612546 | 0; - this.Dh = 1738396948 | 0; - this.Dl = 1479516111 | 0; - this.Eh = 258812777 | 0; - this.El = 2077511080 | 0; - this.Fh = 2011393907 | 0; - this.Fl = 79989058 | 0; - this.Gh = 1067287976 | 0; - this.Gl = 1780299464 | 0; - this.Hh = 286451373 | 0; - this.Hl = 2446758561 | 0; - this.outputLen = 28; - } - }; - var SHA512_2562 = class extends SHA5122 { - constructor() { - super(); - this.Ah = 573645204 | 0; - this.Al = 4230739756 | 0; - this.Bh = 2673172387 | 0; - this.Bl = 3360449730 | 0; - this.Ch = 596883563 | 0; - this.Cl = 1867755857 | 0; - this.Dh = 2520282905 | 0; - this.Dl = 1497426621 | 0; - this.Eh = 2519219938 | 0; - this.El = 2827943907 | 0; - this.Fh = 3193839141 | 0; - this.Fl = 1401305490 | 0; - this.Gh = 721525244 | 0; - this.Gl = 746961066 | 0; - this.Hh = 246885852 | 0; - this.Hl = 2177182882 | 0; - this.outputLen = 32; - } - }; - var SHA3842 = class extends SHA5122 { - constructor() { - super(); - this.Ah = 3418070365 | 0; - this.Al = 3238371032 | 0; - this.Bh = 1654270250 | 0; - this.Bl = 914150663 | 0; - this.Ch = 2438529370 | 0; - this.Cl = 812702999 | 0; - this.Dh = 355462360 | 0; - this.Dl = 4144912697 | 0; - this.Eh = 1731405415 | 0; - this.El = 4290775857 | 0; - this.Fh = 2394180231 | 0; - this.Fl = 1750603025 | 0; - this.Gh = 3675008525 | 0; - this.Gl = 1694076839 | 0; - this.Hh = 1203062813 | 0; - this.Hl = 3204075428 | 0; - this.outputLen = 48; - } - }; - exports.sha512 = (0, utils_js_1.wrapConstructor)(() => new SHA5122()); - exports.sha512_224 = (0, utils_js_1.wrapConstructor)(() => new SHA512_2242()); - exports.sha512_256 = (0, utils_js_1.wrapConstructor)(() => new SHA512_2562()); - exports.sha384 = (0, utils_js_1.wrapConstructor)(() => new SHA3842()); - } - }); - - // node_modules/@scure/base/lib/index.js - var require_lib = __commonJS({ - "node_modules/@scure/base/lib/index.js"(exports) { - "use strict"; - init_define_process(); - Object.defineProperty(exports, "__esModule", { value: true }); - exports.bytes = exports.stringToBytes = exports.str = exports.bytesToString = exports.hex = exports.utf8 = exports.bech32m = exports.bech32 = exports.base58check = exports.base58xmr = exports.base58xrp = exports.base58flickr = exports.base58 = exports.base64url = exports.base64 = exports.base32crockford = exports.base32hex = exports.base32 = exports.base16 = exports.utils = exports.assertNumber = void 0; - function assertNumber3(n) { - if (!Number.isSafeInteger(n)) - throw new Error(`Wrong integer: ${n}`); - } - exports.assertNumber = assertNumber3; - function chain2(...args) { - const wrap = (a, b) => (c) => a(b(c)); - const encode = Array.from(args).reverse().reduce((acc, i) => acc ? wrap(acc, i.encode) : i.encode, void 0); - const decode2 = args.reduce((acc, i) => acc ? wrap(acc, i.decode) : i.decode, void 0); - return { encode, decode: decode2 }; - } - function alphabet2(alphabet3) { - return { - encode: (digits) => { - if (!Array.isArray(digits) || digits.length && typeof digits[0] !== "number") - throw new Error("alphabet.encode input should be an array of numbers"); - return digits.map((i) => { - assertNumber3(i); - if (i < 0 || i >= alphabet3.length) - throw new Error(`Digit index outside alphabet: ${i} (alphabet: ${alphabet3.length})`); - return alphabet3[i]; - }); - }, - decode: (input) => { - if (!Array.isArray(input) || input.length && typeof input[0] !== "string") - throw new Error("alphabet.decode input should be array of strings"); - return input.map((letter) => { - if (typeof letter !== "string") - throw new Error(`alphabet.decode: not string element=${letter}`); - const index = alphabet3.indexOf(letter); - if (index === -1) - throw new Error(`Unknown letter: "${letter}". Allowed: ${alphabet3}`); - return index; - }); - } - }; - } - function join2(separator = "") { - if (typeof separator !== "string") - throw new Error("join separator should be string"); - return { - encode: (from) => { - if (!Array.isArray(from) || from.length && typeof from[0] !== "string") - throw new Error("join.encode input should be array of strings"); - for (let i of from) - if (typeof i !== "string") - throw new Error(`join.encode: non-string input=${i}`); - return from.join(separator); - }, - decode: (to) => { - if (typeof to !== "string") - throw new Error("join.decode input should be string"); - return to.split(separator); - } - }; - } - function padding2(bits, chr = "=") { - assertNumber3(bits); - if (typeof chr !== "string") - throw new Error("padding chr should be string"); - return { - encode(data) { - if (!Array.isArray(data) || data.length && typeof data[0] !== "string") - throw new Error("padding.encode input should be array of strings"); - for (let i of data) - if (typeof i !== "string") - throw new Error(`padding.encode: non-string input=${i}`); - while (data.length * bits % 8) - data.push(chr); - return data; - }, - decode(input) { - if (!Array.isArray(input) || input.length && typeof input[0] !== "string") - throw new Error("padding.encode input should be array of strings"); - for (let i of input) - if (typeof i !== "string") - throw new Error(`padding.decode: non-string input=${i}`); - let end = input.length; - if (end * bits % 8) - throw new Error("Invalid padding: string should have whole number of bytes"); - for (; end > 0 && input[end - 1] === chr; end--) { - if (!((end - 1) * bits % 8)) - throw new Error("Invalid padding: string has too much padding"); - } - return input.slice(0, end); - } - }; - } - function normalize2(fn) { - if (typeof fn !== "function") - throw new Error("normalize fn should be function"); - return { encode: (from) => from, decode: (to) => fn(to) }; - } - function convertRadix3(data, from, to) { - if (from < 2) - throw new Error(`convertRadix: wrong from=${from}, base cannot be less than 2`); - if (to < 2) - throw new Error(`convertRadix: wrong to=${to}, base cannot be less than 2`); - if (!Array.isArray(data)) - throw new Error("convertRadix: data should be array"); - if (!data.length) - return []; - let pos = 0; - const res = []; - const digits = Array.from(data); - digits.forEach((d) => { - assertNumber3(d); - if (d < 0 || d >= from) - throw new Error(`Wrong integer: ${d}`); - }); - while (true) { - let carry = 0; - let done = true; - for (let i = pos; i < digits.length; i++) { - const digit = digits[i]; - const digitBase = from * carry + digit; - if (!Number.isSafeInteger(digitBase) || from * carry / from !== carry || digitBase - digit !== from * carry) { - throw new Error("convertRadix: carry overflow"); - } - carry = digitBase % to; - digits[i] = Math.floor(digitBase / to); - if (!Number.isSafeInteger(digits[i]) || digits[i] * to + carry !== digitBase) - throw new Error("convertRadix: carry overflow"); - if (!done) - continue; - else if (!digits[i]) - pos = i; - else - done = false; - } - res.push(carry); - if (done) - break; - } - for (let i = 0; i < data.length - 1 && data[i] === 0; i++) - res.push(0); - return res.reverse(); - } - var gcd2 = (a, b) => !b ? a : gcd2(b, a % b); - var radix2carry2 = (from, to) => from + (to - gcd2(from, to)); - function convertRadix22(data, from, to, padding3) { - if (!Array.isArray(data)) - throw new Error("convertRadix2: data should be array"); - if (from <= 0 || from > 32) - throw new Error(`convertRadix2: wrong from=${from}`); - if (to <= 0 || to > 32) - throw new Error(`convertRadix2: wrong to=${to}`); - if (radix2carry2(from, to) > 32) { - throw new Error(`convertRadix2: carry overflow from=${from} to=${to} carryBits=${radix2carry2(from, to)}`); - } - let carry = 0; - let pos = 0; - const mask = 2 ** to - 1; - const res = []; - for (const n of data) { - assertNumber3(n); - if (n >= 2 ** from) - throw new Error(`convertRadix2: invalid data word=${n} from=${from}`); - carry = carry << from | n; - if (pos + from > 32) - throw new Error(`convertRadix2: carry overflow pos=${pos} from=${from}`); - pos += from; - for (; pos >= to; pos -= to) - res.push((carry >> pos - to & mask) >>> 0); - carry &= 2 ** pos - 1; - } - carry = carry << to - pos & mask; - if (!padding3 && pos >= from) - throw new Error("Excess padding"); - if (!padding3 && carry) - throw new Error(`Non-zero padding: ${carry}`); - if (padding3 && pos > 0) - res.push(carry >>> 0); - return res; - } - function radix3(num) { - assertNumber3(num); - return { - encode: (bytes2) => { - if (!(bytes2 instanceof Uint8Array)) - throw new Error("radix.encode input should be Uint8Array"); - return convertRadix3(Array.from(bytes2), 2 ** 8, num); - }, - decode: (digits) => { - if (!Array.isArray(digits) || digits.length && typeof digits[0] !== "number") - throw new Error("radix.decode input should be array of strings"); - return Uint8Array.from(convertRadix3(digits, num, 2 ** 8)); - } - }; - } - function radix22(bits, revPadding = false) { - assertNumber3(bits); - if (bits <= 0 || bits > 32) - throw new Error("radix2: bits should be in (0..32]"); - if (radix2carry2(8, bits) > 32 || radix2carry2(bits, 8) > 32) - throw new Error("radix2: carry overflow"); - return { - encode: (bytes2) => { - if (!(bytes2 instanceof Uint8Array)) - throw new Error("radix2.encode input should be Uint8Array"); - return convertRadix22(Array.from(bytes2), 8, bits, !revPadding); - }, - decode: (digits) => { - if (!Array.isArray(digits) || digits.length && typeof digits[0] !== "number") - throw new Error("radix2.decode input should be array of strings"); - return Uint8Array.from(convertRadix22(digits, bits, 8, revPadding)); - } - }; - } - function unsafeWrapper2(fn) { - if (typeof fn !== "function") - throw new Error("unsafeWrapper fn should be function"); - return function(...args) { - try { - return fn.apply(null, args); - } catch (e) { - } - }; - } - function checksum2(len, fn) { - assertNumber3(len); - if (typeof fn !== "function") - throw new Error("checksum fn should be function"); - return { - encode(data) { - if (!(data instanceof Uint8Array)) - throw new Error("checksum.encode: input should be Uint8Array"); - const checksum3 = fn(data).slice(0, len); - const res = new Uint8Array(data.length + len); - res.set(data); - res.set(checksum3, data.length); - return res; - }, - decode(data) { - if (!(data instanceof Uint8Array)) - throw new Error("checksum.decode: input should be Uint8Array"); - const payload = data.slice(0, -len); - const newChecksum = fn(payload).slice(0, len); - const oldChecksum = data.slice(-len); - for (let i = 0; i < len; i++) - if (newChecksum[i] !== oldChecksum[i]) - throw new Error("Invalid checksum"); - return payload; - } - }; - } - exports.utils = { alphabet: alphabet2, chain: chain2, checksum: checksum2, radix: radix3, radix2: radix22, join: join2, padding: padding2 }; - exports.base16 = chain2(radix22(4), alphabet2("0123456789ABCDEF"), join2("")); - exports.base32 = chain2(radix22(5), alphabet2("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"), padding2(5), join2("")); - exports.base32hex = chain2(radix22(5), alphabet2("0123456789ABCDEFGHIJKLMNOPQRSTUV"), padding2(5), join2("")); - exports.base32crockford = chain2(radix22(5), alphabet2("0123456789ABCDEFGHJKMNPQRSTVWXYZ"), join2(""), normalize2((s) => s.toUpperCase().replace(/O/g, "0").replace(/[IL]/g, "1"))); - exports.base64 = chain2(radix22(6), alphabet2("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"), padding2(6), join2("")); - exports.base64url = chain2(radix22(6), alphabet2("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"), padding2(6), join2("")); - var genBase582 = (abc) => chain2(radix3(58), alphabet2(abc), join2("")); - exports.base58 = genBase582("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"); - exports.base58flickr = genBase582("123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"); - exports.base58xrp = genBase582("rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz"); - var XMR_BLOCK_LEN2 = [0, 2, 3, 5, 6, 7, 9, 10, 11]; - exports.base58xmr = { - encode(data) { - let res = ""; - for (let i = 0; i < data.length; i += 8) { - const block = data.subarray(i, i + 8); - res += exports.base58.encode(block).padStart(XMR_BLOCK_LEN2[block.length], "1"); - } - return res; - }, - decode(str) { - let res = []; - for (let i = 0; i < str.length; i += 11) { - const slice = str.slice(i, i + 11); - const blockLen = XMR_BLOCK_LEN2.indexOf(slice.length); - const block = exports.base58.decode(slice); - for (let j = 0; j < block.length - blockLen; j++) { - if (block[j] !== 0) - throw new Error("base58xmr: wrong padding"); - } - res = res.concat(Array.from(block.slice(block.length - blockLen))); - } - return Uint8Array.from(res); - } - }; - var base58check3 = (sha2563) => chain2(checksum2(4, (data) => sha2563(sha2563(data))), exports.base58); - exports.base58check = base58check3; - var BECH_ALPHABET2 = chain2(alphabet2("qpzry9x8gf2tvdw0s3jn54khce6mua7l"), join2("")); - var POLYMOD_GENERATORS2 = [996825010, 642813549, 513874426, 1027748829, 705979059]; - function bech32Polymod2(pre) { - const b = pre >> 25; - let chk = (pre & 33554431) << 5; - for (let i = 0; i < POLYMOD_GENERATORS2.length; i++) { - if ((b >> i & 1) === 1) - chk ^= POLYMOD_GENERATORS2[i]; - } - return chk; - } - function bechChecksum2(prefix, words, encodingConst = 1) { - const len = prefix.length; - let chk = 1; - for (let i = 0; i < len; i++) { - const c = prefix.charCodeAt(i); - if (c < 33 || c > 126) - throw new Error(`Invalid prefix (${prefix})`); - chk = bech32Polymod2(chk) ^ c >> 5; - } - chk = bech32Polymod2(chk); - for (let i = 0; i < len; i++) - chk = bech32Polymod2(chk) ^ prefix.charCodeAt(i) & 31; - for (let v of words) - chk = bech32Polymod2(chk) ^ v; - for (let i = 0; i < 6; i++) - chk = bech32Polymod2(chk); - chk ^= encodingConst; - return BECH_ALPHABET2.encode(convertRadix22([chk % 2 ** 30], 30, 5, false)); - } - function genBech322(encoding) { - const ENCODING_CONST = encoding === "bech32" ? 1 : 734539939; - const _words = radix22(5); - const fromWords = _words.decode; - const toWords = _words.encode; - const fromWordsUnsafe = unsafeWrapper2(fromWords); - function encode(prefix, words, limit = 90) { - if (typeof prefix !== "string") - throw new Error(`bech32.encode prefix should be string, not ${typeof prefix}`); - if (!Array.isArray(words) || words.length && typeof words[0] !== "number") - throw new Error(`bech32.encode words should be array of numbers, not ${typeof words}`); - const actualLength = prefix.length + 7 + words.length; - if (limit !== false && actualLength > limit) - throw new TypeError(`Length ${actualLength} exceeds limit ${limit}`); - prefix = prefix.toLowerCase(); - return `${prefix}1${BECH_ALPHABET2.encode(words)}${bechChecksum2(prefix, words, ENCODING_CONST)}`; - } - function decode2(str, limit = 90) { - if (typeof str !== "string") - throw new Error(`bech32.decode input should be string, not ${typeof str}`); - if (str.length < 8 || limit !== false && str.length > limit) - throw new TypeError(`Wrong string length: ${str.length} (${str}). Expected (8..${limit})`); - const lowered = str.toLowerCase(); - if (str !== lowered && str !== str.toUpperCase()) - throw new Error(`String must be lowercase or uppercase`); - str = lowered; - const sepIndex = str.lastIndexOf("1"); - if (sepIndex === 0 || sepIndex === -1) - throw new Error(`Letter "1" must be present between prefix and data only`); - const prefix = str.slice(0, sepIndex); - const _words2 = str.slice(sepIndex + 1); - if (_words2.length < 6) - throw new Error("Data must be at least 6 characters long"); - const words = BECH_ALPHABET2.decode(_words2).slice(0, -6); - const sum = bechChecksum2(prefix, words, ENCODING_CONST); - if (!_words2.endsWith(sum)) - throw new Error(`Invalid checksum in ${str}: expected "${sum}"`); - return { prefix, words }; - } - const decodeUnsafe = unsafeWrapper2(decode2); - function decodeToBytes(str) { - const { prefix, words } = decode2(str, false); - return { prefix, words, bytes: fromWords(words) }; - } - return { encode, decode: decode2, decodeToBytes, decodeUnsafe, fromWords, fromWordsUnsafe, toWords }; - } - exports.bech32 = genBech322("bech32"); - exports.bech32m = genBech322("bech32m"); - exports.utf8 = { - encode: (data) => new TextDecoder().decode(data), - decode: (str) => new TextEncoder().encode(str) - }; - exports.hex = chain2(radix22(4), alphabet2("0123456789abcdef"), join2(""), normalize2((s) => { - if (typeof s !== "string" || s.length % 2) - throw new TypeError(`hex.decode: expected string, got ${typeof s} with length ${s.length}`); - return s.toLowerCase(); - })); - var CODERS2 = { - utf8: exports.utf8, - hex: exports.hex, - base16: exports.base16, - base32: exports.base32, - base64: exports.base64, - base64url: exports.base64url, - base58: exports.base58, - base58xmr: exports.base58xmr - }; - var coderTypeError2 = `Invalid encoding type. Available types: ${Object.keys(CODERS2).join(", ")}`; - var bytesToString = (type, bytes2) => { - if (typeof type !== "string" || !CODERS2.hasOwnProperty(type)) - throw new TypeError(coderTypeError2); - if (!(bytes2 instanceof Uint8Array)) - throw new TypeError("bytesToString() expects Uint8Array"); - return CODERS2[type].encode(bytes2); - }; - exports.bytesToString = bytesToString; - exports.str = exports.bytesToString; - var stringToBytes = (type, str) => { - if (!CODERS2.hasOwnProperty(type)) - throw new TypeError(coderTypeError2); - if (typeof str !== "string") - throw new TypeError("stringToBytes() expects string"); - return CODERS2[type].decode(str); - }; - exports.stringToBytes = stringToBytes; - exports.bytes = exports.stringToBytes; - } - }); - - // node_modules/@scure/bip39/index.js - var require_bip39 = __commonJS({ - "node_modules/@scure/bip39/index.js"(exports) { - "use strict"; - init_define_process(); - Object.defineProperty(exports, "__esModule", { value: true }); - exports.mnemonicToSeedSync = exports.mnemonicToSeed = exports.validateMnemonic = exports.entropyToMnemonic = exports.mnemonicToEntropy = exports.generateMnemonic = void 0; - var _assert_1 = require_assert(); - var pbkdf2_1 = require_pbkdf2(); - var sha256_1 = require_sha256(); - var sha512_1 = require_sha512(); - var utils_1 = require_utils(); - var base_1 = require_lib(); - var isJapanese = (wordlist2) => wordlist2[0] === "\u3042\u3044\u3053\u304F\u3057\u3093"; - function nfkd(str) { - if (typeof str !== "string") - throw new TypeError(`Invalid mnemonic type: ${typeof str}`); - return str.normalize("NFKD"); - } - function normalize2(str) { - const norm = nfkd(str); - const words = norm.split(" "); - if (![12, 15, 18, 21, 24].includes(words.length)) - throw new Error("Invalid mnemonic"); - return { nfkd: norm, words }; - } - function assertEntropy(entropy) { - _assert_1.default.bytes(entropy, 16, 20, 24, 28, 32); - } - function generateMnemonic2(wordlist2, strength = 128) { - _assert_1.default.number(strength); - if (strength % 32 !== 0 || strength > 256) - throw new TypeError("Invalid entropy"); - return entropyToMnemonic((0, utils_1.randomBytes)(strength / 8), wordlist2); - } - exports.generateMnemonic = generateMnemonic2; - var calcChecksum = (entropy) => { - const bitsLeft = 8 - entropy.length / 4; - return new Uint8Array([(0, sha256_1.sha256)(entropy)[0] >> bitsLeft << bitsLeft]); - }; - function getCoder(wordlist2) { - if (!Array.isArray(wordlist2) || wordlist2.length !== 2048 || typeof wordlist2[0] !== "string") - throw new Error("Worlist: expected array of 2048 strings"); - wordlist2.forEach((i) => { - if (typeof i !== "string") - throw new Error(`Wordlist: non-string element: ${i}`); - }); - return base_1.utils.chain(base_1.utils.checksum(1, calcChecksum), base_1.utils.radix2(11, true), base_1.utils.alphabet(wordlist2)); - } - function mnemonicToEntropy(mnemonic, wordlist2) { - const { words } = normalize2(mnemonic); - const entropy = getCoder(wordlist2).decode(words); - assertEntropy(entropy); - return entropy; - } - exports.mnemonicToEntropy = mnemonicToEntropy; - function entropyToMnemonic(entropy, wordlist2) { - assertEntropy(entropy); - const words = getCoder(wordlist2).encode(entropy); - return words.join(isJapanese(wordlist2) ? "\u3000" : " "); - } - exports.entropyToMnemonic = entropyToMnemonic; - function validateMnemonic2(mnemonic, wordlist2) { - try { - mnemonicToEntropy(mnemonic, wordlist2); - } catch (e) { - return false; - } - return true; - } - exports.validateMnemonic = validateMnemonic2; - var salt = (passphrase) => nfkd(`mnemonic${passphrase}`); - function mnemonicToSeed(mnemonic, passphrase = "") { - return (0, pbkdf2_1.pbkdf2Async)(sha512_1.sha512, normalize2(mnemonic).nfkd, salt(passphrase), { c: 2048, dkLen: 64 }); - } - exports.mnemonicToSeed = mnemonicToSeed; - function mnemonicToSeedSync2(mnemonic, passphrase = "") { - return (0, pbkdf2_1.pbkdf2)(sha512_1.sha512, normalize2(mnemonic).nfkd, salt(passphrase), { c: 2048, dkLen: 64 }); - } - exports.mnemonicToSeedSync = mnemonicToSeedSync2; - } - }); - - // index.ts - var nostr_tools_exports = {}; - __export(nostr_tools_exports, { - Kind: () => Kind, - SimplePool: () => SimplePool, - finishEvent: () => finishEvent, - fj: () => fakejson_exports, - generatePrivateKey: () => generatePrivateKey, - getBlankEvent: () => getBlankEvent, - getEventHash: () => getEventHash, - getPublicKey: () => getPublicKey, - matchFilter: () => matchFilter, - matchFilters: () => matchFilters, - nip04: () => nip04_exports, - nip05: () => nip05_exports, - nip06: () => nip06_exports, - nip19: () => nip19_exports, - nip26: () => nip26_exports, - nip57: () => nip57_exports, - relayInit: () => relayInit, - serializeEvent: () => serializeEvent, - signEvent: () => signEvent, - utils: () => utils_exports, - validateEvent: () => validateEvent, - verifySignature: () => verifySignature - }); - init_define_process(); - - // keys.ts - init_define_process(); - - // node_modules/@noble/secp256k1/lib/esm/index.js - init_define_process(); - var nodeCrypto = __toESM(require_crypto(), 1); - var _0n = BigInt(0); - var _1n = BigInt(1); - var _2n = BigInt(2); - var _3n = BigInt(3); - var _8n = BigInt(8); - var CURVE = Object.freeze({ - a: _0n, - b: BigInt(7), - P: BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"), - n: BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"), - h: _1n, - Gx: BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"), - Gy: BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"), - beta: BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee") - }); - var divNearest = (a, b) => (a + b / _2n) / b; - var endo = { - beta: BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"), - splitScalar(k) { - const { n } = CURVE; - const a1 = BigInt("0x3086d221a7d46bcde86c90e49284eb15"); - const b1 = -_1n * BigInt("0xe4437ed6010e88286f547fa90abfe4c3"); - const a2 = BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"); - const b2 = a1; - const POW_2_128 = BigInt("0x100000000000000000000000000000000"); - const c1 = divNearest(b2 * k, n); - const c2 = divNearest(-b1 * k, n); - let k1 = mod(k - c1 * a1 - c2 * a2, n); - let k2 = mod(-c1 * b1 - c2 * b2, n); - const k1neg = k1 > POW_2_128; - const k2neg = k2 > POW_2_128; - if (k1neg) - k1 = n - k1; - if (k2neg) - k2 = n - k2; - if (k1 > POW_2_128 || k2 > POW_2_128) { - throw new Error("splitScalarEndo: Endomorphism failed, k=" + k); - } - return { k1neg, k1, k2neg, k2 }; - } - }; - var fieldLen = 32; - var groupLen = 32; - var compressedLen = fieldLen + 1; - var uncompressedLen = 2 * fieldLen + 1; - function weierstrass(x) { - const { a, b } = CURVE; - const x2 = mod(x * x); - const x3 = mod(x2 * x); - return mod(x3 + a * x + b); - } - var USE_ENDOMORPHISM = CURVE.a === _0n; - var ShaError = class extends Error { - constructor(message) { - super(message); - } - }; - function assertJacPoint(other) { - if (!(other instanceof JacobianPoint)) - throw new TypeError("JacobianPoint expected"); - } - var JacobianPoint = class { - constructor(x, y, z) { - this.x = x; - this.y = y; - this.z = z; - } - static fromAffine(p) { - if (!(p instanceof Point)) { - throw new TypeError("JacobianPoint#fromAffine: expected Point"); - } - if (p.equals(Point.ZERO)) - return JacobianPoint.ZERO; - return new JacobianPoint(p.x, p.y, _1n); - } - static toAffineBatch(points) { - const toInv = invertBatch(points.map((p) => p.z)); - return points.map((p, i) => p.toAffine(toInv[i])); - } - static normalizeZ(points) { - return JacobianPoint.toAffineBatch(points).map(JacobianPoint.fromAffine); - } - equals(other) { - assertJacPoint(other); - const { x: X1, y: Y1, z: Z1 } = this; - const { x: X2, y: Y2, z: Z2 } = other; - const Z1Z1 = mod(Z1 * Z1); - const Z2Z2 = mod(Z2 * Z2); - const U1 = mod(X1 * Z2Z2); - const U2 = mod(X2 * Z1Z1); - const S1 = mod(mod(Y1 * Z2) * Z2Z2); - const S2 = mod(mod(Y2 * Z1) * Z1Z1); - return U1 === U2 && S1 === S2; - } - negate() { - return new JacobianPoint(this.x, mod(-this.y), this.z); - } - double() { - const { x: X1, y: Y1, z: Z1 } = this; - const A = mod(X1 * X1); - const B = mod(Y1 * Y1); - const C = mod(B * B); - const x1b = X1 + B; - const D = mod(_2n * (mod(x1b * x1b) - A - C)); - const E = mod(_3n * A); - const F = mod(E * E); - const X3 = mod(F - _2n * D); - const Y3 = mod(E * (D - X3) - _8n * C); - const Z3 = mod(_2n * Y1 * Z1); - return new JacobianPoint(X3, Y3, Z3); - } - add(other) { - assertJacPoint(other); - const { x: X1, y: Y1, z: Z1 } = this; - const { x: X2, y: Y2, z: Z2 } = other; - if (X2 === _0n || Y2 === _0n) - return this; - if (X1 === _0n || Y1 === _0n) - return other; - const Z1Z1 = mod(Z1 * Z1); - const Z2Z2 = mod(Z2 * Z2); - const U1 = mod(X1 * Z2Z2); - const U2 = mod(X2 * Z1Z1); - const S1 = mod(mod(Y1 * Z2) * Z2Z2); - const S2 = mod(mod(Y2 * Z1) * Z1Z1); - const H = mod(U2 - U1); - const r = mod(S2 - S1); - if (H === _0n) { - if (r === _0n) { - return this.double(); - } else { - return JacobianPoint.ZERO; - } - } - const HH = mod(H * H); - const HHH = mod(H * HH); - const V = mod(U1 * HH); - const X3 = mod(r * r - HHH - _2n * V); - const Y3 = mod(r * (V - X3) - S1 * HHH); - const Z3 = mod(Z1 * Z2 * H); - return new JacobianPoint(X3, Y3, Z3); - } - subtract(other) { - return this.add(other.negate()); - } - multiplyUnsafe(scalar) { - const P0 = JacobianPoint.ZERO; - if (typeof scalar === "bigint" && scalar === _0n) - return P0; - let n = normalizeScalar(scalar); - if (n === _1n) - return this; - if (!USE_ENDOMORPHISM) { - let p = P0; - let d2 = this; - while (n > _0n) { - if (n & _1n) - p = p.add(d2); - d2 = d2.double(); - n >>= _1n; - } - return p; - } - let { k1neg, k1, k2neg, k2 } = endo.splitScalar(n); - let k1p = P0; - let k2p = P0; - let d = this; - while (k1 > _0n || k2 > _0n) { - if (k1 & _1n) - k1p = k1p.add(d); - if (k2 & _1n) - k2p = k2p.add(d); - d = d.double(); - k1 >>= _1n; - k2 >>= _1n; - } - if (k1neg) - k1p = k1p.negate(); - if (k2neg) - k2p = k2p.negate(); - k2p = new JacobianPoint(mod(k2p.x * endo.beta), k2p.y, k2p.z); - return k1p.add(k2p); - } - precomputeWindow(W) { - const windows = USE_ENDOMORPHISM ? 128 / W + 1 : 256 / W + 1; - const points = []; - let p = this; - let base = p; - for (let window = 0; window < windows; window++) { - base = p; - points.push(base); - for (let i = 1; i < 2 ** (W - 1); i++) { - base = base.add(p); - points.push(base); - } - p = base.double(); - } - return points; - } - wNAF(n, affinePoint) { - if (!affinePoint && this.equals(JacobianPoint.BASE)) - affinePoint = Point.BASE; - const W = affinePoint && affinePoint._WINDOW_SIZE || 1; - if (256 % W) { - throw new Error("Point#wNAF: Invalid precomputation window, must be power of 2"); - } - let precomputes = affinePoint && pointPrecomputes.get(affinePoint); - if (!precomputes) { - precomputes = this.precomputeWindow(W); - if (affinePoint && W !== 1) { - precomputes = JacobianPoint.normalizeZ(precomputes); - pointPrecomputes.set(affinePoint, precomputes); - } - } - let p = JacobianPoint.ZERO; - let f2 = JacobianPoint.BASE; - const windows = 1 + (USE_ENDOMORPHISM ? 128 / W : 256 / W); - const windowSize = 2 ** (W - 1); - const mask = BigInt(2 ** W - 1); - const maxNumber = 2 ** W; - const shiftBy = BigInt(W); - for (let window = 0; window < windows; window++) { - const offset = window * windowSize; - let wbits = Number(n & mask); - n >>= shiftBy; - if (wbits > windowSize) { - wbits -= maxNumber; - n += _1n; - } - const offset1 = offset; - const offset2 = offset + Math.abs(wbits) - 1; - const cond1 = window % 2 !== 0; - const cond2 = wbits < 0; - if (wbits === 0) { - f2 = f2.add(constTimeNegate(cond1, precomputes[offset1])); - } else { - p = p.add(constTimeNegate(cond2, precomputes[offset2])); - } - } - return { p, f: f2 }; - } - multiply(scalar, affinePoint) { - let n = normalizeScalar(scalar); - let point; - let fake; - if (USE_ENDOMORPHISM) { - const { k1neg, k1, k2neg, k2 } = endo.splitScalar(n); - let { p: k1p, f: f1p } = this.wNAF(k1, affinePoint); - let { p: k2p, f: f2p } = this.wNAF(k2, affinePoint); - k1p = constTimeNegate(k1neg, k1p); - k2p = constTimeNegate(k2neg, k2p); - k2p = new JacobianPoint(mod(k2p.x * endo.beta), k2p.y, k2p.z); - point = k1p.add(k2p); - fake = f1p.add(f2p); - } else { - const { p, f: f2 } = this.wNAF(n, affinePoint); - point = p; - fake = f2; - } - return JacobianPoint.normalizeZ([point, fake])[0]; - } - toAffine(invZ) { - const { x, y, z } = this; - const is0 = this.equals(JacobianPoint.ZERO); - if (invZ == null) - invZ = is0 ? _8n : invert(z); - const iz1 = invZ; - const iz2 = mod(iz1 * iz1); - const iz3 = mod(iz2 * iz1); - const ax = mod(x * iz2); - const ay = mod(y * iz3); - const zz = mod(z * iz1); - if (is0) - return Point.ZERO; - if (zz !== _1n) - throw new Error("invZ was invalid"); - return new Point(ax, ay); - } - }; - JacobianPoint.BASE = new JacobianPoint(CURVE.Gx, CURVE.Gy, _1n); - JacobianPoint.ZERO = new JacobianPoint(_0n, _1n, _0n); - function constTimeNegate(condition, item) { - const neg = item.negate(); - return condition ? neg : item; - } - var pointPrecomputes = /* @__PURE__ */ new WeakMap(); - var Point = class { - constructor(x, y) { - this.x = x; - this.y = y; - } - _setWindowSize(windowSize) { - this._WINDOW_SIZE = windowSize; - pointPrecomputes.delete(this); - } - hasEvenY() { - return this.y % _2n === _0n; - } - static fromCompressedHex(bytes2) { - const isShort = bytes2.length === 32; - const x = bytesToNumber(isShort ? bytes2 : bytes2.subarray(1)); - if (!isValidFieldElement(x)) - throw new Error("Point is not on curve"); - const y2 = weierstrass(x); - let y = sqrtMod(y2); - const isYOdd = (y & _1n) === _1n; - if (isShort) { - if (isYOdd) - y = mod(-y); - } else { - const isFirstByteOdd = (bytes2[0] & 1) === 1; - if (isFirstByteOdd !== isYOdd) - y = mod(-y); - } - const point = new Point(x, y); - point.assertValidity(); - return point; - } - static fromUncompressedHex(bytes2) { - const x = bytesToNumber(bytes2.subarray(1, fieldLen + 1)); - const y = bytesToNumber(bytes2.subarray(fieldLen + 1, fieldLen * 2 + 1)); - const point = new Point(x, y); - point.assertValidity(); - return point; - } - static fromHex(hex2) { - const bytes2 = ensureBytes(hex2); - const len = bytes2.length; - const header = bytes2[0]; - if (len === fieldLen) - return this.fromCompressedHex(bytes2); - if (len === compressedLen && (header === 2 || header === 3)) { - return this.fromCompressedHex(bytes2); - } - if (len === uncompressedLen && header === 4) - return this.fromUncompressedHex(bytes2); - throw new Error(`Point.fromHex: received invalid point. Expected 32-${compressedLen} compressed bytes or ${uncompressedLen} uncompressed bytes, not ${len}`); - } - static fromPrivateKey(privateKey) { - return Point.BASE.multiply(normalizePrivateKey(privateKey)); - } - static fromSignature(msgHash, signature, recovery) { - const { r, s } = normalizeSignature(signature); - if (![0, 1, 2, 3].includes(recovery)) - throw new Error("Cannot recover: invalid recovery bit"); - const h = truncateHash(ensureBytes(msgHash)); - const { n } = CURVE; - const radj = recovery === 2 || recovery === 3 ? r + n : r; - const rinv = invert(radj, n); - const u1 = mod(-h * rinv, n); - const u2 = mod(s * rinv, n); - const prefix = recovery & 1 ? "03" : "02"; - const R = Point.fromHex(prefix + numTo32bStr(radj)); - const Q = Point.BASE.multiplyAndAddUnsafe(R, u1, u2); - if (!Q) - throw new Error("Cannot recover signature: point at infinify"); - Q.assertValidity(); - return Q; - } - toRawBytes(isCompressed = false) { - return hexToBytes(this.toHex(isCompressed)); - } - toHex(isCompressed = false) { - const x = numTo32bStr(this.x); - if (isCompressed) { - const prefix = this.hasEvenY() ? "02" : "03"; - return `${prefix}${x}`; - } else { - return `04${x}${numTo32bStr(this.y)}`; - } - } - toHexX() { - return this.toHex(true).slice(2); - } - toRawX() { - return this.toRawBytes(true).slice(1); - } - assertValidity() { - const msg = "Point is not on elliptic curve"; - const { x, y } = this; - if (!isValidFieldElement(x) || !isValidFieldElement(y)) - throw new Error(msg); - const left = mod(y * y); - const right = weierstrass(x); - if (mod(left - right) !== _0n) - throw new Error(msg); - } - equals(other) { - return this.x === other.x && this.y === other.y; - } - negate() { - return new Point(this.x, mod(-this.y)); - } - double() { - return JacobianPoint.fromAffine(this).double().toAffine(); - } - add(other) { - return JacobianPoint.fromAffine(this).add(JacobianPoint.fromAffine(other)).toAffine(); - } - subtract(other) { - return this.add(other.negate()); - } - multiply(scalar) { - return JacobianPoint.fromAffine(this).multiply(scalar, this).toAffine(); - } - multiplyAndAddUnsafe(Q, a, b) { - const P = JacobianPoint.fromAffine(this); - const aP = a === _0n || a === _1n || this !== Point.BASE ? P.multiplyUnsafe(a) : P.multiply(a); - const bQ = JacobianPoint.fromAffine(Q).multiplyUnsafe(b); - const sum = aP.add(bQ); - return sum.equals(JacobianPoint.ZERO) ? void 0 : sum.toAffine(); - } - }; - Point.BASE = new Point(CURVE.Gx, CURVE.Gy); - Point.ZERO = new Point(_0n, _0n); - function sliceDER(s) { - return Number.parseInt(s[0], 16) >= 8 ? "00" + s : s; - } - function parseDERInt(data) { - if (data.length < 2 || data[0] !== 2) { - throw new Error(`Invalid signature integer tag: ${bytesToHex(data)}`); - } - const len = data[1]; - const res = data.subarray(2, len + 2); - if (!len || res.length !== len) { - throw new Error(`Invalid signature integer: wrong length`); - } - if (res[0] === 0 && res[1] <= 127) { - throw new Error("Invalid signature integer: trailing length"); - } - return { data: bytesToNumber(res), left: data.subarray(len + 2) }; - } - function parseDERSignature(data) { - if (data.length < 2 || data[0] != 48) { - throw new Error(`Invalid signature tag: ${bytesToHex(data)}`); - } - if (data[1] !== data.length - 2) { - throw new Error("Invalid signature: incorrect length"); - } - const { data: r, left: sBytes } = parseDERInt(data.subarray(2)); - const { data: s, left: rBytesLeft } = parseDERInt(sBytes); - if (rBytesLeft.length) { - throw new Error(`Invalid signature: left bytes after parsing: ${bytesToHex(rBytesLeft)}`); - } - return { r, s }; - } - var Signature = class { - constructor(r, s) { - this.r = r; - this.s = s; - this.assertValidity(); - } - static fromCompact(hex2) { - const arr = hex2 instanceof Uint8Array; - const name = "Signature.fromCompact"; - if (typeof hex2 !== "string" && !arr) - throw new TypeError(`${name}: Expected string or Uint8Array`); - const str = arr ? bytesToHex(hex2) : hex2; - if (str.length !== 128) - throw new Error(`${name}: Expected 64-byte hex`); - return new Signature(hexToNumber(str.slice(0, 64)), hexToNumber(str.slice(64, 128))); - } - static fromDER(hex2) { - const arr = hex2 instanceof Uint8Array; - if (typeof hex2 !== "string" && !arr) - throw new TypeError(`Signature.fromDER: Expected string or Uint8Array`); - const { r, s } = parseDERSignature(arr ? hex2 : hexToBytes(hex2)); - return new Signature(r, s); - } - static fromHex(hex2) { - return this.fromDER(hex2); - } - assertValidity() { - const { r, s } = this; - if (!isWithinCurveOrder(r)) - throw new Error("Invalid Signature: r must be 0 < r < n"); - if (!isWithinCurveOrder(s)) - throw new Error("Invalid Signature: s must be 0 < s < n"); - } - hasHighS() { - const HALF = CURVE.n >> _1n; - return this.s > HALF; - } - normalizeS() { - return this.hasHighS() ? new Signature(this.r, mod(-this.s, CURVE.n)) : this; - } - toDERRawBytes() { - return hexToBytes(this.toDERHex()); - } - toDERHex() { - const sHex = sliceDER(numberToHexUnpadded(this.s)); - const rHex = sliceDER(numberToHexUnpadded(this.r)); - const sHexL = sHex.length / 2; - const rHexL = rHex.length / 2; - const sLen = numberToHexUnpadded(sHexL); - const rLen = numberToHexUnpadded(rHexL); - const length = numberToHexUnpadded(rHexL + sHexL + 4); - return `30${length}02${rLen}${rHex}02${sLen}${sHex}`; - } - toRawBytes() { - return this.toDERRawBytes(); - } - toHex() { - return this.toDERHex(); - } - toCompactRawBytes() { - return hexToBytes(this.toCompactHex()); - } - toCompactHex() { - return numTo32bStr(this.r) + numTo32bStr(this.s); - } - }; - function concatBytes(...arrays) { - if (!arrays.every((b) => b instanceof Uint8Array)) - throw new Error("Uint8Array list expected"); - if (arrays.length === 1) - return arrays[0]; - const length = arrays.reduce((a, arr) => a + arr.length, 0); - const result = new Uint8Array(length); - for (let i = 0, pad = 0; i < arrays.length; i++) { - const arr = arrays[i]; - result.set(arr, pad); - pad += arr.length; - } - return result; - } - var hexes = Array.from({ length: 256 }, (v, i) => i.toString(16).padStart(2, "0")); - function bytesToHex(uint8a) { - if (!(uint8a instanceof Uint8Array)) - throw new Error("Expected Uint8Array"); - let hex2 = ""; - for (let i = 0; i < uint8a.length; i++) { - hex2 += hexes[uint8a[i]]; - } - return hex2; - } - var POW_2_256 = BigInt("0x10000000000000000000000000000000000000000000000000000000000000000"); - function numTo32bStr(num) { - if (typeof num !== "bigint") - throw new Error("Expected bigint"); - if (!(_0n <= num && num < POW_2_256)) - throw new Error("Expected number 0 <= n < 2^256"); - return num.toString(16).padStart(64, "0"); - } - function numTo32b(num) { - const b = hexToBytes(numTo32bStr(num)); - if (b.length !== 32) - throw new Error("Error: expected 32 bytes"); - return b; - } - function numberToHexUnpadded(num) { - const hex2 = num.toString(16); - return hex2.length & 1 ? `0${hex2}` : hex2; - } - function hexToNumber(hex2) { - if (typeof hex2 !== "string") { - throw new TypeError("hexToNumber: expected string, got " + typeof hex2); - } - return BigInt(`0x${hex2}`); - } - function hexToBytes(hex2) { - if (typeof hex2 !== "string") { - throw new TypeError("hexToBytes: expected string, got " + typeof hex2); - } - if (hex2.length % 2) - throw new Error("hexToBytes: received invalid unpadded hex" + hex2.length); - const array = new Uint8Array(hex2.length / 2); - for (let i = 0; i < array.length; i++) { - const j = i * 2; - const hexByte = hex2.slice(j, j + 2); - const byte = Number.parseInt(hexByte, 16); - if (Number.isNaN(byte) || byte < 0) - throw new Error("Invalid byte sequence"); - array[i] = byte; - } - return array; - } - function bytesToNumber(bytes2) { - return hexToNumber(bytesToHex(bytes2)); - } - function ensureBytes(hex2) { - return hex2 instanceof Uint8Array ? Uint8Array.from(hex2) : hexToBytes(hex2); - } - function normalizeScalar(num) { - if (typeof num === "number" && Number.isSafeInteger(num) && num > 0) - return BigInt(num); - if (typeof num === "bigint" && isWithinCurveOrder(num)) - return num; - throw new TypeError("Expected valid private scalar: 0 < scalar < curve.n"); - } - function mod(a, b = CURVE.P) { - const result = a % b; - return result >= _0n ? result : b + result; - } - function pow2(x, power) { - const { P } = CURVE; - let res = x; - while (power-- > _0n) { - res *= res; - res %= P; - } - return res; - } - function sqrtMod(x) { - const { P } = CURVE; - const _6n = BigInt(6); - const _11n = BigInt(11); - const _22n = BigInt(22); - const _23n = BigInt(23); - const _44n = BigInt(44); - const _88n = BigInt(88); - const b2 = x * x * x % P; - const b3 = b2 * b2 * x % P; - const b6 = pow2(b3, _3n) * b3 % P; - const b9 = pow2(b6, _3n) * b3 % P; - const b11 = pow2(b9, _2n) * b2 % P; - const b22 = pow2(b11, _11n) * b11 % P; - const b44 = pow2(b22, _22n) * b22 % P; - const b88 = pow2(b44, _44n) * b44 % P; - const b176 = pow2(b88, _88n) * b88 % P; - const b220 = pow2(b176, _44n) * b44 % P; - const b223 = pow2(b220, _3n) * b3 % P; - const t1 = pow2(b223, _23n) * b22 % P; - const t2 = pow2(t1, _6n) * b2 % P; - const rt = pow2(t2, _2n); - const xc = rt * rt % P; - if (xc !== x) - throw new Error("Cannot find square root"); - return rt; - } - function invert(number2, modulo = CURVE.P) { - if (number2 === _0n || modulo <= _0n) { - throw new Error(`invert: expected positive integers, got n=${number2} mod=${modulo}`); - } - let a = mod(number2, modulo); - let b = modulo; - let x = _0n, y = _1n, u = _1n, v = _0n; - while (a !== _0n) { - const q = b / a; - const r = b % a; - const m = x - u * q; - const n = y - v * q; - b = a, a = r, x = u, y = v, u = m, v = n; - } - const gcd2 = b; - if (gcd2 !== _1n) - throw new Error("invert: does not exist"); - return mod(x, modulo); - } - function invertBatch(nums, p = CURVE.P) { - const scratch = new Array(nums.length); - const lastMultiplied = nums.reduce((acc, num, i) => { - if (num === _0n) - return acc; - scratch[i] = acc; - return mod(acc * num, p); - }, _1n); - const inverted = invert(lastMultiplied, p); - nums.reduceRight((acc, num, i) => { - if (num === _0n) - return acc; - scratch[i] = mod(acc * scratch[i], p); - return mod(acc * num, p); - }, inverted); - return scratch; - } - function bits2int_2(bytes2) { - const delta = bytes2.length * 8 - groupLen * 8; - const num = bytesToNumber(bytes2); - return delta > 0 ? num >> BigInt(delta) : num; - } - function truncateHash(hash2, truncateOnly = false) { - const h = bits2int_2(hash2); - if (truncateOnly) - return h; - const { n } = CURVE; - return h >= n ? h - n : h; - } - var _sha256Sync; - var _hmacSha256Sync; - function isWithinCurveOrder(num) { - return _0n < num && num < CURVE.n; - } - function isValidFieldElement(num) { - return _0n < num && num < CURVE.P; - } - function normalizePrivateKey(key) { - let num; - if (typeof key === "bigint") { - num = key; - } else if (typeof key === "number" && Number.isSafeInteger(key) && key > 0) { - num = BigInt(key); - } else if (typeof key === "string") { - if (key.length !== 2 * groupLen) - throw new Error("Expected 32 bytes of private key"); - num = hexToNumber(key); - } else if (key instanceof Uint8Array) { - if (key.length !== groupLen) - throw new Error("Expected 32 bytes of private key"); - num = bytesToNumber(key); - } else { - throw new TypeError("Expected valid private key"); - } - if (!isWithinCurveOrder(num)) - throw new Error("Expected private key: 0 < key < n"); - return num; - } - function normalizePublicKey(publicKey) { - if (publicKey instanceof Point) { - publicKey.assertValidity(); - return publicKey; - } else { - return Point.fromHex(publicKey); - } - } - function normalizeSignature(signature) { - if (signature instanceof Signature) { - signature.assertValidity(); - return signature; - } - try { - return Signature.fromDER(signature); - } catch (error) { - return Signature.fromCompact(signature); - } - } - function isProbPub(item) { - const arr = item instanceof Uint8Array; - const str = typeof item === "string"; - const len = (arr || str) && item.length; - if (arr) - return len === compressedLen || len === uncompressedLen; - if (str) - return len === compressedLen * 2 || len === uncompressedLen * 2; - if (item instanceof Point) - return true; - return false; - } - function getSharedSecret(privateA, publicB, isCompressed = false) { - if (isProbPub(privateA)) - throw new TypeError("getSharedSecret: first arg must be private key"); - if (!isProbPub(publicB)) - throw new TypeError("getSharedSecret: second arg must be public key"); - const b = normalizePublicKey(publicB); - b.assertValidity(); - return b.multiply(normalizePrivateKey(privateA)).toRawBytes(isCompressed); - } - function schnorrChallengeFinalize(ch) { - return mod(bytesToNumber(ch), CURVE.n); - } - var SchnorrSignature = class { - constructor(r, s) { - this.r = r; - this.s = s; - this.assertValidity(); - } - static fromHex(hex2) { - const bytes2 = ensureBytes(hex2); - if (bytes2.length !== 64) - throw new TypeError(`SchnorrSignature.fromHex: expected 64 bytes, not ${bytes2.length}`); - const r = bytesToNumber(bytes2.subarray(0, 32)); - const s = bytesToNumber(bytes2.subarray(32, 64)); - return new SchnorrSignature(r, s); - } - assertValidity() { - const { r, s } = this; - if (!isValidFieldElement(r) || !isWithinCurveOrder(s)) - throw new Error("Invalid signature"); - } - toHex() { - return numTo32bStr(this.r) + numTo32bStr(this.s); - } - toRawBytes() { - return hexToBytes(this.toHex()); - } - }; - function schnorrGetPublicKey(privateKey) { - return Point.fromPrivateKey(privateKey).toRawX(); - } - var InternalSchnorrSignature = class { - constructor(message, privateKey, auxRand = utils.randomBytes()) { - if (message == null) - throw new TypeError(`sign: Expected valid message, not "${message}"`); - this.m = ensureBytes(message); - const { x, scalar } = this.getScalar(normalizePrivateKey(privateKey)); - this.px = x; - this.d = scalar; - this.rand = ensureBytes(auxRand); - if (this.rand.length !== 32) - throw new TypeError("sign: Expected 32 bytes of aux randomness"); - } - getScalar(priv) { - const point = Point.fromPrivateKey(priv); - const scalar = point.hasEvenY() ? priv : CURVE.n - priv; - return { point, scalar, x: point.toRawX() }; - } - initNonce(d, t0h) { - return numTo32b(d ^ bytesToNumber(t0h)); - } - finalizeNonce(k0h) { - const k0 = mod(bytesToNumber(k0h), CURVE.n); - if (k0 === _0n) - throw new Error("sign: Creation of signature failed. k is zero"); - const { point: R, x: rx, scalar: k } = this.getScalar(k0); - return { R, rx, k }; - } - finalizeSig(R, k, e, d) { - return new SchnorrSignature(R.x, mod(k + e * d, CURVE.n)).toRawBytes(); - } - error() { - throw new Error("sign: Invalid signature produced"); - } - async calc() { - const { m, d, px, rand } = this; - const tag = utils.taggedHash; - const t = this.initNonce(d, await tag(TAGS.aux, rand)); - const { R, rx, k } = this.finalizeNonce(await tag(TAGS.nonce, t, px, m)); - const e = schnorrChallengeFinalize(await tag(TAGS.challenge, rx, px, m)); - const sig = this.finalizeSig(R, k, e, d); - if (!await schnorrVerify(sig, m, px)) - this.error(); - return sig; - } - calcSync() { - const { m, d, px, rand } = this; - const tag = utils.taggedHashSync; - const t = this.initNonce(d, tag(TAGS.aux, rand)); - const { R, rx, k } = this.finalizeNonce(tag(TAGS.nonce, t, px, m)); - const e = schnorrChallengeFinalize(tag(TAGS.challenge, rx, px, m)); - const sig = this.finalizeSig(R, k, e, d); - if (!schnorrVerifySync(sig, m, px)) - this.error(); - return sig; - } - }; - async function schnorrSign(msg, privKey, auxRand) { - return new InternalSchnorrSignature(msg, privKey, auxRand).calc(); - } - function schnorrSignSync(msg, privKey, auxRand) { - return new InternalSchnorrSignature(msg, privKey, auxRand).calcSync(); - } - function initSchnorrVerify(signature, message, publicKey) { - const raw = signature instanceof SchnorrSignature; - const sig = raw ? signature : SchnorrSignature.fromHex(signature); - if (raw) - sig.assertValidity(); - return { - ...sig, - m: ensureBytes(message), - P: normalizePublicKey(publicKey) - }; - } - function finalizeSchnorrVerify(r, P, s, e) { - const R = Point.BASE.multiplyAndAddUnsafe(P, normalizePrivateKey(s), mod(-e, CURVE.n)); - if (!R || !R.hasEvenY() || R.x !== r) - return false; - return true; - } - async function schnorrVerify(signature, message, publicKey) { - try { - const { r, s, m, P } = initSchnorrVerify(signature, message, publicKey); - const e = schnorrChallengeFinalize(await utils.taggedHash(TAGS.challenge, numTo32b(r), P.toRawX(), m)); - return finalizeSchnorrVerify(r, P, s, e); - } catch (error) { - return false; - } - } - function schnorrVerifySync(signature, message, publicKey) { - try { - const { r, s, m, P } = initSchnorrVerify(signature, message, publicKey); - const e = schnorrChallengeFinalize(utils.taggedHashSync(TAGS.challenge, numTo32b(r), P.toRawX(), m)); - return finalizeSchnorrVerify(r, P, s, e); - } catch (error) { - if (error instanceof ShaError) - throw error; - return false; - } - } - var schnorr = { - Signature: SchnorrSignature, - getPublicKey: schnorrGetPublicKey, - sign: schnorrSign, - verify: schnorrVerify, - signSync: schnorrSignSync, - verifySync: schnorrVerifySync - }; - Point.BASE._setWindowSize(8); - var crypto2 = { - node: nodeCrypto, - web: typeof self === "object" && "crypto" in self ? self.crypto : void 0 - }; - var TAGS = { - challenge: "BIP0340/challenge", - aux: "BIP0340/aux", - nonce: "BIP0340/nonce" - }; - var TAGGED_HASH_PREFIXES = {}; - var utils = { - bytesToHex, - hexToBytes, - concatBytes, - mod, - invert, - isValidPrivateKey(privateKey) { - try { - normalizePrivateKey(privateKey); - return true; - } catch (error) { - return false; - } - }, - _bigintTo32Bytes: numTo32b, - _normalizePrivateKey: normalizePrivateKey, - hashToPrivateKey: (hash2) => { - hash2 = ensureBytes(hash2); - const minLen = groupLen + 8; - if (hash2.length < minLen || hash2.length > 1024) { - throw new Error(`Expected valid bytes of private key as per FIPS 186`); - } - const num = mod(bytesToNumber(hash2), CURVE.n - _1n) + _1n; - return numTo32b(num); - }, - randomBytes: (bytesLength = 32) => { - if (crypto2.web) { - return crypto2.web.getRandomValues(new Uint8Array(bytesLength)); - } else if (crypto2.node) { - const { randomBytes: randomBytes2 } = crypto2.node; - return Uint8Array.from(randomBytes2(bytesLength)); - } else { - throw new Error("The environment doesn't have randomBytes function"); - } - }, - randomPrivateKey: () => utils.hashToPrivateKey(utils.randomBytes(groupLen + 8)), - precompute(windowSize = 8, point = Point.BASE) { - const cached = point === Point.BASE ? point : new Point(point.x, point.y); - cached._setWindowSize(windowSize); - cached.multiply(_3n); - return cached; - }, - sha256: async (...messages) => { - if (crypto2.web) { - const buffer = await crypto2.web.subtle.digest("SHA-256", concatBytes(...messages)); - return new Uint8Array(buffer); - } else if (crypto2.node) { - const { createHash } = crypto2.node; - const hash2 = createHash("sha256"); - messages.forEach((m) => hash2.update(m)); - return Uint8Array.from(hash2.digest()); - } else { - throw new Error("The environment doesn't have sha256 function"); - } - }, - hmacSha256: async (key, ...messages) => { - if (crypto2.web) { - const ckey = await crypto2.web.subtle.importKey("raw", key, { name: "HMAC", hash: { name: "SHA-256" } }, false, ["sign"]); - const message = concatBytes(...messages); - const buffer = await crypto2.web.subtle.sign("HMAC", ckey, message); - return new Uint8Array(buffer); - } else if (crypto2.node) { - const { createHmac } = crypto2.node; - const hash2 = createHmac("sha256", key); - messages.forEach((m) => hash2.update(m)); - return Uint8Array.from(hash2.digest()); - } else { - throw new Error("The environment doesn't have hmac-sha256 function"); - } - }, - sha256Sync: void 0, - hmacSha256Sync: void 0, - taggedHash: async (tag, ...messages) => { - let tagP = TAGGED_HASH_PREFIXES[tag]; - if (tagP === void 0) { - const tagH = await utils.sha256(Uint8Array.from(tag, (c) => c.charCodeAt(0))); - tagP = concatBytes(tagH, tagH); - TAGGED_HASH_PREFIXES[tag] = tagP; - } - return utils.sha256(tagP, ...messages); - }, - taggedHashSync: (tag, ...messages) => { - if (typeof _sha256Sync !== "function") - throw new ShaError("sha256Sync is undefined, you need to set it"); - let tagP = TAGGED_HASH_PREFIXES[tag]; - if (tagP === void 0) { - const tagH = _sha256Sync(Uint8Array.from(tag, (c) => c.charCodeAt(0))); - tagP = concatBytes(tagH, tagH); - TAGGED_HASH_PREFIXES[tag] = tagP; - } - return _sha256Sync(tagP, ...messages); - }, - _JacobianPoint: JacobianPoint - }; - Object.defineProperties(utils, { - sha256Sync: { - configurable: false, - get() { - return _sha256Sync; - }, - set(val) { - if (!_sha256Sync) - _sha256Sync = val; - } - }, - hmacSha256Sync: { - configurable: false, - get() { - return _hmacSha256Sync; - }, - set(val) { - if (!_hmacSha256Sync) - _hmacSha256Sync = val; - } - } - }); - - // keys.ts - function generatePrivateKey() { - return utils.bytesToHex(utils.randomPrivateKey()); - } - function getPublicKey(privateKey) { - return utils.bytesToHex(schnorr.getPublicKey(privateKey)); - } - - // relay.ts - init_define_process(); - - // event.ts - init_define_process(); - - // node_modules/@noble/hashes/esm/sha256.js - init_define_process(); - - // node_modules/@noble/hashes/esm/_sha2.js - init_define_process(); - - // node_modules/@noble/hashes/esm/utils.js - init_define_process(); - - // node_modules/@noble/hashes/esm/cryptoBrowser.js - init_define_process(); - var crypto3 = { - node: void 0, - web: typeof self === "object" && "crypto" in self ? self.crypto : void 0 - }; - - // node_modules/@noble/hashes/esm/utils.js - var createView = (arr) => new DataView(arr.buffer, arr.byteOffset, arr.byteLength); - var rotr = (word, shift) => word << 32 - shift | word >>> shift; - var isLE = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68; - if (!isLE) - throw new Error("Non little-endian hardware is not supported"); - var hexes2 = Array.from({ length: 256 }, (v, i) => i.toString(16).padStart(2, "0")); - var nextTick = (() => { - const nodeRequire = typeof module !== "undefined" && typeof module.require === "function" && module.require.bind(module); - try { - if (nodeRequire) { - const { setImmediate } = nodeRequire("timers"); - return () => new Promise((resolve) => setImmediate(resolve)); - } - } catch (e) { - } - return () => new Promise((resolve) => setTimeout(resolve, 0)); - })(); - function utf8ToBytes(str) { - if (typeof str !== "string") { - throw new TypeError(`utf8ToBytes expected string, got ${typeof str}`); - } - return new TextEncoder().encode(str); - } - function toBytes(data) { - if (typeof data === "string") - data = utf8ToBytes(data); - if (!(data instanceof Uint8Array)) - throw new TypeError(`Expected input type is Uint8Array (got ${typeof data})`); - return data; - } - function assertNumber(n) { - if (!Number.isSafeInteger(n) || n < 0) - throw new Error(`Wrong positive integer: ${n}`); - } - function assertHash(hash2) { - if (typeof hash2 !== "function" || typeof hash2.create !== "function") - throw new Error("Hash should be wrapped by utils.wrapConstructor"); - assertNumber(hash2.outputLen); - assertNumber(hash2.blockLen); - } - var Hash = class { - clone() { - return this._cloneInto(); - } - }; - function wrapConstructor(hashConstructor) { - const hashC = (message) => hashConstructor().update(toBytes(message)).digest(); - const tmp = hashConstructor(); - hashC.outputLen = tmp.outputLen; - hashC.blockLen = tmp.blockLen; - hashC.create = () => hashConstructor(); - return hashC; - } - function randomBytes(bytesLength = 32) { - if (crypto3.web) { - return crypto3.web.getRandomValues(new Uint8Array(bytesLength)); - } else if (crypto3.node) { - return new Uint8Array(crypto3.node.randomBytes(bytesLength).buffer); - } else { - throw new Error("The environment doesn't have randomBytes function"); - } - } - - // node_modules/@noble/hashes/esm/_sha2.js - function setBigUint64(view, byteOffset, value, isLE3) { - if (typeof view.setBigUint64 === "function") - return view.setBigUint64(byteOffset, value, isLE3); - const _32n2 = BigInt(32); - const _u32_max = BigInt(4294967295); - const wh = Number(value >> _32n2 & _u32_max); - const wl = Number(value & _u32_max); - const h = isLE3 ? 4 : 0; - const l = isLE3 ? 0 : 4; - view.setUint32(byteOffset + h, wh, isLE3); - view.setUint32(byteOffset + l, wl, isLE3); - } - var SHA2 = class extends Hash { - constructor(blockLen, outputLen, padOffset, isLE3) { - super(); - this.blockLen = blockLen; - this.outputLen = outputLen; - this.padOffset = padOffset; - this.isLE = isLE3; - this.finished = false; - this.length = 0; - this.pos = 0; - this.destroyed = false; - this.buffer = new Uint8Array(blockLen); - this.view = createView(this.buffer); - } - update(data) { - if (this.destroyed) - throw new Error("instance is destroyed"); - const { view, buffer, blockLen, finished } = this; - if (finished) - throw new Error("digest() was already called"); - data = toBytes(data); - const len = data.length; - for (let pos = 0; pos < len; ) { - const take = Math.min(blockLen - this.pos, len - pos); - if (take === blockLen) { - const dataView = createView(data); - for (; blockLen <= len - pos; pos += blockLen) - this.process(dataView, pos); - continue; - } - buffer.set(data.subarray(pos, pos + take), this.pos); - this.pos += take; - pos += take; - if (this.pos === blockLen) { - this.process(view, 0); - this.pos = 0; - } - } - this.length += data.length; - this.roundClean(); - return this; - } - digestInto(out) { - if (this.destroyed) - throw new Error("instance is destroyed"); - if (!(out instanceof Uint8Array) || out.length < this.outputLen) - throw new Error("_Sha2: Invalid output buffer"); - if (this.finished) - throw new Error("digest() was already called"); - this.finished = true; - const { buffer, view, blockLen, isLE: isLE3 } = this; - let { pos } = this; - buffer[pos++] = 128; - this.buffer.subarray(pos).fill(0); - if (this.padOffset > blockLen - pos) { - this.process(view, 0); - pos = 0; - } - for (let i = pos; i < blockLen; i++) - buffer[i] = 0; - setBigUint64(view, blockLen - 8, BigInt(this.length * 8), isLE3); - this.process(view, 0); - const oview = createView(out); - this.get().forEach((v, i) => oview.setUint32(4 * i, v, isLE3)); - } - digest() { - const { buffer, outputLen } = this; - this.digestInto(buffer); - const res = buffer.slice(0, outputLen); - this.destroy(); - return res; - } - _cloneInto(to) { - to || (to = new this.constructor()); - to.set(...this.get()); - const { blockLen, buffer, length, finished, destroyed, pos } = this; - to.length = length; - to.pos = pos; - to.finished = finished; - to.destroyed = destroyed; - if (length % blockLen) - to.buffer.set(buffer); - return to; - } - }; - - // node_modules/@noble/hashes/esm/sha256.js - var Chi = (a, b, c) => a & b ^ ~a & c; - var Maj = (a, b, c) => a & b ^ a & c ^ b & c; - var SHA256_K = new Uint32Array([ - 1116352408, - 1899447441, - 3049323471, - 3921009573, - 961987163, - 1508970993, - 2453635748, - 2870763221, - 3624381080, - 310598401, - 607225278, - 1426881987, - 1925078388, - 2162078206, - 2614888103, - 3248222580, - 3835390401, - 4022224774, - 264347078, - 604807628, - 770255983, - 1249150122, - 1555081692, - 1996064986, - 2554220882, - 2821834349, - 2952996808, - 3210313671, - 3336571891, - 3584528711, - 113926993, - 338241895, - 666307205, - 773529912, - 1294757372, - 1396182291, - 1695183700, - 1986661051, - 2177026350, - 2456956037, - 2730485921, - 2820302411, - 3259730800, - 3345764771, - 3516065817, - 3600352804, - 4094571909, - 275423344, - 430227734, - 506948616, - 659060556, - 883997877, - 958139571, - 1322822218, - 1537002063, - 1747873779, - 1955562222, - 2024104815, - 2227730452, - 2361852424, - 2428436474, - 2756734187, - 3204031479, - 3329325298 - ]); - var IV = new Uint32Array([ - 1779033703, - 3144134277, - 1013904242, - 2773480762, - 1359893119, - 2600822924, - 528734635, - 1541459225 - ]); - var SHA256_W = new Uint32Array(64); - var SHA256 = class extends SHA2 { - constructor() { - super(64, 32, 8, false); - this.A = IV[0] | 0; - this.B = IV[1] | 0; - this.C = IV[2] | 0; - this.D = IV[3] | 0; - this.E = IV[4] | 0; - this.F = IV[5] | 0; - this.G = IV[6] | 0; - this.H = IV[7] | 0; - } - get() { - const { A, B, C, D, E, F, G, H } = this; - return [A, B, C, D, E, F, G, H]; - } - set(A, B, C, D, E, F, G, H) { - this.A = A | 0; - this.B = B | 0; - this.C = C | 0; - this.D = D | 0; - this.E = E | 0; - this.F = F | 0; - this.G = G | 0; - this.H = H | 0; - } - process(view, offset) { - for (let i = 0; i < 16; i++, offset += 4) - SHA256_W[i] = view.getUint32(offset, false); - for (let i = 16; i < 64; i++) { - const W15 = SHA256_W[i - 15]; - const W2 = SHA256_W[i - 2]; - const s0 = rotr(W15, 7) ^ rotr(W15, 18) ^ W15 >>> 3; - const s1 = rotr(W2, 17) ^ rotr(W2, 19) ^ W2 >>> 10; - SHA256_W[i] = s1 + SHA256_W[i - 7] + s0 + SHA256_W[i - 16] | 0; - } - let { A, B, C, D, E, F, G, H } = this; - for (let i = 0; i < 64; i++) { - const sigma1 = rotr(E, 6) ^ rotr(E, 11) ^ rotr(E, 25); - const T1 = H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i] | 0; - const sigma0 = rotr(A, 2) ^ rotr(A, 13) ^ rotr(A, 22); - const T2 = sigma0 + Maj(A, B, C) | 0; - H = G; - G = F; - F = E; - E = D + T1 | 0; - D = C; - C = B; - B = A; - A = T1 + T2 | 0; - } - A = A + this.A | 0; - B = B + this.B | 0; - C = C + this.C | 0; - D = D + this.D | 0; - E = E + this.E | 0; - F = F + this.F | 0; - G = G + this.G | 0; - H = H + this.H | 0; - this.set(A, B, C, D, E, F, G, H); - } - roundClean() { - SHA256_W.fill(0); - } - destroy() { - this.set(0, 0, 0, 0, 0, 0, 0, 0); - this.buffer.fill(0); - } - }; - var sha256 = wrapConstructor(() => new SHA256()); - - // utils.ts - var utils_exports = {}; - __export(utils_exports, { - insertEventIntoAscendingList: () => insertEventIntoAscendingList, - insertEventIntoDescendingList: () => insertEventIntoDescendingList, - normalizeURL: () => normalizeURL, - utf8Decoder: () => utf8Decoder, - utf8Encoder: () => utf8Encoder - }); - init_define_process(); - var utf8Decoder = new TextDecoder("utf-8"); - var utf8Encoder = new TextEncoder(); - function normalizeURL(url) { - let p = new URL(url); - p.pathname = p.pathname.replace(/\/+/g, "/"); - if (p.pathname.endsWith("/")) - p.pathname = p.pathname.slice(0, -1); - if (p.port === "80" && p.protocol === "ws:" || p.port === "443" && p.protocol === "wss:") - p.port = ""; - p.searchParams.sort(); - p.hash = ""; - return p.toString(); - } - function insertEventIntoDescendingList(sortedArray, event) { - let start = 0; - let end = sortedArray.length - 1; - let midPoint; - let position = start; - if (end < 0) { - position = 0; - } else if (event.created_at < sortedArray[end].created_at) { - position = end + 1; - } else if (event.created_at >= sortedArray[start].created_at) { - position = start; - } else - while (true) { - if (end <= start + 1) { - position = end; - break; - } - midPoint = Math.floor(start + (end - start) / 2); - if (sortedArray[midPoint].created_at > event.created_at) { - start = midPoint; - } else if (sortedArray[midPoint].created_at < event.created_at) { - end = midPoint; - } else { - position = midPoint; - break; - } - } - if (sortedArray[position]?.id !== event.id) { - return [ - ...sortedArray.slice(0, position), - event, - ...sortedArray.slice(position) - ]; - } - return sortedArray; - } - function insertEventIntoAscendingList(sortedArray, event) { - let start = 0; - let end = sortedArray.length - 1; - let midPoint; - let position = start; - if (end < 0) { - position = 0; - } else if (event.created_at > sortedArray[end].created_at) { - position = end + 1; - } else if (event.created_at <= sortedArray[start].created_at) { - position = start; - } else - while (true) { - if (end <= start + 1) { - position = end; - break; - } - midPoint = Math.floor(start + (end - start) / 2); - if (sortedArray[midPoint].created_at < event.created_at) { - start = midPoint; - } else if (sortedArray[midPoint].created_at > event.created_at) { - end = midPoint; - } else { - position = midPoint; - break; - } - } - if (sortedArray[position]?.id !== event.id) { - return [ - ...sortedArray.slice(0, position), - event, - ...sortedArray.slice(position) - ]; - } - return sortedArray; - } - - // event.ts - var Kind = /* @__PURE__ */ ((Kind2) => { - Kind2[Kind2["Metadata"] = 0] = "Metadata"; - Kind2[Kind2["Text"] = 1] = "Text"; - Kind2[Kind2["RecommendRelay"] = 2] = "RecommendRelay"; - Kind2[Kind2["Contacts"] = 3] = "Contacts"; - Kind2[Kind2["EncryptedDirectMessage"] = 4] = "EncryptedDirectMessage"; - Kind2[Kind2["EventDeletion"] = 5] = "EventDeletion"; - Kind2[Kind2["Reaction"] = 7] = "Reaction"; - Kind2[Kind2["ChannelCreation"] = 40] = "ChannelCreation"; - Kind2[Kind2["ChannelMetadata"] = 41] = "ChannelMetadata"; - Kind2[Kind2["ChannelMessage"] = 42] = "ChannelMessage"; - Kind2[Kind2["ChannelHideMessage"] = 43] = "ChannelHideMessage"; - Kind2[Kind2["ChannelMuteUser"] = 44] = "ChannelMuteUser"; - Kind2[Kind2["Report"] = 1984] = "Report"; - Kind2[Kind2["ZapRequest"] = 9734] = "ZapRequest"; - Kind2[Kind2["Zap"] = 9735] = "Zap"; - Kind2[Kind2["RelayList"] = 10002] = "RelayList"; - Kind2[Kind2["ClientAuth"] = 22242] = "ClientAuth"; - Kind2[Kind2["Article"] = 30023] = "Article"; - return Kind2; - })(Kind || {}); - function getBlankEvent() { - return { - kind: 255, - content: "", - tags: [], - created_at: 0 - }; - } - function finishEvent(t, privateKey) { - let event = t; - event.pubkey = getPublicKey(privateKey); - event.id = getEventHash(event); - event.sig = signEvent(event, privateKey); - return event; - } - function serializeEvent(evt) { - if (!validateEvent(evt)) - throw new Error("can't serialize event with wrong or missing properties"); - return JSON.stringify([ - 0, - evt.pubkey, - evt.created_at, - evt.kind, - evt.tags, - evt.content - ]); - } - function getEventHash(event) { - let eventHash = sha256(utf8Encoder.encode(serializeEvent(event))); - return utils.bytesToHex(eventHash); - } - function validateEvent(event) { - if (typeof event !== "object") - return false; - if (typeof event.content !== "string") - return false; - if (typeof event.created_at !== "number") - return false; - if (typeof event.pubkey !== "string") - return false; - if (!event.pubkey.match(/^[a-f0-9]{64}$/)) - return false; - if (!Array.isArray(event.tags)) - return false; - for (let i = 0; i < event.tags.length; i++) { - let tag = event.tags[i]; - if (!Array.isArray(tag)) - return false; - for (let j = 0; j < tag.length; j++) { - if (typeof tag[j] === "object") - return false; - } - } - return true; - } - function verifySignature(event) { - return schnorr.verifySync( - event.sig, - getEventHash(event), - event.pubkey - ); - } - function signEvent(event, key) { - return utils.bytesToHex( - schnorr.signSync(getEventHash(event), key) - ); - } - - // filter.ts - init_define_process(); - function matchFilter(filter, event) { - if (filter.ids && filter.ids.indexOf(event.id) === -1) - return false; - if (filter.kinds && filter.kinds.indexOf(event.kind) === -1) - return false; - if (filter.authors && filter.authors.indexOf(event.pubkey) === -1) - return false; - for (let f2 in filter) { - if (f2[0] === "#") { - let tagName = f2.slice(1); - let values = filter[`#${tagName}`]; - if (values && !event.tags.find( - ([t, v]) => t === f2.slice(1) && values.indexOf(v) !== -1 - )) - return false; - } - } - if (filter.since && event.created_at < filter.since) - return false; - if (filter.until && event.created_at >= filter.until) - return false; - return true; - } - function matchFilters(filters, event) { - for (let i = 0; i < filters.length; i++) { - if (matchFilter(filters[i], event)) - return true; - } - return false; - } - - // fakejson.ts - var fakejson_exports = {}; - __export(fakejson_exports, { - getHex64: () => getHex64, - getInt: () => getInt, - getSubscriptionId: () => getSubscriptionId, - matchEventId: () => matchEventId, - matchEventKind: () => matchEventKind, - matchEventPubkey: () => matchEventPubkey - }); - init_define_process(); - function getHex64(json, field) { - let len = field.length + 3; - let idx = json.indexOf(`"${field}":`) + len; - let s = json.slice(idx).indexOf(`"`) + idx + 1; - return json.slice(s, s + 64); - } - function getInt(json, field) { - let len = field.length; - let idx = json.indexOf(`"${field}":`) + len + 3; - let sliced = json.slice(idx); - let end = Math.min(sliced.indexOf(","), sliced.indexOf("}")); - return parseInt(sliced.slice(0, end), 10); - } - function getSubscriptionId(json) { - let idx = json.slice(0, 22).indexOf(`"EVENT"`); - if (idx === -1) - return null; - let pstart = json.slice(idx + 7 + 1).indexOf(`"`); - if (pstart === -1) - return null; - let start = idx + 7 + 1 + pstart; - let pend = json.slice(start + 1, 80).indexOf(`"`); - if (pend === -1) - return null; - let end = start + 1 + pend; - return json.slice(start + 1, end); - } - function matchEventId(json, id) { - return id === getHex64(json, "id"); - } - function matchEventPubkey(json, pubkey) { - return pubkey === getHex64(json, "pubkey"); - } - function matchEventKind(json, kind) { - return kind === getInt(json, "kind"); - } - - // relay.ts - function relayInit(url) { - var ws; - var openSubs = {}; - var listeners = { - connect: [], - disconnect: [], - error: [], - notice: [] - }; - var subListeners = {}; - var pubListeners = {}; - async function connectRelay() { - return new Promise((resolve, reject) => { - ws = new WebSocket(url); - ws.onopen = () => { - listeners.connect.forEach((cb) => cb()); - resolve(); - }; - ws.onerror = () => { - listeners.error.forEach((cb) => cb()); - reject(); - }; - ws.onclose = async () => { - listeners.disconnect.forEach((cb) => cb()); - }; - let incomingMessageQueue = []; - let handleNextInterval; - ws.onmessage = (e) => { - incomingMessageQueue.push(e.data); - if (!handleNextInterval) { - handleNextInterval = setInterval(handleNext, 0); - } - }; - function handleNext() { - if (incomingMessageQueue.length === 0) { - clearInterval(handleNextInterval); - handleNextInterval = null; - return; - } - var json = incomingMessageQueue.shift(); - if (!json) - return; - let subid = getSubscriptionId(json); - if (subid) { - let so = openSubs[subid]; - if (so && so.alreadyHaveEvent && so.alreadyHaveEvent(getHex64(json, "id"), url)) { - return; - } - } - try { - let data = JSON.parse(json); - switch (data[0]) { - case "EVENT": - let id = data[1]; - let event = data[2]; - if (validateEvent(event) && openSubs[id] && (openSubs[id].skipVerification || verifySignature(event)) && matchFilters(openSubs[id].filters, event)) { - openSubs[id]; - (subListeners[id]?.event || []).forEach((cb) => cb(event)); - } - return; - case "EOSE": { - let id2 = data[1]; - if (id2 in subListeners) { - subListeners[id2].eose.forEach((cb) => cb()); - subListeners[id2].eose = []; - } - return; - } - case "OK": { - let id2 = data[1]; - let ok = data[2]; - let reason = data[3] || ""; - if (id2 in pubListeners) { - if (ok) - pubListeners[id2].ok.forEach((cb) => cb()); - else - pubListeners[id2].failed.forEach((cb) => cb(reason)); - pubListeners[id2].ok = []; - pubListeners[id2].failed = []; - } - return; - } - case "NOTICE": - let notice = data[1]; - listeners.notice.forEach((cb) => cb(notice)); - return; - } - } catch (err) { - return; - } - } - }); - } - function connected() { - return ws?.readyState === 1; - } - async function connect() { - if (connected()) - return; - await connectRelay(); - } - async function trySend(params) { - let msg = JSON.stringify(params); - if (!connected()) { - await new Promise((resolve) => setTimeout(resolve, 1e3)); - if (!connected()) { - return; - } - } - try { - ws.send(msg); - } catch (err) { - console.log(err); - } - } - const sub = (filters, { - skipVerification = false, - alreadyHaveEvent = null, - id = Math.random().toString().slice(2) - } = {}) => { - let subid = id; - openSubs[subid] = { - id: subid, - filters, - skipVerification, - alreadyHaveEvent - }; - trySend(["REQ", subid, ...filters]); - return { - sub: (newFilters, newOpts = {}) => sub(newFilters || filters, { - skipVerification: newOpts.skipVerification || skipVerification, - alreadyHaveEvent: newOpts.alreadyHaveEvent || alreadyHaveEvent, - id: subid - }), - unsub: () => { - delete openSubs[subid]; - delete subListeners[subid]; - trySend(["CLOSE", subid]); - }, - on: (type, cb) => { - subListeners[subid] = subListeners[subid] || { - event: [], - eose: [] - }; - subListeners[subid][type].push(cb); - }, - off: (type, cb) => { - let listeners2 = subListeners[subid]; - let idx = listeners2[type].indexOf(cb); - if (idx >= 0) - listeners2[type].splice(idx, 1); - } - }; - }; - return { - url, - sub, - on: (type, cb) => { - listeners[type].push(cb); - if (type === "connect" && ws?.readyState === 1) { - cb(); - } - }, - off: (type, cb) => { - let index = listeners[type].indexOf(cb); - if (index !== -1) - listeners[type].splice(index, 1); - }, - list: (filters, opts) => new Promise((resolve) => { - let s = sub(filters, opts); - let events = []; - let timeout = setTimeout(() => { - s.unsub(); - resolve(events); - }, 1500); - s.on("eose", () => { - s.unsub(); - clearTimeout(timeout); - resolve(events); - }); - s.on("event", (event) => { - events.push(event); - }); - }), - get: (filter, opts) => new Promise((resolve) => { - let s = sub([filter], opts); - let timeout = setTimeout(() => { - s.unsub(); - resolve(null); - }, 1500); - s.on("event", (event) => { - s.unsub(); - clearTimeout(timeout); - resolve(event); - }); - }), - publish(event) { - if (!event.id) - throw new Error(`event ${event} has no id`); - let id = event.id; - trySend(["EVENT", event]); - return { - on: (type, cb) => { - pubListeners[id] = pubListeners[id] || { - ok: [], - failed: [] - }; - pubListeners[id][type].push(cb); - }, - off: (type, cb) => { - let listeners2 = pubListeners[id]; - if (!listeners2) - return; - let idx = listeners2[type].indexOf(cb); - if (idx >= 0) - listeners2[type].splice(idx, 1); - } - }; - }, - connect, - close() { - listeners = { connect: [], disconnect: [], error: [], notice: [] }; - subListeners = {}; - pubListeners = {}; - ws?.close(); - }, - get status() { - return ws?.readyState ?? 3; - } - }; - } - - // pool.ts - init_define_process(); - var SimplePool = class { - _conn; - _seenOn = {}; - eoseSubTimeout; - getTimeout; - constructor(options = {}) { - this._conn = {}; - this.eoseSubTimeout = options.eoseSubTimeout || 3400; - this.getTimeout = options.getTimeout || 3400; - } - close(relays) { - relays.forEach((url) => { - let relay = this._conn[normalizeURL(url)]; - if (relay) - relay.close(); - }); - } - async ensureRelay(url) { - const nm = normalizeURL(url); - const existing = this._conn[nm]; - if (existing) - return existing; - const relay = relayInit(nm); - this._conn[nm] = relay; - await relay.connect(); - return relay; - } - sub(relays, filters, opts) { - let _knownIds = /* @__PURE__ */ new Set(); - let modifiedOpts = opts || {}; - modifiedOpts.alreadyHaveEvent = (id, url) => { - let set = this._seenOn[id] || /* @__PURE__ */ new Set(); - set.add(url); - this._seenOn[id] = set; - return _knownIds.has(id); - }; - let subs = []; - let eventListeners = /* @__PURE__ */ new Set(); - let eoseListeners = /* @__PURE__ */ new Set(); - let eosesMissing = relays.length; - let eoseSent = false; - let eoseTimeout = setTimeout(() => { - eoseSent = true; - for (let cb of eoseListeners.values()) - cb(); - }, this.eoseSubTimeout); - relays.forEach(async (relay) => { - let r; - try { - r = await this.ensureRelay(relay); - } catch (err) { - handleEose(); - return; - } - if (!r) - return; - let s = r.sub(filters, modifiedOpts); - s.on("event", (event) => { - _knownIds.add(event.id); - for (let cb of eventListeners.values()) - cb(event); - }); - s.on("eose", () => { - if (eoseSent) - return; - handleEose(); - }); - subs.push(s); - function handleEose() { - eosesMissing--; - if (eosesMissing === 0) { - clearTimeout(eoseTimeout); - for (let cb of eoseListeners.values()) - cb(); - } - } - }); - let greaterSub = { - sub(filters2, opts2) { - subs.forEach((sub) => sub.sub(filters2, opts2)); - return greaterSub; - }, - unsub() { - subs.forEach((sub) => sub.unsub()); - }, - on(type, cb) { - switch (type) { - case "event": - eventListeners.add(cb); - break; - case "eose": - eoseListeners.add(cb); - break; - } - }, - off(type, cb) { - if (type === "event") { - eventListeners.delete(cb); - } else if (type === "eose") - eoseListeners.delete(cb); - } - }; - return greaterSub; - } - get(relays, filter, opts) { - return new Promise((resolve) => { - let sub = this.sub(relays, [filter], opts); - let timeout = setTimeout(() => { - sub.unsub(); - resolve(null); - }, this.getTimeout); - sub.on("event", (event) => { - resolve(event); - clearTimeout(timeout); - sub.unsub(); - }); - }); - } - list(relays, filters, opts) { - return new Promise((resolve) => { - let events = []; - let sub = this.sub(relays, filters, opts); - sub.on("event", (event) => { - events.push(event); - }); - sub.on("eose", () => { - sub.unsub(); - resolve(events); - }); - }); - } - publish(relays, event) { - let pubs = relays.map((relay) => { - let r = this._conn[normalizeURL(relay)]; - if (!r) - return badPub(relay); - return r.publish(event); - }); - return { - on(type, cb) { - pubs.forEach((pub, i) => { - pub.on(type, () => cb(relays[i])); - }); - }, - off() { - } - }; - } - seenOn(id) { - return Array.from(this._seenOn[id]?.values?.() || []); - } - }; - function badPub(relay) { - return { - on(typ, cb) { - if (typ === "failed") - cb(`relay ${relay} not connected`); - }, - off() { - } - }; - } - - // nip04.ts - var nip04_exports = {}; - __export(nip04_exports, { - decrypt: () => decrypt, - encrypt: () => encrypt - }); - init_define_process(); - - // node_modules/@scure/base/lib/esm/index.js - init_define_process(); - function assertNumber2(n) { - if (!Number.isSafeInteger(n)) - throw new Error(`Wrong integer: ${n}`); - } - function chain(...args) { - const wrap = (a, b) => (c) => a(b(c)); - const encode = Array.from(args).reverse().reduce((acc, i) => acc ? wrap(acc, i.encode) : i.encode, void 0); - const decode2 = args.reduce((acc, i) => acc ? wrap(acc, i.decode) : i.decode, void 0); - return { encode, decode: decode2 }; - } - function alphabet(alphabet2) { - return { - encode: (digits) => { - if (!Array.isArray(digits) || digits.length && typeof digits[0] !== "number") - throw new Error("alphabet.encode input should be an array of numbers"); - return digits.map((i) => { - assertNumber2(i); - if (i < 0 || i >= alphabet2.length) - throw new Error(`Digit index outside alphabet: ${i} (alphabet: ${alphabet2.length})`); - return alphabet2[i]; - }); - }, - decode: (input) => { - if (!Array.isArray(input) || input.length && typeof input[0] !== "string") - throw new Error("alphabet.decode input should be array of strings"); - return input.map((letter) => { - if (typeof letter !== "string") - throw new Error(`alphabet.decode: not string element=${letter}`); - const index = alphabet2.indexOf(letter); - if (index === -1) - throw new Error(`Unknown letter: "${letter}". Allowed: ${alphabet2}`); - return index; - }); - } - }; - } - function join(separator = "") { - if (typeof separator !== "string") - throw new Error("join separator should be string"); - return { - encode: (from) => { - if (!Array.isArray(from) || from.length && typeof from[0] !== "string") - throw new Error("join.encode input should be array of strings"); - for (let i of from) - if (typeof i !== "string") - throw new Error(`join.encode: non-string input=${i}`); - return from.join(separator); - }, - decode: (to) => { - if (typeof to !== "string") - throw new Error("join.decode input should be string"); - return to.split(separator); - } - }; - } - function padding(bits, chr = "=") { - assertNumber2(bits); - if (typeof chr !== "string") - throw new Error("padding chr should be string"); - return { - encode(data) { - if (!Array.isArray(data) || data.length && typeof data[0] !== "string") - throw new Error("padding.encode input should be array of strings"); - for (let i of data) - if (typeof i !== "string") - throw new Error(`padding.encode: non-string input=${i}`); - while (data.length * bits % 8) - data.push(chr); - return data; - }, - decode(input) { - if (!Array.isArray(input) || input.length && typeof input[0] !== "string") - throw new Error("padding.encode input should be array of strings"); - for (let i of input) - if (typeof i !== "string") - throw new Error(`padding.decode: non-string input=${i}`); - let end = input.length; - if (end * bits % 8) - throw new Error("Invalid padding: string should have whole number of bytes"); - for (; end > 0 && input[end - 1] === chr; end--) { - if (!((end - 1) * bits % 8)) - throw new Error("Invalid padding: string has too much padding"); - } - return input.slice(0, end); - } - }; - } - function normalize(fn) { - if (typeof fn !== "function") - throw new Error("normalize fn should be function"); - return { encode: (from) => from, decode: (to) => fn(to) }; - } - function convertRadix(data, from, to) { - if (from < 2) - throw new Error(`convertRadix: wrong from=${from}, base cannot be less than 2`); - if (to < 2) - throw new Error(`convertRadix: wrong to=${to}, base cannot be less than 2`); - if (!Array.isArray(data)) - throw new Error("convertRadix: data should be array"); - if (!data.length) - return []; - let pos = 0; - const res = []; - const digits = Array.from(data); - digits.forEach((d) => { - assertNumber2(d); - if (d < 0 || d >= from) - throw new Error(`Wrong integer: ${d}`); - }); - while (true) { - let carry = 0; - let done = true; - for (let i = pos; i < digits.length; i++) { - const digit = digits[i]; - const digitBase = from * carry + digit; - if (!Number.isSafeInteger(digitBase) || from * carry / from !== carry || digitBase - digit !== from * carry) { - throw new Error("convertRadix: carry overflow"); - } - carry = digitBase % to; - digits[i] = Math.floor(digitBase / to); - if (!Number.isSafeInteger(digits[i]) || digits[i] * to + carry !== digitBase) - throw new Error("convertRadix: carry overflow"); - if (!done) - continue; - else if (!digits[i]) - pos = i; - else - done = false; - } - res.push(carry); - if (done) - break; - } - for (let i = 0; i < data.length - 1 && data[i] === 0; i++) - res.push(0); - return res.reverse(); - } - var gcd = (a, b) => !b ? a : gcd(b, a % b); - var radix2carry = (from, to) => from + (to - gcd(from, to)); - function convertRadix2(data, from, to, padding2) { - if (!Array.isArray(data)) - throw new Error("convertRadix2: data should be array"); - if (from <= 0 || from > 32) - throw new Error(`convertRadix2: wrong from=${from}`); - if (to <= 0 || to > 32) - throw new Error(`convertRadix2: wrong to=${to}`); - if (radix2carry(from, to) > 32) { - throw new Error(`convertRadix2: carry overflow from=${from} to=${to} carryBits=${radix2carry(from, to)}`); - } - let carry = 0; - let pos = 0; - const mask = 2 ** to - 1; - const res = []; - for (const n of data) { - assertNumber2(n); - if (n >= 2 ** from) - throw new Error(`convertRadix2: invalid data word=${n} from=${from}`); - carry = carry << from | n; - if (pos + from > 32) - throw new Error(`convertRadix2: carry overflow pos=${pos} from=${from}`); - pos += from; - for (; pos >= to; pos -= to) - res.push((carry >> pos - to & mask) >>> 0); - carry &= 2 ** pos - 1; - } - carry = carry << to - pos & mask; - if (!padding2 && pos >= from) - throw new Error("Excess padding"); - if (!padding2 && carry) - throw new Error(`Non-zero padding: ${carry}`); - if (padding2 && pos > 0) - res.push(carry >>> 0); - return res; - } - function radix(num) { - assertNumber2(num); - return { - encode: (bytes2) => { - if (!(bytes2 instanceof Uint8Array)) - throw new Error("radix.encode input should be Uint8Array"); - return convertRadix(Array.from(bytes2), 2 ** 8, num); - }, - decode: (digits) => { - if (!Array.isArray(digits) || digits.length && typeof digits[0] !== "number") - throw new Error("radix.decode input should be array of strings"); - return Uint8Array.from(convertRadix(digits, num, 2 ** 8)); - } - }; - } - function radix2(bits, revPadding = false) { - assertNumber2(bits); - if (bits <= 0 || bits > 32) - throw new Error("radix2: bits should be in (0..32]"); - if (radix2carry(8, bits) > 32 || radix2carry(bits, 8) > 32) - throw new Error("radix2: carry overflow"); - return { - encode: (bytes2) => { - if (!(bytes2 instanceof Uint8Array)) - throw new Error("radix2.encode input should be Uint8Array"); - return convertRadix2(Array.from(bytes2), 8, bits, !revPadding); - }, - decode: (digits) => { - if (!Array.isArray(digits) || digits.length && typeof digits[0] !== "number") - throw new Error("radix2.decode input should be array of strings"); - return Uint8Array.from(convertRadix2(digits, bits, 8, revPadding)); - } - }; - } - function unsafeWrapper(fn) { - if (typeof fn !== "function") - throw new Error("unsafeWrapper fn should be function"); - return function(...args) { - try { - return fn.apply(null, args); - } catch (e) { - } - }; - } - function checksum(len, fn) { - assertNumber2(len); - if (typeof fn !== "function") - throw new Error("checksum fn should be function"); - return { - encode(data) { - if (!(data instanceof Uint8Array)) - throw new Error("checksum.encode: input should be Uint8Array"); - const checksum2 = fn(data).slice(0, len); - const res = new Uint8Array(data.length + len); - res.set(data); - res.set(checksum2, data.length); - return res; - }, - decode(data) { - if (!(data instanceof Uint8Array)) - throw new Error("checksum.decode: input should be Uint8Array"); - const payload = data.slice(0, -len); - const newChecksum = fn(payload).slice(0, len); - const oldChecksum = data.slice(-len); - for (let i = 0; i < len; i++) - if (newChecksum[i] !== oldChecksum[i]) - throw new Error("Invalid checksum"); - return payload; - } - }; - } - var base16 = chain(radix2(4), alphabet("0123456789ABCDEF"), join("")); - var base32 = chain(radix2(5), alphabet("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"), padding(5), join("")); - var base32hex = chain(radix2(5), alphabet("0123456789ABCDEFGHIJKLMNOPQRSTUV"), padding(5), join("")); - var base32crockford = chain(radix2(5), alphabet("0123456789ABCDEFGHJKMNPQRSTVWXYZ"), join(""), normalize((s) => s.toUpperCase().replace(/O/g, "0").replace(/[IL]/g, "1"))); - var base64 = chain(radix2(6), alphabet("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"), padding(6), join("")); - var base64url = chain(radix2(6), alphabet("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"), padding(6), join("")); - var genBase58 = (abc) => chain(radix(58), alphabet(abc), join("")); - var base58 = genBase58("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"); - var base58flickr = genBase58("123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"); - var base58xrp = genBase58("rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz"); - var XMR_BLOCK_LEN = [0, 2, 3, 5, 6, 7, 9, 10, 11]; - var base58xmr = { - encode(data) { - let res = ""; - for (let i = 0; i < data.length; i += 8) { - const block = data.subarray(i, i + 8); - res += base58.encode(block).padStart(XMR_BLOCK_LEN[block.length], "1"); - } - return res; - }, - decode(str) { - let res = []; - for (let i = 0; i < str.length; i += 11) { - const slice = str.slice(i, i + 11); - const blockLen = XMR_BLOCK_LEN.indexOf(slice.length); - const block = base58.decode(slice); - for (let j = 0; j < block.length - blockLen; j++) { - if (block[j] !== 0) - throw new Error("base58xmr: wrong padding"); - } - res = res.concat(Array.from(block.slice(block.length - blockLen))); - } - return Uint8Array.from(res); - } - }; - var base58check = (sha2563) => chain(checksum(4, (data) => sha2563(sha2563(data))), base58); - var BECH_ALPHABET = chain(alphabet("qpzry9x8gf2tvdw0s3jn54khce6mua7l"), join("")); - var POLYMOD_GENERATORS = [996825010, 642813549, 513874426, 1027748829, 705979059]; - function bech32Polymod(pre) { - const b = pre >> 25; - let chk = (pre & 33554431) << 5; - for (let i = 0; i < POLYMOD_GENERATORS.length; i++) { - if ((b >> i & 1) === 1) - chk ^= POLYMOD_GENERATORS[i]; - } - return chk; - } - function bechChecksum(prefix, words, encodingConst = 1) { - const len = prefix.length; - let chk = 1; - for (let i = 0; i < len; i++) { - const c = prefix.charCodeAt(i); - if (c < 33 || c > 126) - throw new Error(`Invalid prefix (${prefix})`); - chk = bech32Polymod(chk) ^ c >> 5; - } - chk = bech32Polymod(chk); - for (let i = 0; i < len; i++) - chk = bech32Polymod(chk) ^ prefix.charCodeAt(i) & 31; - for (let v of words) - chk = bech32Polymod(chk) ^ v; - for (let i = 0; i < 6; i++) - chk = bech32Polymod(chk); - chk ^= encodingConst; - return BECH_ALPHABET.encode(convertRadix2([chk % 2 ** 30], 30, 5, false)); - } - function genBech32(encoding) { - const ENCODING_CONST = encoding === "bech32" ? 1 : 734539939; - const _words = radix2(5); - const fromWords = _words.decode; - const toWords = _words.encode; - const fromWordsUnsafe = unsafeWrapper(fromWords); - function encode(prefix, words, limit = 90) { - if (typeof prefix !== "string") - throw new Error(`bech32.encode prefix should be string, not ${typeof prefix}`); - if (!Array.isArray(words) || words.length && typeof words[0] !== "number") - throw new Error(`bech32.encode words should be array of numbers, not ${typeof words}`); - const actualLength = prefix.length + 7 + words.length; - if (limit !== false && actualLength > limit) - throw new TypeError(`Length ${actualLength} exceeds limit ${limit}`); - prefix = prefix.toLowerCase(); - return `${prefix}1${BECH_ALPHABET.encode(words)}${bechChecksum(prefix, words, ENCODING_CONST)}`; - } - function decode2(str, limit = 90) { - if (typeof str !== "string") - throw new Error(`bech32.decode input should be string, not ${typeof str}`); - if (str.length < 8 || limit !== false && str.length > limit) - throw new TypeError(`Wrong string length: ${str.length} (${str}). Expected (8..${limit})`); - const lowered = str.toLowerCase(); - if (str !== lowered && str !== str.toUpperCase()) - throw new Error(`String must be lowercase or uppercase`); - str = lowered; - const sepIndex = str.lastIndexOf("1"); - if (sepIndex === 0 || sepIndex === -1) - throw new Error(`Letter "1" must be present between prefix and data only`); - const prefix = str.slice(0, sepIndex); - const _words2 = str.slice(sepIndex + 1); - if (_words2.length < 6) - throw new Error("Data must be at least 6 characters long"); - const words = BECH_ALPHABET.decode(_words2).slice(0, -6); - const sum = bechChecksum(prefix, words, ENCODING_CONST); - if (!_words2.endsWith(sum)) - throw new Error(`Invalid checksum in ${str}: expected "${sum}"`); - return { prefix, words }; - } - const decodeUnsafe = unsafeWrapper(decode2); - function decodeToBytes(str) { - const { prefix, words } = decode2(str, false); - return { prefix, words, bytes: fromWords(words) }; - } - return { encode, decode: decode2, decodeToBytes, decodeUnsafe, fromWords, fromWordsUnsafe, toWords }; - } - var bech32 = genBech32("bech32"); - var bech32m = genBech32("bech32m"); - var utf8 = { - encode: (data) => new TextDecoder().decode(data), - decode: (str) => new TextEncoder().encode(str) - }; - var hex = chain(radix2(4), alphabet("0123456789abcdef"), join(""), normalize((s) => { - if (typeof s !== "string" || s.length % 2) - throw new TypeError(`hex.decode: expected string, got ${typeof s} with length ${s.length}`); - return s.toLowerCase(); - })); - var CODERS = { - utf8, - hex, - base16, - base32, - base64, - base64url, - base58, - base58xmr - }; - var coderTypeError = `Invalid encoding type. Available types: ${Object.keys(CODERS).join(", ")}`; - - // nip04.ts - async function encrypt(privkey, pubkey, text) { - const key = getSharedSecret(privkey, "02" + pubkey); - const normalizedKey = getNormalizedX(key); - let iv = Uint8Array.from(randomBytes(16)); - let plaintext = utf8Encoder.encode(text); - let cryptoKey = await crypto.subtle.importKey( - "raw", - normalizedKey, - { name: "AES-CBC" }, - false, - ["encrypt"] - ); - let ciphertext = await crypto.subtle.encrypt( - { name: "AES-CBC", iv }, - cryptoKey, - plaintext - ); - let ctb64 = base64.encode(new Uint8Array(ciphertext)); - let ivb64 = base64.encode(new Uint8Array(iv.buffer)); - return `${ctb64}?iv=${ivb64}`; - } - async function decrypt(privkey, pubkey, data) { - let [ctb64, ivb64] = data.split("?iv="); - let key = getSharedSecret(privkey, "02" + pubkey); - let normalizedKey = getNormalizedX(key); - let cryptoKey = await crypto.subtle.importKey( - "raw", - normalizedKey, - { name: "AES-CBC" }, - false, - ["decrypt"] - ); - let ciphertext = base64.decode(ctb64); - let iv = base64.decode(ivb64); - let plaintext = await crypto.subtle.decrypt( - { name: "AES-CBC", iv }, - cryptoKey, - ciphertext - ); - let text = utf8Decoder.decode(plaintext); - return text; - } - function getNormalizedX(key) { - return key.slice(1, 33); - } - - // nip05.ts - var nip05_exports = {}; - __export(nip05_exports, { - queryProfile: () => queryProfile, - searchDomain: () => searchDomain, - useFetchImplementation: () => useFetchImplementation - }); - init_define_process(); - var _fetch; - try { - _fetch = fetch; - } catch { - } - function useFetchImplementation(fetchImplementation) { - _fetch = fetchImplementation; - } - async function searchDomain(domain, query = "") { - try { - let res = await (await _fetch(`https://${domain}/.well-known/nostr.json?name=${query}`)).json(); - return res.names; - } catch (_) { - return {}; - } - } - async function queryProfile(fullname) { - let [name, domain] = fullname.split("@"); - if (!domain) { - domain = name; - name = "_"; - } - if (!name.match(/^[A-Za-z0-9-_]+$/)) - return null; - let res = await (await _fetch(`https://${domain}/.well-known/nostr.json?name=${name}`)).json(); - if (!res?.names?.[name]) - return null; - let pubkey = res.names[name]; - let relays = res.relays?.[pubkey] || []; - return { - pubkey, - relays - }; - } - - // nip06.ts - var nip06_exports = {}; - __export(nip06_exports, { - generateSeedWords: () => generateSeedWords, - privateKeyFromSeedWords: () => privateKeyFromSeedWords, - validateWords: () => validateWords - }); - init_define_process(); - var import_english = __toESM(require_english()); - var import_bip39 = __toESM(require_bip39()); - - // node_modules/@scure/bip32/lib/esm/index.js - init_define_process(); - - // node_modules/@scure/bip32/node_modules/@noble/hashes/esm/hmac.js - init_define_process(); - - // node_modules/@scure/bip32/node_modules/@noble/hashes/esm/_assert.js - init_define_process(); - function number(n) { - if (!Number.isSafeInteger(n) || n < 0) - throw new Error(`Wrong positive integer: ${n}`); - } - function bool(b) { - if (typeof b !== "boolean") - throw new Error(`Expected boolean, not ${b}`); - } - function bytes(b, ...lengths) { - if (!(b instanceof Uint8Array)) - throw new TypeError("Expected Uint8Array"); - if (lengths.length > 0 && !lengths.includes(b.length)) - throw new TypeError(`Expected Uint8Array of length ${lengths}, not of length=${b.length}`); - } - function hash(hash2) { - if (typeof hash2 !== "function" || typeof hash2.create !== "function") - throw new Error("Hash should be wrapped by utils.wrapConstructor"); - number(hash2.outputLen); - number(hash2.blockLen); - } - function exists(instance, checkFinished = true) { - if (instance.destroyed) - throw new Error("Hash instance has been destroyed"); - if (checkFinished && instance.finished) - throw new Error("Hash#digest() has already been called"); - } - function output(out, instance) { - bytes(out); - const min = instance.outputLen; - if (out.length < min) { - throw new Error(`digestInto() expects output buffer of length at least ${min}`); - } - } - var assert = { - number, - bool, - bytes, - hash, - exists, - output - }; - var assert_default = assert; - - // node_modules/@scure/bip32/node_modules/@noble/hashes/esm/utils.js - init_define_process(); - - // node_modules/@scure/bip32/node_modules/@noble/hashes/esm/cryptoBrowser.js - init_define_process(); - var crypto4 = { - node: void 0, - web: typeof self === "object" && "crypto" in self ? self.crypto : void 0 - }; - - // node_modules/@scure/bip32/node_modules/@noble/hashes/esm/utils.js - var createView2 = (arr) => new DataView(arr.buffer, arr.byteOffset, arr.byteLength); - var rotr2 = (word, shift) => word << 32 - shift | word >>> shift; - var isLE2 = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68; - if (!isLE2) - throw new Error("Non little-endian hardware is not supported"); - var hexes3 = Array.from({ length: 256 }, (v, i) => i.toString(16).padStart(2, "0")); - function bytesToHex2(uint8a) { - if (!(uint8a instanceof Uint8Array)) - throw new Error("Uint8Array expected"); - let hex2 = ""; - for (let i = 0; i < uint8a.length; i++) { - hex2 += hexes3[uint8a[i]]; - } - return hex2; - } - function hexToBytes2(hex2) { - if (typeof hex2 !== "string") { - throw new TypeError("hexToBytes: expected string, got " + typeof hex2); - } - if (hex2.length % 2) - throw new Error("hexToBytes: received invalid unpadded hex"); - const array = new Uint8Array(hex2.length / 2); - for (let i = 0; i < array.length; i++) { - const j = i * 2; - const hexByte = hex2.slice(j, j + 2); - const byte = Number.parseInt(hexByte, 16); - if (Number.isNaN(byte) || byte < 0) - throw new Error("Invalid byte sequence"); - array[i] = byte; - } - return array; - } - function utf8ToBytes2(str) { - if (typeof str !== "string") { - throw new TypeError(`utf8ToBytes expected string, got ${typeof str}`); - } - return new TextEncoder().encode(str); - } - function toBytes2(data) { - if (typeof data === "string") - data = utf8ToBytes2(data); - if (!(data instanceof Uint8Array)) - throw new TypeError(`Expected input type is Uint8Array (got ${typeof data})`); - return data; - } - function concatBytes2(...arrays) { - if (!arrays.every((a) => a instanceof Uint8Array)) - throw new Error("Uint8Array list expected"); - if (arrays.length === 1) - return arrays[0]; - const length = arrays.reduce((a, arr) => a + arr.length, 0); - const result = new Uint8Array(length); - for (let i = 0, pad = 0; i < arrays.length; i++) { - const arr = arrays[i]; - result.set(arr, pad); - pad += arr.length; - } - return result; - } - var Hash2 = class { - clone() { - return this._cloneInto(); - } - }; - function wrapConstructor2(hashConstructor) { - const hashC = (message) => hashConstructor().update(toBytes2(message)).digest(); - const tmp = hashConstructor(); - hashC.outputLen = tmp.outputLen; - hashC.blockLen = tmp.blockLen; - hashC.create = () => hashConstructor(); - return hashC; - } - - // node_modules/@scure/bip32/node_modules/@noble/hashes/esm/hmac.js - var HMAC = class extends Hash2 { - constructor(hash2, _key) { - super(); - this.finished = false; - this.destroyed = false; - assert_default.hash(hash2); - const key = toBytes2(_key); - this.iHash = hash2.create(); - if (typeof this.iHash.update !== "function") - throw new TypeError("Expected instance of class which extends utils.Hash"); - this.blockLen = this.iHash.blockLen; - this.outputLen = this.iHash.outputLen; - const blockLen = this.blockLen; - const pad = new Uint8Array(blockLen); - pad.set(key.length > blockLen ? hash2.create().update(key).digest() : key); - for (let i = 0; i < pad.length; i++) - pad[i] ^= 54; - this.iHash.update(pad); - this.oHash = hash2.create(); - for (let i = 0; i < pad.length; i++) - pad[i] ^= 54 ^ 92; - this.oHash.update(pad); - pad.fill(0); - } - update(buf) { - assert_default.exists(this); - this.iHash.update(buf); - return this; - } - digestInto(out) { - assert_default.exists(this); - assert_default.bytes(out, this.outputLen); - this.finished = true; - this.iHash.digestInto(out); - this.oHash.update(out); - this.oHash.digestInto(out); - this.destroy(); - } - digest() { - const out = new Uint8Array(this.oHash.outputLen); - this.digestInto(out); - return out; - } - _cloneInto(to) { - to || (to = Object.create(Object.getPrototypeOf(this), {})); - const { oHash, iHash, finished, destroyed, blockLen, outputLen } = this; - to = to; - to.finished = finished; - to.destroyed = destroyed; - to.blockLen = blockLen; - to.outputLen = outputLen; - to.oHash = oHash._cloneInto(to.oHash); - to.iHash = iHash._cloneInto(to.iHash); - return to; - } - destroy() { - this.destroyed = true; - this.oHash.destroy(); - this.iHash.destroy(); - } - }; - var hmac = (hash2, key, message) => new HMAC(hash2, key).update(message).digest(); - hmac.create = (hash2, key) => new HMAC(hash2, key); - - // node_modules/@scure/bip32/node_modules/@noble/hashes/esm/ripemd160.js - init_define_process(); - - // node_modules/@scure/bip32/node_modules/@noble/hashes/esm/_sha2.js - init_define_process(); - function setBigUint642(view, byteOffset, value, isLE3) { - if (typeof view.setBigUint64 === "function") - return view.setBigUint64(byteOffset, value, isLE3); - const _32n2 = BigInt(32); - const _u32_max = BigInt(4294967295); - const wh = Number(value >> _32n2 & _u32_max); - const wl = Number(value & _u32_max); - const h = isLE3 ? 4 : 0; - const l = isLE3 ? 0 : 4; - view.setUint32(byteOffset + h, wh, isLE3); - view.setUint32(byteOffset + l, wl, isLE3); - } - var SHA22 = class extends Hash2 { - constructor(blockLen, outputLen, padOffset, isLE3) { - super(); - this.blockLen = blockLen; - this.outputLen = outputLen; - this.padOffset = padOffset; - this.isLE = isLE3; - this.finished = false; - this.length = 0; - this.pos = 0; - this.destroyed = false; - this.buffer = new Uint8Array(blockLen); - this.view = createView2(this.buffer); - } - update(data) { - assert_default.exists(this); - const { view, buffer, blockLen } = this; - data = toBytes2(data); - const len = data.length; - for (let pos = 0; pos < len; ) { - const take = Math.min(blockLen - this.pos, len - pos); - if (take === blockLen) { - const dataView = createView2(data); - for (; blockLen <= len - pos; pos += blockLen) - this.process(dataView, pos); - continue; - } - buffer.set(data.subarray(pos, pos + take), this.pos); - this.pos += take; - pos += take; - if (this.pos === blockLen) { - this.process(view, 0); - this.pos = 0; - } - } - this.length += data.length; - this.roundClean(); - return this; - } - digestInto(out) { - assert_default.exists(this); - assert_default.output(out, this); - this.finished = true; - const { buffer, view, blockLen, isLE: isLE3 } = this; - let { pos } = this; - buffer[pos++] = 128; - this.buffer.subarray(pos).fill(0); - if (this.padOffset > blockLen - pos) { - this.process(view, 0); - pos = 0; - } - for (let i = pos; i < blockLen; i++) - buffer[i] = 0; - setBigUint642(view, blockLen - 8, BigInt(this.length * 8), isLE3); - this.process(view, 0); - const oview = createView2(out); - const len = this.outputLen; - if (len % 4) - throw new Error("_sha2: outputLen should be aligned to 32bit"); - const outLen = len / 4; - const state = this.get(); - if (outLen > state.length) - throw new Error("_sha2: outputLen bigger than state"); - for (let i = 0; i < outLen; i++) - oview.setUint32(4 * i, state[i], isLE3); - } - digest() { - const { buffer, outputLen } = this; - this.digestInto(buffer); - const res = buffer.slice(0, outputLen); - this.destroy(); - return res; - } - _cloneInto(to) { - to || (to = new this.constructor()); - to.set(...this.get()); - const { blockLen, buffer, length, finished, destroyed, pos } = this; - to.length = length; - to.pos = pos; - to.finished = finished; - to.destroyed = destroyed; - if (length % blockLen) - to.buffer.set(buffer); - return to; - } - }; - - // node_modules/@scure/bip32/node_modules/@noble/hashes/esm/ripemd160.js - var Rho = new Uint8Array([7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8]); - var Id = Uint8Array.from({ length: 16 }, (_, i) => i); - var Pi = Id.map((i) => (9 * i + 5) % 16); - var idxL = [Id]; - var idxR = [Pi]; - for (let i = 0; i < 4; i++) - for (let j of [idxL, idxR]) - j.push(j[i].map((k) => Rho[k])); - var shifts = [ - [11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8], - [12, 13, 11, 15, 6, 9, 9, 7, 12, 15, 11, 13, 7, 8, 7, 7], - [13, 15, 14, 11, 7, 7, 6, 8, 13, 14, 13, 12, 5, 5, 6, 9], - [14, 11, 12, 14, 8, 6, 5, 5, 15, 12, 15, 14, 9, 9, 8, 6], - [15, 12, 13, 13, 9, 5, 8, 6, 14, 11, 12, 11, 8, 6, 5, 5] - ].map((i) => new Uint8Array(i)); - var shiftsL = idxL.map((idx, i) => idx.map((j) => shifts[i][j])); - var shiftsR = idxR.map((idx, i) => idx.map((j) => shifts[i][j])); - var Kl = new Uint32Array([0, 1518500249, 1859775393, 2400959708, 2840853838]); - var Kr = new Uint32Array([1352829926, 1548603684, 1836072691, 2053994217, 0]); - var rotl = (word, shift) => word << shift | word >>> 32 - shift; - function f(group, x, y, z) { - if (group === 0) - return x ^ y ^ z; - else if (group === 1) - return x & y | ~x & z; - else if (group === 2) - return (x | ~y) ^ z; - else if (group === 3) - return x & z | y & ~z; - else - return x ^ (y | ~z); - } - var BUF = new Uint32Array(16); - var RIPEMD160 = class extends SHA22 { - constructor() { - super(64, 20, 8, true); - this.h0 = 1732584193 | 0; - this.h1 = 4023233417 | 0; - this.h2 = 2562383102 | 0; - this.h3 = 271733878 | 0; - this.h4 = 3285377520 | 0; - } - get() { - const { h0, h1, h2, h3, h4 } = this; - return [h0, h1, h2, h3, h4]; - } - set(h0, h1, h2, h3, h4) { - this.h0 = h0 | 0; - this.h1 = h1 | 0; - this.h2 = h2 | 0; - this.h3 = h3 | 0; - this.h4 = h4 | 0; - } - process(view, offset) { - for (let i = 0; i < 16; i++, offset += 4) - BUF[i] = view.getUint32(offset, true); - let al = this.h0 | 0, ar = al, bl = this.h1 | 0, br = bl, cl = this.h2 | 0, cr = cl, dl = this.h3 | 0, dr = dl, el = this.h4 | 0, er = el; - for (let group = 0; group < 5; group++) { - const rGroup = 4 - group; - const hbl = Kl[group], hbr = Kr[group]; - const rl = idxL[group], rr = idxR[group]; - const sl = shiftsL[group], sr = shiftsR[group]; - for (let i = 0; i < 16; i++) { - const tl = rotl(al + f(group, bl, cl, dl) + BUF[rl[i]] + hbl, sl[i]) + el | 0; - al = el, el = dl, dl = rotl(cl, 10) | 0, cl = bl, bl = tl; - } - for (let i = 0; i < 16; i++) { - const tr = rotl(ar + f(rGroup, br, cr, dr) + BUF[rr[i]] + hbr, sr[i]) + er | 0; - ar = er, er = dr, dr = rotl(cr, 10) | 0, cr = br, br = tr; - } - } - this.set(this.h1 + cl + dr | 0, this.h2 + dl + er | 0, this.h3 + el + ar | 0, this.h4 + al + br | 0, this.h0 + bl + cr | 0); - } - roundClean() { - BUF.fill(0); - } - destroy() { - this.destroyed = true; - this.buffer.fill(0); - this.set(0, 0, 0, 0, 0); - } - }; - var ripemd160 = wrapConstructor2(() => new RIPEMD160()); - - // node_modules/@scure/bip32/node_modules/@noble/hashes/esm/sha256.js - init_define_process(); - var Chi2 = (a, b, c) => a & b ^ ~a & c; - var Maj2 = (a, b, c) => a & b ^ a & c ^ b & c; - var SHA256_K2 = new Uint32Array([ - 1116352408, - 1899447441, - 3049323471, - 3921009573, - 961987163, - 1508970993, - 2453635748, - 2870763221, - 3624381080, - 310598401, - 607225278, - 1426881987, - 1925078388, - 2162078206, - 2614888103, - 3248222580, - 3835390401, - 4022224774, - 264347078, - 604807628, - 770255983, - 1249150122, - 1555081692, - 1996064986, - 2554220882, - 2821834349, - 2952996808, - 3210313671, - 3336571891, - 3584528711, - 113926993, - 338241895, - 666307205, - 773529912, - 1294757372, - 1396182291, - 1695183700, - 1986661051, - 2177026350, - 2456956037, - 2730485921, - 2820302411, - 3259730800, - 3345764771, - 3516065817, - 3600352804, - 4094571909, - 275423344, - 430227734, - 506948616, - 659060556, - 883997877, - 958139571, - 1322822218, - 1537002063, - 1747873779, - 1955562222, - 2024104815, - 2227730452, - 2361852424, - 2428436474, - 2756734187, - 3204031479, - 3329325298 - ]); - var IV2 = new Uint32Array([ - 1779033703, - 3144134277, - 1013904242, - 2773480762, - 1359893119, - 2600822924, - 528734635, - 1541459225 - ]); - var SHA256_W2 = new Uint32Array(64); - var SHA2562 = class extends SHA22 { - constructor() { - super(64, 32, 8, false); - this.A = IV2[0] | 0; - this.B = IV2[1] | 0; - this.C = IV2[2] | 0; - this.D = IV2[3] | 0; - this.E = IV2[4] | 0; - this.F = IV2[5] | 0; - this.G = IV2[6] | 0; - this.H = IV2[7] | 0; - } - get() { - const { A, B, C, D, E, F, G, H } = this; - return [A, B, C, D, E, F, G, H]; - } - set(A, B, C, D, E, F, G, H) { - this.A = A | 0; - this.B = B | 0; - this.C = C | 0; - this.D = D | 0; - this.E = E | 0; - this.F = F | 0; - this.G = G | 0; - this.H = H | 0; - } - process(view, offset) { - for (let i = 0; i < 16; i++, offset += 4) - SHA256_W2[i] = view.getUint32(offset, false); - for (let i = 16; i < 64; i++) { - const W15 = SHA256_W2[i - 15]; - const W2 = SHA256_W2[i - 2]; - const s0 = rotr2(W15, 7) ^ rotr2(W15, 18) ^ W15 >>> 3; - const s1 = rotr2(W2, 17) ^ rotr2(W2, 19) ^ W2 >>> 10; - SHA256_W2[i] = s1 + SHA256_W2[i - 7] + s0 + SHA256_W2[i - 16] | 0; - } - let { A, B, C, D, E, F, G, H } = this; - for (let i = 0; i < 64; i++) { - const sigma1 = rotr2(E, 6) ^ rotr2(E, 11) ^ rotr2(E, 25); - const T1 = H + sigma1 + Chi2(E, F, G) + SHA256_K2[i] + SHA256_W2[i] | 0; - const sigma0 = rotr2(A, 2) ^ rotr2(A, 13) ^ rotr2(A, 22); - const T2 = sigma0 + Maj2(A, B, C) | 0; - H = G; - G = F; - F = E; - E = D + T1 | 0; - D = C; - C = B; - B = A; - A = T1 + T2 | 0; - } - A = A + this.A | 0; - B = B + this.B | 0; - C = C + this.C | 0; - D = D + this.D | 0; - E = E + this.E | 0; - F = F + this.F | 0; - G = G + this.G | 0; - H = H + this.H | 0; - this.set(A, B, C, D, E, F, G, H); - } - roundClean() { - SHA256_W2.fill(0); - } - destroy() { - this.set(0, 0, 0, 0, 0, 0, 0, 0); - this.buffer.fill(0); - } - }; - var SHA224 = class extends SHA2562 { - constructor() { - super(); - this.A = 3238371032 | 0; - this.B = 914150663 | 0; - this.C = 812702999 | 0; - this.D = 4144912697 | 0; - this.E = 4290775857 | 0; - this.F = 1750603025 | 0; - this.G = 1694076839 | 0; - this.H = 3204075428 | 0; - this.outputLen = 28; - } - }; - var sha2562 = wrapConstructor2(() => new SHA2562()); - var sha224 = wrapConstructor2(() => new SHA224()); - - // node_modules/@scure/bip32/node_modules/@noble/hashes/esm/sha512.js - init_define_process(); - - // node_modules/@scure/bip32/node_modules/@noble/hashes/esm/_u64.js - init_define_process(); - var U32_MASK64 = BigInt(2 ** 32 - 1); - var _32n = BigInt(32); - function fromBig(n, le = false) { - if (le) - return { h: Number(n & U32_MASK64), l: Number(n >> _32n & U32_MASK64) }; - return { h: Number(n >> _32n & U32_MASK64) | 0, l: Number(n & U32_MASK64) | 0 }; - } - function split(lst, le = false) { - let Ah = new Uint32Array(lst.length); - let Al = new Uint32Array(lst.length); - for (let i = 0; i < lst.length; i++) { - const { h, l } = fromBig(lst[i], le); - [Ah[i], Al[i]] = [h, l]; - } - return [Ah, Al]; - } - var toBig = (h, l) => BigInt(h >>> 0) << _32n | BigInt(l >>> 0); - var shrSH = (h, l, s) => h >>> s; - var shrSL = (h, l, s) => h << 32 - s | l >>> s; - var rotrSH = (h, l, s) => h >>> s | l << 32 - s; - var rotrSL = (h, l, s) => h << 32 - s | l >>> s; - var rotrBH = (h, l, s) => h << 64 - s | l >>> s - 32; - var rotrBL = (h, l, s) => h >>> s - 32 | l << 64 - s; - var rotr32H = (h, l) => l; - var rotr32L = (h, l) => h; - var rotlSH = (h, l, s) => h << s | l >>> 32 - s; - var rotlSL = (h, l, s) => l << s | h >>> 32 - s; - var rotlBH = (h, l, s) => l << s - 32 | h >>> 64 - s; - var rotlBL = (h, l, s) => h << s - 32 | l >>> 64 - s; - function add(Ah, Al, Bh, Bl) { - const l = (Al >>> 0) + (Bl >>> 0); - return { h: Ah + Bh + (l / 2 ** 32 | 0) | 0, l: l | 0 }; - } - var add3L = (Al, Bl, Cl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0); - var add3H = (low, Ah, Bh, Ch) => Ah + Bh + Ch + (low / 2 ** 32 | 0) | 0; - var add4L = (Al, Bl, Cl, Dl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0); - var add4H = (low, Ah, Bh, Ch, Dh) => Ah + Bh + Ch + Dh + (low / 2 ** 32 | 0) | 0; - var add5L = (Al, Bl, Cl, Dl, El) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0) + (El >>> 0); - var add5H = (low, Ah, Bh, Ch, Dh, Eh) => Ah + Bh + Ch + Dh + Eh + (low / 2 ** 32 | 0) | 0; - var u64 = { - fromBig, - split, - toBig, - shrSH, - shrSL, - rotrSH, - rotrSL, - rotrBH, - rotrBL, - rotr32H, - rotr32L, - rotlSH, - rotlSL, - rotlBH, - rotlBL, - add, - add3L, - add3H, - add4L, - add4H, - add5H, - add5L - }; - var u64_default = u64; - - // node_modules/@scure/bip32/node_modules/@noble/hashes/esm/sha512.js - var [SHA512_Kh, SHA512_Kl] = u64_default.split([ - "0x428a2f98d728ae22", - "0x7137449123ef65cd", - "0xb5c0fbcfec4d3b2f", - "0xe9b5dba58189dbbc", - "0x3956c25bf348b538", - "0x59f111f1b605d019", - "0x923f82a4af194f9b", - "0xab1c5ed5da6d8118", - "0xd807aa98a3030242", - "0x12835b0145706fbe", - "0x243185be4ee4b28c", - "0x550c7dc3d5ffb4e2", - "0x72be5d74f27b896f", - "0x80deb1fe3b1696b1", - "0x9bdc06a725c71235", - "0xc19bf174cf692694", - "0xe49b69c19ef14ad2", - "0xefbe4786384f25e3", - "0x0fc19dc68b8cd5b5", - "0x240ca1cc77ac9c65", - "0x2de92c6f592b0275", - "0x4a7484aa6ea6e483", - "0x5cb0a9dcbd41fbd4", - "0x76f988da831153b5", - "0x983e5152ee66dfab", - "0xa831c66d2db43210", - "0xb00327c898fb213f", - "0xbf597fc7beef0ee4", - "0xc6e00bf33da88fc2", - "0xd5a79147930aa725", - "0x06ca6351e003826f", - "0x142929670a0e6e70", - "0x27b70a8546d22ffc", - "0x2e1b21385c26c926", - "0x4d2c6dfc5ac42aed", - "0x53380d139d95b3df", - "0x650a73548baf63de", - "0x766a0abb3c77b2a8", - "0x81c2c92e47edaee6", - "0x92722c851482353b", - "0xa2bfe8a14cf10364", - "0xa81a664bbc423001", - "0xc24b8b70d0f89791", - "0xc76c51a30654be30", - "0xd192e819d6ef5218", - "0xd69906245565a910", - "0xf40e35855771202a", - "0x106aa07032bbd1b8", - "0x19a4c116b8d2d0c8", - "0x1e376c085141ab53", - "0x2748774cdf8eeb99", - "0x34b0bcb5e19b48a8", - "0x391c0cb3c5c95a63", - "0x4ed8aa4ae3418acb", - "0x5b9cca4f7763e373", - "0x682e6ff3d6b2b8a3", - "0x748f82ee5defb2fc", - "0x78a5636f43172f60", - "0x84c87814a1f0ab72", - "0x8cc702081a6439ec", - "0x90befffa23631e28", - "0xa4506cebde82bde9", - "0xbef9a3f7b2c67915", - "0xc67178f2e372532b", - "0xca273eceea26619c", - "0xd186b8c721c0c207", - "0xeada7dd6cde0eb1e", - "0xf57d4f7fee6ed178", - "0x06f067aa72176fba", - "0x0a637dc5a2c898a6", - "0x113f9804bef90dae", - "0x1b710b35131c471b", - "0x28db77f523047d84", - "0x32caab7b40c72493", - "0x3c9ebe0a15c9bebc", - "0x431d67c49c100d4c", - "0x4cc5d4becb3e42b6", - "0x597f299cfc657e2a", - "0x5fcb6fab3ad6faec", - "0x6c44198c4a475817" - ].map((n) => BigInt(n))); - var SHA512_W_H = new Uint32Array(80); - var SHA512_W_L = new Uint32Array(80); - var SHA512 = class extends SHA22 { - constructor() { - super(128, 64, 16, false); - this.Ah = 1779033703 | 0; - this.Al = 4089235720 | 0; - this.Bh = 3144134277 | 0; - this.Bl = 2227873595 | 0; - this.Ch = 1013904242 | 0; - this.Cl = 4271175723 | 0; - this.Dh = 2773480762 | 0; - this.Dl = 1595750129 | 0; - this.Eh = 1359893119 | 0; - this.El = 2917565137 | 0; - this.Fh = 2600822924 | 0; - this.Fl = 725511199 | 0; - this.Gh = 528734635 | 0; - this.Gl = 4215389547 | 0; - this.Hh = 1541459225 | 0; - this.Hl = 327033209 | 0; - } - get() { - const { Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this; - return [Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl]; - } - set(Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl) { - this.Ah = Ah | 0; - this.Al = Al | 0; - this.Bh = Bh | 0; - this.Bl = Bl | 0; - this.Ch = Ch | 0; - this.Cl = Cl | 0; - this.Dh = Dh | 0; - this.Dl = Dl | 0; - this.Eh = Eh | 0; - this.El = El | 0; - this.Fh = Fh | 0; - this.Fl = Fl | 0; - this.Gh = Gh | 0; - this.Gl = Gl | 0; - this.Hh = Hh | 0; - this.Hl = Hl | 0; - } - process(view, offset) { - for (let i = 0; i < 16; i++, offset += 4) { - SHA512_W_H[i] = view.getUint32(offset); - SHA512_W_L[i] = view.getUint32(offset += 4); - } - for (let i = 16; i < 80; i++) { - const W15h = SHA512_W_H[i - 15] | 0; - const W15l = SHA512_W_L[i - 15] | 0; - const s0h = u64_default.rotrSH(W15h, W15l, 1) ^ u64_default.rotrSH(W15h, W15l, 8) ^ u64_default.shrSH(W15h, W15l, 7); - const s0l = u64_default.rotrSL(W15h, W15l, 1) ^ u64_default.rotrSL(W15h, W15l, 8) ^ u64_default.shrSL(W15h, W15l, 7); - const W2h = SHA512_W_H[i - 2] | 0; - const W2l = SHA512_W_L[i - 2] | 0; - const s1h = u64_default.rotrSH(W2h, W2l, 19) ^ u64_default.rotrBH(W2h, W2l, 61) ^ u64_default.shrSH(W2h, W2l, 6); - const s1l = u64_default.rotrSL(W2h, W2l, 19) ^ u64_default.rotrBL(W2h, W2l, 61) ^ u64_default.shrSL(W2h, W2l, 6); - const SUMl = u64_default.add4L(s0l, s1l, SHA512_W_L[i - 7], SHA512_W_L[i - 16]); - const SUMh = u64_default.add4H(SUMl, s0h, s1h, SHA512_W_H[i - 7], SHA512_W_H[i - 16]); - SHA512_W_H[i] = SUMh | 0; - SHA512_W_L[i] = SUMl | 0; - } - let { Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this; - for (let i = 0; i < 80; i++) { - const sigma1h = u64_default.rotrSH(Eh, El, 14) ^ u64_default.rotrSH(Eh, El, 18) ^ u64_default.rotrBH(Eh, El, 41); - const sigma1l = u64_default.rotrSL(Eh, El, 14) ^ u64_default.rotrSL(Eh, El, 18) ^ u64_default.rotrBL(Eh, El, 41); - const CHIh = Eh & Fh ^ ~Eh & Gh; - const CHIl = El & Fl ^ ~El & Gl; - const T1ll = u64_default.add5L(Hl, sigma1l, CHIl, SHA512_Kl[i], SHA512_W_L[i]); - const T1h = u64_default.add5H(T1ll, Hh, sigma1h, CHIh, SHA512_Kh[i], SHA512_W_H[i]); - const T1l = T1ll | 0; - const sigma0h = u64_default.rotrSH(Ah, Al, 28) ^ u64_default.rotrBH(Ah, Al, 34) ^ u64_default.rotrBH(Ah, Al, 39); - const sigma0l = u64_default.rotrSL(Ah, Al, 28) ^ u64_default.rotrBL(Ah, Al, 34) ^ u64_default.rotrBL(Ah, Al, 39); - const MAJh = Ah & Bh ^ Ah & Ch ^ Bh & Ch; - const MAJl = Al & Bl ^ Al & Cl ^ Bl & Cl; - Hh = Gh | 0; - Hl = Gl | 0; - Gh = Fh | 0; - Gl = Fl | 0; - Fh = Eh | 0; - Fl = El | 0; - ({ h: Eh, l: El } = u64_default.add(Dh | 0, Dl | 0, T1h | 0, T1l | 0)); - Dh = Ch | 0; - Dl = Cl | 0; - Ch = Bh | 0; - Cl = Bl | 0; - Bh = Ah | 0; - Bl = Al | 0; - const All = u64_default.add3L(T1l, sigma0l, MAJl); - Ah = u64_default.add3H(All, T1h, sigma0h, MAJh); - Al = All | 0; - } - ({ h: Ah, l: Al } = u64_default.add(this.Ah | 0, this.Al | 0, Ah | 0, Al | 0)); - ({ h: Bh, l: Bl } = u64_default.add(this.Bh | 0, this.Bl | 0, Bh | 0, Bl | 0)); - ({ h: Ch, l: Cl } = u64_default.add(this.Ch | 0, this.Cl | 0, Ch | 0, Cl | 0)); - ({ h: Dh, l: Dl } = u64_default.add(this.Dh | 0, this.Dl | 0, Dh | 0, Dl | 0)); - ({ h: Eh, l: El } = u64_default.add(this.Eh | 0, this.El | 0, Eh | 0, El | 0)); - ({ h: Fh, l: Fl } = u64_default.add(this.Fh | 0, this.Fl | 0, Fh | 0, Fl | 0)); - ({ h: Gh, l: Gl } = u64_default.add(this.Gh | 0, this.Gl | 0, Gh | 0, Gl | 0)); - ({ h: Hh, l: Hl } = u64_default.add(this.Hh | 0, this.Hl | 0, Hh | 0, Hl | 0)); - this.set(Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl); - } - roundClean() { - SHA512_W_H.fill(0); - SHA512_W_L.fill(0); - } - destroy() { - this.buffer.fill(0); - this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); - } - }; - var SHA512_224 = class extends SHA512 { - constructor() { - super(); - this.Ah = 2352822216 | 0; - this.Al = 424955298 | 0; - this.Bh = 1944164710 | 0; - this.Bl = 2312950998 | 0; - this.Ch = 502970286 | 0; - this.Cl = 855612546 | 0; - this.Dh = 1738396948 | 0; - this.Dl = 1479516111 | 0; - this.Eh = 258812777 | 0; - this.El = 2077511080 | 0; - this.Fh = 2011393907 | 0; - this.Fl = 79989058 | 0; - this.Gh = 1067287976 | 0; - this.Gl = 1780299464 | 0; - this.Hh = 286451373 | 0; - this.Hl = 2446758561 | 0; - this.outputLen = 28; - } - }; - var SHA512_256 = class extends SHA512 { - constructor() { - super(); - this.Ah = 573645204 | 0; - this.Al = 4230739756 | 0; - this.Bh = 2673172387 | 0; - this.Bl = 3360449730 | 0; - this.Ch = 596883563 | 0; - this.Cl = 1867755857 | 0; - this.Dh = 2520282905 | 0; - this.Dl = 1497426621 | 0; - this.Eh = 2519219938 | 0; - this.El = 2827943907 | 0; - this.Fh = 3193839141 | 0; - this.Fl = 1401305490 | 0; - this.Gh = 721525244 | 0; - this.Gl = 746961066 | 0; - this.Hh = 246885852 | 0; - this.Hl = 2177182882 | 0; - this.outputLen = 32; - } - }; - var SHA384 = class extends SHA512 { - constructor() { - super(); - this.Ah = 3418070365 | 0; - this.Al = 3238371032 | 0; - this.Bh = 1654270250 | 0; - this.Bl = 914150663 | 0; - this.Ch = 2438529370 | 0; - this.Cl = 812702999 | 0; - this.Dh = 355462360 | 0; - this.Dl = 4144912697 | 0; - this.Eh = 1731405415 | 0; - this.El = 4290775857 | 0; - this.Fh = 2394180231 | 0; - this.Fl = 1750603025 | 0; - this.Gh = 3675008525 | 0; - this.Gl = 1694076839 | 0; - this.Hh = 1203062813 | 0; - this.Hl = 3204075428 | 0; - this.outputLen = 48; - } - }; - var sha512 = wrapConstructor2(() => new SHA512()); - var sha512_224 = wrapConstructor2(() => new SHA512_224()); - var sha512_256 = wrapConstructor2(() => new SHA512_256()); - var sha384 = wrapConstructor2(() => new SHA384()); - - // node_modules/@scure/bip32/node_modules/@noble/secp256k1/lib/esm/index.js - init_define_process(); - var nodeCrypto2 = __toESM(require_crypto(), 1); - var _0n2 = BigInt(0); - var _1n2 = BigInt(1); - var _2n2 = BigInt(2); - var _3n2 = BigInt(3); - var _8n2 = BigInt(8); - var CURVE2 = Object.freeze({ - a: _0n2, - b: BigInt(7), - P: BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"), - n: BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"), - h: _1n2, - Gx: BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"), - Gy: BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"), - beta: BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee") - }); - function weistrass(x) { - const { a, b } = CURVE2; - const x2 = mod2(x * x); - const x3 = mod2(x2 * x); - return mod2(x3 + a * x + b); - } - var USE_ENDOMORPHISM2 = CURVE2.a === _0n2; - var ShaError2 = class extends Error { - constructor(message) { - super(message); - } - }; - var JacobianPoint2 = class { - constructor(x, y, z) { - this.x = x; - this.y = y; - this.z = z; - } - static fromAffine(p) { - if (!(p instanceof Point2)) { - throw new TypeError("JacobianPoint#fromAffine: expected Point"); - } - return new JacobianPoint2(p.x, p.y, _1n2); - } - static toAffineBatch(points) { - const toInv = invertBatch2(points.map((p) => p.z)); - return points.map((p, i) => p.toAffine(toInv[i])); - } - static normalizeZ(points) { - return JacobianPoint2.toAffineBatch(points).map(JacobianPoint2.fromAffine); - } - equals(other) { - if (!(other instanceof JacobianPoint2)) - throw new TypeError("JacobianPoint expected"); - const { x: X1, y: Y1, z: Z1 } = this; - const { x: X2, y: Y2, z: Z2 } = other; - const Z1Z1 = mod2(Z1 * Z1); - const Z2Z2 = mod2(Z2 * Z2); - const U1 = mod2(X1 * Z2Z2); - const U2 = mod2(X2 * Z1Z1); - const S1 = mod2(mod2(Y1 * Z2) * Z2Z2); - const S2 = mod2(mod2(Y2 * Z1) * Z1Z1); - return U1 === U2 && S1 === S2; - } - negate() { - return new JacobianPoint2(this.x, mod2(-this.y), this.z); - } - double() { - const { x: X1, y: Y1, z: Z1 } = this; - const A = mod2(X1 * X1); - const B = mod2(Y1 * Y1); - const C = mod2(B * B); - const x1b = X1 + B; - const D = mod2(_2n2 * (mod2(x1b * x1b) - A - C)); - const E = mod2(_3n2 * A); - const F = mod2(E * E); - const X3 = mod2(F - _2n2 * D); - const Y3 = mod2(E * (D - X3) - _8n2 * C); - const Z3 = mod2(_2n2 * Y1 * Z1); - return new JacobianPoint2(X3, Y3, Z3); - } - add(other) { - if (!(other instanceof JacobianPoint2)) - throw new TypeError("JacobianPoint expected"); - const { x: X1, y: Y1, z: Z1 } = this; - const { x: X2, y: Y2, z: Z2 } = other; - if (X2 === _0n2 || Y2 === _0n2) - return this; - if (X1 === _0n2 || Y1 === _0n2) - return other; - const Z1Z1 = mod2(Z1 * Z1); - const Z2Z2 = mod2(Z2 * Z2); - const U1 = mod2(X1 * Z2Z2); - const U2 = mod2(X2 * Z1Z1); - const S1 = mod2(mod2(Y1 * Z2) * Z2Z2); - const S2 = mod2(mod2(Y2 * Z1) * Z1Z1); - const H = mod2(U2 - U1); - const r = mod2(S2 - S1); - if (H === _0n2) { - if (r === _0n2) { - return this.double(); - } else { - return JacobianPoint2.ZERO; - } - } - const HH = mod2(H * H); - const HHH = mod2(H * HH); - const V = mod2(U1 * HH); - const X3 = mod2(r * r - HHH - _2n2 * V); - const Y3 = mod2(r * (V - X3) - S1 * HHH); - const Z3 = mod2(Z1 * Z2 * H); - return new JacobianPoint2(X3, Y3, Z3); - } - subtract(other) { - return this.add(other.negate()); - } - multiplyUnsafe(scalar) { - const P0 = JacobianPoint2.ZERO; - if (typeof scalar === "bigint" && scalar === _0n2) - return P0; - let n = normalizeScalar2(scalar); - if (n === _1n2) - return this; - if (!USE_ENDOMORPHISM2) { - let p = P0; - let d2 = this; - while (n > _0n2) { - if (n & _1n2) - p = p.add(d2); - d2 = d2.double(); - n >>= _1n2; - } - return p; - } - let { k1neg, k1, k2neg, k2 } = splitScalarEndo(n); - let k1p = P0; - let k2p = P0; - let d = this; - while (k1 > _0n2 || k2 > _0n2) { - if (k1 & _1n2) - k1p = k1p.add(d); - if (k2 & _1n2) - k2p = k2p.add(d); - d = d.double(); - k1 >>= _1n2; - k2 >>= _1n2; - } - if (k1neg) - k1p = k1p.negate(); - if (k2neg) - k2p = k2p.negate(); - k2p = new JacobianPoint2(mod2(k2p.x * CURVE2.beta), k2p.y, k2p.z); - return k1p.add(k2p); - } - precomputeWindow(W) { - const windows = USE_ENDOMORPHISM2 ? 128 / W + 1 : 256 / W + 1; - const points = []; - let p = this; - let base = p; - for (let window = 0; window < windows; window++) { - base = p; - points.push(base); - for (let i = 1; i < 2 ** (W - 1); i++) { - base = base.add(p); - points.push(base); - } - p = base.double(); - } - return points; - } - wNAF(n, affinePoint) { - if (!affinePoint && this.equals(JacobianPoint2.BASE)) - affinePoint = Point2.BASE; - const W = affinePoint && affinePoint._WINDOW_SIZE || 1; - if (256 % W) { - throw new Error("Point#wNAF: Invalid precomputation window, must be power of 2"); - } - let precomputes = affinePoint && pointPrecomputes2.get(affinePoint); - if (!precomputes) { - precomputes = this.precomputeWindow(W); - if (affinePoint && W !== 1) { - precomputes = JacobianPoint2.normalizeZ(precomputes); - pointPrecomputes2.set(affinePoint, precomputes); - } - } - let p = JacobianPoint2.ZERO; - let f2 = JacobianPoint2.ZERO; - const windows = 1 + (USE_ENDOMORPHISM2 ? 128 / W : 256 / W); - const windowSize = 2 ** (W - 1); - const mask = BigInt(2 ** W - 1); - const maxNumber = 2 ** W; - const shiftBy = BigInt(W); - for (let window = 0; window < windows; window++) { - const offset = window * windowSize; - let wbits = Number(n & mask); - n >>= shiftBy; - if (wbits > windowSize) { - wbits -= maxNumber; - n += _1n2; - } - if (wbits === 0) { - let pr = precomputes[offset]; - if (window % 2) - pr = pr.negate(); - f2 = f2.add(pr); - } else { - let cached = precomputes[offset + Math.abs(wbits) - 1]; - if (wbits < 0) - cached = cached.negate(); - p = p.add(cached); - } - } - return { p, f: f2 }; - } - multiply(scalar, affinePoint) { - let n = normalizeScalar2(scalar); - let point; - let fake; - if (USE_ENDOMORPHISM2) { - const { k1neg, k1, k2neg, k2 } = splitScalarEndo(n); - let { p: k1p, f: f1p } = this.wNAF(k1, affinePoint); - let { p: k2p, f: f2p } = this.wNAF(k2, affinePoint); - if (k1neg) - k1p = k1p.negate(); - if (k2neg) - k2p = k2p.negate(); - k2p = new JacobianPoint2(mod2(k2p.x * CURVE2.beta), k2p.y, k2p.z); - point = k1p.add(k2p); - fake = f1p.add(f2p); - } else { - const { p, f: f2 } = this.wNAF(n, affinePoint); - point = p; - fake = f2; - } - return JacobianPoint2.normalizeZ([point, fake])[0]; - } - toAffine(invZ = invert2(this.z)) { - const { x, y, z } = this; - const iz1 = invZ; - const iz2 = mod2(iz1 * iz1); - const iz3 = mod2(iz2 * iz1); - const ax = mod2(x * iz2); - const ay = mod2(y * iz3); - const zz = mod2(z * iz1); - if (zz !== _1n2) - throw new Error("invZ was invalid"); - return new Point2(ax, ay); - } - }; - JacobianPoint2.BASE = new JacobianPoint2(CURVE2.Gx, CURVE2.Gy, _1n2); - JacobianPoint2.ZERO = new JacobianPoint2(_0n2, _1n2, _0n2); - var pointPrecomputes2 = /* @__PURE__ */ new WeakMap(); - var Point2 = class { - constructor(x, y) { - this.x = x; - this.y = y; - } - _setWindowSize(windowSize) { - this._WINDOW_SIZE = windowSize; - pointPrecomputes2.delete(this); - } - hasEvenY() { - return this.y % _2n2 === _0n2; - } - static fromCompressedHex(bytes2) { - const isShort = bytes2.length === 32; - const x = bytesToNumber2(isShort ? bytes2 : bytes2.subarray(1)); - if (!isValidFieldElement2(x)) - throw new Error("Point is not on curve"); - const y2 = weistrass(x); - let y = sqrtMod2(y2); - const isYOdd = (y & _1n2) === _1n2; - if (isShort) { - if (isYOdd) - y = mod2(-y); - } else { - const isFirstByteOdd = (bytes2[0] & 1) === 1; - if (isFirstByteOdd !== isYOdd) - y = mod2(-y); - } - const point = new Point2(x, y); - point.assertValidity(); - return point; - } - static fromUncompressedHex(bytes2) { - const x = bytesToNumber2(bytes2.subarray(1, 33)); - const y = bytesToNumber2(bytes2.subarray(33, 65)); - const point = new Point2(x, y); - point.assertValidity(); - return point; - } - static fromHex(hex2) { - const bytes2 = ensureBytes2(hex2); - const len = bytes2.length; - const header = bytes2[0]; - if (len === 32 || len === 33 && (header === 2 || header === 3)) { - return this.fromCompressedHex(bytes2); - } - if (len === 65 && header === 4) - return this.fromUncompressedHex(bytes2); - throw new Error(`Point.fromHex: received invalid point. Expected 32-33 compressed bytes or 65 uncompressed bytes, not ${len}`); - } - static fromPrivateKey(privateKey) { - return Point2.BASE.multiply(normalizePrivateKey2(privateKey)); - } - static fromSignature(msgHash, signature, recovery) { - msgHash = ensureBytes2(msgHash); - const h = truncateHash2(msgHash); - const { r, s } = normalizeSignature2(signature); - if (recovery !== 0 && recovery !== 1) { - throw new Error("Cannot recover signature: invalid recovery bit"); - } - const prefix = recovery & 1 ? "03" : "02"; - const R = Point2.fromHex(prefix + numTo32bStr2(r)); - const { n } = CURVE2; - const rinv = invert2(r, n); - const u1 = mod2(-h * rinv, n); - const u2 = mod2(s * rinv, n); - const Q = Point2.BASE.multiplyAndAddUnsafe(R, u1, u2); - if (!Q) - throw new Error("Cannot recover signature: point at infinify"); - Q.assertValidity(); - return Q; - } - toRawBytes(isCompressed = false) { - return hexToBytes3(this.toHex(isCompressed)); - } - toHex(isCompressed = false) { - const x = numTo32bStr2(this.x); - if (isCompressed) { - const prefix = this.hasEvenY() ? "02" : "03"; - return `${prefix}${x}`; - } else { - return `04${x}${numTo32bStr2(this.y)}`; - } - } - toHexX() { - return this.toHex(true).slice(2); - } - toRawX() { - return this.toRawBytes(true).slice(1); - } - assertValidity() { - const msg = "Point is not on elliptic curve"; - const { x, y } = this; - if (!isValidFieldElement2(x) || !isValidFieldElement2(y)) - throw new Error(msg); - const left = mod2(y * y); - const right = weistrass(x); - if (mod2(left - right) !== _0n2) - throw new Error(msg); - } - equals(other) { - return this.x === other.x && this.y === other.y; - } - negate() { - return new Point2(this.x, mod2(-this.y)); - } - double() { - return JacobianPoint2.fromAffine(this).double().toAffine(); - } - add(other) { - return JacobianPoint2.fromAffine(this).add(JacobianPoint2.fromAffine(other)).toAffine(); - } - subtract(other) { - return this.add(other.negate()); - } - multiply(scalar) { - return JacobianPoint2.fromAffine(this).multiply(scalar, this).toAffine(); - } - multiplyAndAddUnsafe(Q, a, b) { - const P = JacobianPoint2.fromAffine(this); - const aP = a === _0n2 || a === _1n2 || this !== Point2.BASE ? P.multiplyUnsafe(a) : P.multiply(a); - const bQ = JacobianPoint2.fromAffine(Q).multiplyUnsafe(b); - const sum = aP.add(bQ); - return sum.equals(JacobianPoint2.ZERO) ? void 0 : sum.toAffine(); - } - }; - Point2.BASE = new Point2(CURVE2.Gx, CURVE2.Gy); - Point2.ZERO = new Point2(_0n2, _0n2); - function sliceDER2(s) { - return Number.parseInt(s[0], 16) >= 8 ? "00" + s : s; - } - function parseDERInt2(data) { - if (data.length < 2 || data[0] !== 2) { - throw new Error(`Invalid signature integer tag: ${bytesToHex3(data)}`); - } - const len = data[1]; - const res = data.subarray(2, len + 2); - if (!len || res.length !== len) { - throw new Error(`Invalid signature integer: wrong length`); - } - if (res[0] === 0 && res[1] <= 127) { - throw new Error("Invalid signature integer: trailing length"); - } - return { data: bytesToNumber2(res), left: data.subarray(len + 2) }; - } - function parseDERSignature2(data) { - if (data.length < 2 || data[0] != 48) { - throw new Error(`Invalid signature tag: ${bytesToHex3(data)}`); - } - if (data[1] !== data.length - 2) { - throw new Error("Invalid signature: incorrect length"); - } - const { data: r, left: sBytes } = parseDERInt2(data.subarray(2)); - const { data: s, left: rBytesLeft } = parseDERInt2(sBytes); - if (rBytesLeft.length) { - throw new Error(`Invalid signature: left bytes after parsing: ${bytesToHex3(rBytesLeft)}`); - } - return { r, s }; - } - var Signature2 = class { - constructor(r, s) { - this.r = r; - this.s = s; - this.assertValidity(); - } - static fromCompact(hex2) { - const arr = hex2 instanceof Uint8Array; - const name = "Signature.fromCompact"; - if (typeof hex2 !== "string" && !arr) - throw new TypeError(`${name}: Expected string or Uint8Array`); - const str = arr ? bytesToHex3(hex2) : hex2; - if (str.length !== 128) - throw new Error(`${name}: Expected 64-byte hex`); - return new Signature2(hexToNumber2(str.slice(0, 64)), hexToNumber2(str.slice(64, 128))); - } - static fromDER(hex2) { - const arr = hex2 instanceof Uint8Array; - if (typeof hex2 !== "string" && !arr) - throw new TypeError(`Signature.fromDER: Expected string or Uint8Array`); - const { r, s } = parseDERSignature2(arr ? hex2 : hexToBytes3(hex2)); - return new Signature2(r, s); - } - static fromHex(hex2) { - return this.fromDER(hex2); - } - assertValidity() { - const { r, s } = this; - if (!isWithinCurveOrder2(r)) - throw new Error("Invalid Signature: r must be 0 < r < n"); - if (!isWithinCurveOrder2(s)) - throw new Error("Invalid Signature: s must be 0 < s < n"); - } - hasHighS() { - const HALF = CURVE2.n >> _1n2; - return this.s > HALF; - } - normalizeS() { - return this.hasHighS() ? new Signature2(this.r, CURVE2.n - this.s) : this; - } - toDERRawBytes(isCompressed = false) { - return hexToBytes3(this.toDERHex(isCompressed)); - } - toDERHex(isCompressed = false) { - const sHex = sliceDER2(numberToHexUnpadded2(this.s)); - if (isCompressed) - return sHex; - const rHex = sliceDER2(numberToHexUnpadded2(this.r)); - const rLen = numberToHexUnpadded2(rHex.length / 2); - const sLen = numberToHexUnpadded2(sHex.length / 2); - const length = numberToHexUnpadded2(rHex.length / 2 + sHex.length / 2 + 4); - return `30${length}02${rLen}${rHex}02${sLen}${sHex}`; - } - toRawBytes() { - return this.toDERRawBytes(); - } - toHex() { - return this.toDERHex(); - } - toCompactRawBytes() { - return hexToBytes3(this.toCompactHex()); - } - toCompactHex() { - return numTo32bStr2(this.r) + numTo32bStr2(this.s); - } - }; - function concatBytes3(...arrays) { - if (!arrays.every((b) => b instanceof Uint8Array)) - throw new Error("Uint8Array list expected"); - if (arrays.length === 1) - return arrays[0]; - const length = arrays.reduce((a, arr) => a + arr.length, 0); - const result = new Uint8Array(length); - for (let i = 0, pad = 0; i < arrays.length; i++) { - const arr = arrays[i]; - result.set(arr, pad); - pad += arr.length; - } - return result; - } - var hexes4 = Array.from({ length: 256 }, (v, i) => i.toString(16).padStart(2, "0")); - function bytesToHex3(uint8a) { - if (!(uint8a instanceof Uint8Array)) - throw new Error("Expected Uint8Array"); - let hex2 = ""; - for (let i = 0; i < uint8a.length; i++) { - hex2 += hexes4[uint8a[i]]; - } - return hex2; - } - var POW_2_2562 = BigInt("0x10000000000000000000000000000000000000000000000000000000000000000"); - function numTo32bStr2(num) { - if (typeof num !== "bigint") - throw new Error("Expected bigint"); - if (!(_0n2 <= num && num < POW_2_2562)) - throw new Error("Expected number < 2^256"); - return num.toString(16).padStart(64, "0"); - } - function numTo32b2(num) { - const b = hexToBytes3(numTo32bStr2(num)); - if (b.length !== 32) - throw new Error("Error: expected 32 bytes"); - return b; - } - function numberToHexUnpadded2(num) { - const hex2 = num.toString(16); - return hex2.length & 1 ? `0${hex2}` : hex2; - } - function hexToNumber2(hex2) { - if (typeof hex2 !== "string") { - throw new TypeError("hexToNumber: expected string, got " + typeof hex2); - } - return BigInt(`0x${hex2}`); - } - function hexToBytes3(hex2) { - if (typeof hex2 !== "string") { - throw new TypeError("hexToBytes: expected string, got " + typeof hex2); - } - if (hex2.length % 2) - throw new Error("hexToBytes: received invalid unpadded hex" + hex2.length); - const array = new Uint8Array(hex2.length / 2); - for (let i = 0; i < array.length; i++) { - const j = i * 2; - const hexByte = hex2.slice(j, j + 2); - const byte = Number.parseInt(hexByte, 16); - if (Number.isNaN(byte) || byte < 0) - throw new Error("Invalid byte sequence"); - array[i] = byte; - } - return array; - } - function bytesToNumber2(bytes2) { - return hexToNumber2(bytesToHex3(bytes2)); - } - function ensureBytes2(hex2) { - return hex2 instanceof Uint8Array ? Uint8Array.from(hex2) : hexToBytes3(hex2); - } - function normalizeScalar2(num) { - if (typeof num === "number" && Number.isSafeInteger(num) && num > 0) - return BigInt(num); - if (typeof num === "bigint" && isWithinCurveOrder2(num)) - return num; - throw new TypeError("Expected valid private scalar: 0 < scalar < curve.n"); - } - function mod2(a, b = CURVE2.P) { - const result = a % b; - return result >= _0n2 ? result : b + result; - } - function pow22(x, power) { - const { P } = CURVE2; - let res = x; - while (power-- > _0n2) { - res *= res; - res %= P; - } - return res; - } - function sqrtMod2(x) { - const { P } = CURVE2; - const _6n = BigInt(6); - const _11n = BigInt(11); - const _22n = BigInt(22); - const _23n = BigInt(23); - const _44n = BigInt(44); - const _88n = BigInt(88); - const b2 = x * x * x % P; - const b3 = b2 * b2 * x % P; - const b6 = pow22(b3, _3n2) * b3 % P; - const b9 = pow22(b6, _3n2) * b3 % P; - const b11 = pow22(b9, _2n2) * b2 % P; - const b22 = pow22(b11, _11n) * b11 % P; - const b44 = pow22(b22, _22n) * b22 % P; - const b88 = pow22(b44, _44n) * b44 % P; - const b176 = pow22(b88, _88n) * b88 % P; - const b220 = pow22(b176, _44n) * b44 % P; - const b223 = pow22(b220, _3n2) * b3 % P; - const t1 = pow22(b223, _23n) * b22 % P; - const t2 = pow22(t1, _6n) * b2 % P; - return pow22(t2, _2n2); - } - function invert2(number2, modulo = CURVE2.P) { - if (number2 === _0n2 || modulo <= _0n2) { - throw new Error(`invert: expected positive integers, got n=${number2} mod=${modulo}`); - } - let a = mod2(number2, modulo); - let b = modulo; - let x = _0n2, y = _1n2, u = _1n2, v = _0n2; - while (a !== _0n2) { - const q = b / a; - const r = b % a; - const m = x - u * q; - const n = y - v * q; - b = a, a = r, x = u, y = v, u = m, v = n; - } - const gcd2 = b; - if (gcd2 !== _1n2) - throw new Error("invert: does not exist"); - return mod2(x, modulo); - } - function invertBatch2(nums, p = CURVE2.P) { - const scratch = new Array(nums.length); - const lastMultiplied = nums.reduce((acc, num, i) => { - if (num === _0n2) - return acc; - scratch[i] = acc; - return mod2(acc * num, p); - }, _1n2); - const inverted = invert2(lastMultiplied, p); - nums.reduceRight((acc, num, i) => { - if (num === _0n2) - return acc; - scratch[i] = mod2(acc * scratch[i], p); - return mod2(acc * num, p); - }, inverted); - return scratch; - } - var divNearest2 = (a, b) => (a + b / _2n2) / b; - var ENDO = { - a1: BigInt("0x3086d221a7d46bcde86c90e49284eb15"), - b1: -_1n2 * BigInt("0xe4437ed6010e88286f547fa90abfe4c3"), - a2: BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"), - b2: BigInt("0x3086d221a7d46bcde86c90e49284eb15"), - POW_2_128: BigInt("0x100000000000000000000000000000000") - }; - function splitScalarEndo(k) { - const { n } = CURVE2; - const { a1, b1, a2, b2, POW_2_128 } = ENDO; - const c1 = divNearest2(b2 * k, n); - const c2 = divNearest2(-b1 * k, n); - let k1 = mod2(k - c1 * a1 - c2 * a2, n); - let k2 = mod2(-c1 * b1 - c2 * b2, n); - const k1neg = k1 > POW_2_128; - const k2neg = k2 > POW_2_128; - if (k1neg) - k1 = n - k1; - if (k2neg) - k2 = n - k2; - if (k1 > POW_2_128 || k2 > POW_2_128) { - throw new Error("splitScalarEndo: Endomorphism failed, k=" + k); - } - return { k1neg, k1, k2neg, k2 }; - } - function truncateHash2(hash2) { - const { n } = CURVE2; - const byteLength = hash2.length; - const delta = byteLength * 8 - 256; - let h = bytesToNumber2(hash2); - if (delta > 0) - h = h >> BigInt(delta); - if (h >= n) - h -= n; - return h; - } - var _sha256Sync2; - var _hmacSha256Sync2; - var HmacDrbg = class { - constructor() { - this.v = new Uint8Array(32).fill(1); - this.k = new Uint8Array(32).fill(0); - this.counter = 0; - } - hmac(...values) { - return utils2.hmacSha256(this.k, ...values); - } - hmacSync(...values) { - return _hmacSha256Sync2(this.k, ...values); - } - checkSync() { - if (typeof _hmacSha256Sync2 !== "function") - throw new ShaError2("hmacSha256Sync needs to be set"); - } - incr() { - if (this.counter >= 1e3) - throw new Error("Tried 1,000 k values for sign(), all were invalid"); - this.counter += 1; - } - async reseed(seed = new Uint8Array()) { - this.k = await this.hmac(this.v, Uint8Array.from([0]), seed); - this.v = await this.hmac(this.v); - if (seed.length === 0) - return; - this.k = await this.hmac(this.v, Uint8Array.from([1]), seed); - this.v = await this.hmac(this.v); - } - reseedSync(seed = new Uint8Array()) { - this.checkSync(); - this.k = this.hmacSync(this.v, Uint8Array.from([0]), seed); - this.v = this.hmacSync(this.v); - if (seed.length === 0) - return; - this.k = this.hmacSync(this.v, Uint8Array.from([1]), seed); - this.v = this.hmacSync(this.v); - } - async generate() { - this.incr(); - this.v = await this.hmac(this.v); - return this.v; - } - generateSync() { - this.checkSync(); - this.incr(); - this.v = this.hmacSync(this.v); - return this.v; - } - }; - function isWithinCurveOrder2(num) { - return _0n2 < num && num < CURVE2.n; - } - function isValidFieldElement2(num) { - return _0n2 < num && num < CURVE2.P; - } - function kmdToSig(kBytes, m, d) { - const k = bytesToNumber2(kBytes); - if (!isWithinCurveOrder2(k)) - return; - const { n } = CURVE2; - const q = Point2.BASE.multiply(k); - const r = mod2(q.x, n); - if (r === _0n2) - return; - const s = mod2(invert2(k, n) * mod2(m + d * r, n), n); - if (s === _0n2) - return; - const sig = new Signature2(r, s); - const recovery = (q.x === sig.r ? 0 : 2) | Number(q.y & _1n2); - return { sig, recovery }; - } - function normalizePrivateKey2(key) { - let num; - if (typeof key === "bigint") { - num = key; - } else if (typeof key === "number" && Number.isSafeInteger(key) && key > 0) { - num = BigInt(key); - } else if (typeof key === "string") { - if (key.length !== 64) - throw new Error("Expected 32 bytes of private key"); - num = hexToNumber2(key); - } else if (key instanceof Uint8Array) { - if (key.length !== 32) - throw new Error("Expected 32 bytes of private key"); - num = bytesToNumber2(key); - } else { - throw new TypeError("Expected valid private key"); - } - if (!isWithinCurveOrder2(num)) - throw new Error("Expected private key: 0 < key < n"); - return num; - } - function normalizePublicKey2(publicKey) { - if (publicKey instanceof Point2) { - publicKey.assertValidity(); - return publicKey; - } else { - return Point2.fromHex(publicKey); - } - } - function normalizeSignature2(signature) { - if (signature instanceof Signature2) { - signature.assertValidity(); - return signature; - } - try { - return Signature2.fromDER(signature); - } catch (error) { - return Signature2.fromCompact(signature); - } - } - function getPublicKey2(privateKey, isCompressed = false) { - return Point2.fromPrivateKey(privateKey).toRawBytes(isCompressed); - } - function bits2int(bytes2) { - const slice = bytes2.length > 32 ? bytes2.slice(0, 32) : bytes2; - return bytesToNumber2(slice); - } - function bits2octets(bytes2) { - const z1 = bits2int(bytes2); - const z2 = mod2(z1, CURVE2.n); - return int2octets(z2 < _0n2 ? z1 : z2); - } - function int2octets(num) { - return numTo32b2(num); - } - function initSigArgs(msgHash, privateKey, extraEntropy) { - if (msgHash == null) - throw new Error(`sign: expected valid message hash, not "${msgHash}"`); - const h1 = ensureBytes2(msgHash); - const d = normalizePrivateKey2(privateKey); - const seedArgs = [int2octets(d), bits2octets(h1)]; - if (extraEntropy != null) { - if (extraEntropy === true) - extraEntropy = utils2.randomBytes(32); - const e = ensureBytes2(extraEntropy); - if (e.length !== 32) - throw new Error("sign: Expected 32 bytes of extra data"); - seedArgs.push(e); - } - const seed = concatBytes3(...seedArgs); - const m = bits2int(h1); - return { seed, m, d }; - } - function finalizeSig(recSig, opts) { - let { sig, recovery } = recSig; - const { canonical, der, recovered } = Object.assign({ canonical: true, der: true }, opts); - if (canonical && sig.hasHighS()) { - sig = sig.normalizeS(); - recovery ^= 1; - } - const hashed = der ? sig.toDERRawBytes() : sig.toCompactRawBytes(); - return recovered ? [hashed, recovery] : hashed; - } - function signSync(msgHash, privKey, opts = {}) { - const { seed, m, d } = initSigArgs(msgHash, privKey, opts.extraEntropy); - let sig; - const drbg = new HmacDrbg(); - drbg.reseedSync(seed); - while (!(sig = kmdToSig(drbg.generateSync(), m, d))) - drbg.reseedSync(); - return finalizeSig(sig, opts); - } - var vopts = { strict: true }; - function verify(signature, msgHash, publicKey, opts = vopts) { - let sig; - try { - sig = normalizeSignature2(signature); - msgHash = ensureBytes2(msgHash); - } catch (error) { - return false; - } - const { r, s } = sig; - if (opts.strict && sig.hasHighS()) - return false; - const h = truncateHash2(msgHash); - let P; - try { - P = normalizePublicKey2(publicKey); - } catch (error) { - return false; - } - const { n } = CURVE2; - const sinv = invert2(s, n); - const u1 = mod2(h * sinv, n); - const u2 = mod2(r * sinv, n); - const R = Point2.BASE.multiplyAndAddUnsafe(P, u1, u2); - if (!R) - return false; - const v = mod2(R.x, n); - return v === r; - } - Point2.BASE._setWindowSize(8); - var crypto5 = { - node: nodeCrypto2, - web: typeof self === "object" && "crypto" in self ? self.crypto : void 0 - }; - var TAGGED_HASH_PREFIXES2 = {}; - var utils2 = { - bytesToHex: bytesToHex3, - hexToBytes: hexToBytes3, - concatBytes: concatBytes3, - mod: mod2, - invert: invert2, - isValidPrivateKey(privateKey) { - try { - normalizePrivateKey2(privateKey); - return true; - } catch (error) { - return false; - } - }, - _bigintTo32Bytes: numTo32b2, - _normalizePrivateKey: normalizePrivateKey2, - hashToPrivateKey: (hash2) => { - hash2 = ensureBytes2(hash2); - if (hash2.length < 40 || hash2.length > 1024) - throw new Error("Expected 40-1024 bytes of private key as per FIPS 186"); - const num = mod2(bytesToNumber2(hash2), CURVE2.n - _1n2) + _1n2; - return numTo32b2(num); - }, - randomBytes: (bytesLength = 32) => { - if (crypto5.web) { - return crypto5.web.getRandomValues(new Uint8Array(bytesLength)); - } else if (crypto5.node) { - const { randomBytes: randomBytes2 } = crypto5.node; - return Uint8Array.from(randomBytes2(bytesLength)); - } else { - throw new Error("The environment doesn't have randomBytes function"); - } - }, - randomPrivateKey: () => { - return utils2.hashToPrivateKey(utils2.randomBytes(40)); - }, - sha256: async (...messages) => { - if (crypto5.web) { - const buffer = await crypto5.web.subtle.digest("SHA-256", concatBytes3(...messages)); - return new Uint8Array(buffer); - } else if (crypto5.node) { - const { createHash } = crypto5.node; - const hash2 = createHash("sha256"); - messages.forEach((m) => hash2.update(m)); - return Uint8Array.from(hash2.digest()); - } else { - throw new Error("The environment doesn't have sha256 function"); - } - }, - hmacSha256: async (key, ...messages) => { - if (crypto5.web) { - const ckey = await crypto5.web.subtle.importKey("raw", key, { name: "HMAC", hash: { name: "SHA-256" } }, false, ["sign"]); - const message = concatBytes3(...messages); - const buffer = await crypto5.web.subtle.sign("HMAC", ckey, message); - return new Uint8Array(buffer); - } else if (crypto5.node) { - const { createHmac } = crypto5.node; - const hash2 = createHmac("sha256", key); - messages.forEach((m) => hash2.update(m)); - return Uint8Array.from(hash2.digest()); - } else { - throw new Error("The environment doesn't have hmac-sha256 function"); - } - }, - sha256Sync: void 0, - hmacSha256Sync: void 0, - taggedHash: async (tag, ...messages) => { - let tagP = TAGGED_HASH_PREFIXES2[tag]; - if (tagP === void 0) { - const tagH = await utils2.sha256(Uint8Array.from(tag, (c) => c.charCodeAt(0))); - tagP = concatBytes3(tagH, tagH); - TAGGED_HASH_PREFIXES2[tag] = tagP; - } - return utils2.sha256(tagP, ...messages); - }, - taggedHashSync: (tag, ...messages) => { - if (typeof _sha256Sync2 !== "function") - throw new ShaError2("sha256Sync is undefined, you need to set it"); - let tagP = TAGGED_HASH_PREFIXES2[tag]; - if (tagP === void 0) { - const tagH = _sha256Sync2(Uint8Array.from(tag, (c) => c.charCodeAt(0))); - tagP = concatBytes3(tagH, tagH); - TAGGED_HASH_PREFIXES2[tag] = tagP; - } - return _sha256Sync2(tagP, ...messages); - }, - precompute(windowSize = 8, point = Point2.BASE) { - const cached = point === Point2.BASE ? point : new Point2(point.x, point.y); - cached._setWindowSize(windowSize); - cached.multiply(_3n2); - return cached; - } - }; - Object.defineProperties(utils2, { - sha256Sync: { - configurable: false, - get() { - return _sha256Sync2; - }, - set(val) { - if (!_sha256Sync2) - _sha256Sync2 = val; - } - }, - hmacSha256Sync: { - configurable: false, - get() { - return _hmacSha256Sync2; - }, - set(val) { - if (!_hmacSha256Sync2) - _hmacSha256Sync2 = val; - } - } - }); - - // node_modules/@scure/bip32/lib/esm/index.js - utils2.hmacSha256Sync = (key, ...msgs) => hmac(sha2562, key, utils2.concatBytes(...msgs)); - var base58check2 = base58check(sha2562); - function bytesToNumber3(bytes2) { - return BigInt(`0x${bytesToHex2(bytes2)}`); - } - function numberToBytes(num) { - return hexToBytes2(num.toString(16).padStart(64, "0")); - } - var MASTER_SECRET = utf8ToBytes2("Bitcoin seed"); - var BITCOIN_VERSIONS = { private: 76066276, public: 76067358 }; - var HARDENED_OFFSET = 2147483648; - var hash160 = (data) => ripemd160(sha2562(data)); - var fromU32 = (data) => createView2(data).getUint32(0, false); - var toU32 = (n) => { - if (!Number.isSafeInteger(n) || n < 0 || n > 2 ** 32 - 1) { - throw new Error(`Invalid number=${n}. Should be from 0 to 2 ** 32 - 1`); - } - const buf = new Uint8Array(4); - createView2(buf).setUint32(0, n, false); - return buf; - }; - var HDKey = class { - constructor(opt) { - this.depth = 0; - this.index = 0; - this.chainCode = null; - this.parentFingerprint = 0; - if (!opt || typeof opt !== "object") { - throw new Error("HDKey.constructor must not be called directly"); - } - this.versions = opt.versions || BITCOIN_VERSIONS; - this.depth = opt.depth || 0; - this.chainCode = opt.chainCode; - this.index = opt.index || 0; - this.parentFingerprint = opt.parentFingerprint || 0; - if (!this.depth) { - if (this.parentFingerprint || this.index) { - throw new Error("HDKey: zero depth with non-zero index/parent fingerprint"); - } - } - if (opt.publicKey && opt.privateKey) { - throw new Error("HDKey: publicKey and privateKey at same time."); - } - if (opt.privateKey) { - if (!utils2.isValidPrivateKey(opt.privateKey)) { - throw new Error("Invalid private key"); - } - this.privKey = typeof opt.privateKey === "bigint" ? opt.privateKey : bytesToNumber3(opt.privateKey); - this.privKeyBytes = numberToBytes(this.privKey); - this.pubKey = getPublicKey2(opt.privateKey, true); - } else if (opt.publicKey) { - this.pubKey = Point2.fromHex(opt.publicKey).toRawBytes(true); - } else { - throw new Error("HDKey: no public or private key provided"); - } - this.pubHash = hash160(this.pubKey); - } - get fingerprint() { - if (!this.pubHash) { - throw new Error("No publicKey set!"); - } - return fromU32(this.pubHash); - } - get identifier() { - return this.pubHash; - } - get pubKeyHash() { - return this.pubHash; - } - get privateKey() { - return this.privKeyBytes || null; - } - get publicKey() { - return this.pubKey || null; - } - get privateExtendedKey() { - const priv = this.privateKey; - if (!priv) { - throw new Error("No private key"); - } - return base58check2.encode(this.serialize(this.versions.private, concatBytes2(new Uint8Array([0]), priv))); - } - get publicExtendedKey() { - if (!this.pubKey) { - throw new Error("No public key"); - } - return base58check2.encode(this.serialize(this.versions.public, this.pubKey)); - } - static fromMasterSeed(seed, versions = BITCOIN_VERSIONS) { - bytes(seed); - if (8 * seed.length < 128 || 8 * seed.length > 512) { - throw new Error(`HDKey: wrong seed length=${seed.length}. Should be between 128 and 512 bits; 256 bits is advised)`); - } - const I = hmac(sha512, MASTER_SECRET, seed); - return new HDKey({ - versions, - chainCode: I.slice(32), - privateKey: I.slice(0, 32) - }); - } - static fromExtendedKey(base58key, versions = BITCOIN_VERSIONS) { - const keyBuffer = base58check2.decode(base58key); - const keyView = createView2(keyBuffer); - const version = keyView.getUint32(0, false); - const opt = { - versions, - depth: keyBuffer[4], - parentFingerprint: keyView.getUint32(5, false), - index: keyView.getUint32(9, false), - chainCode: keyBuffer.slice(13, 45) - }; - const key = keyBuffer.slice(45); - const isPriv = key[0] === 0; - if (version !== versions[isPriv ? "private" : "public"]) { - throw new Error("Version mismatch"); - } - if (isPriv) { - return new HDKey({ ...opt, privateKey: key.slice(1) }); - } else { - return new HDKey({ ...opt, publicKey: key }); - } - } - static fromJSON(json) { - return HDKey.fromExtendedKey(json.xpriv); - } - derive(path) { - if (!/^[mM]'?/.test(path)) { - throw new Error('Path must start with "m" or "M"'); - } - if (/^[mM]'?$/.test(path)) { - return this; - } - const parts = path.replace(/^[mM]'?\//, "").split("/"); - let child = this; - for (const c of parts) { - const m = /^(\d+)('?)$/.exec(c); - if (!m || m.length !== 3) { - throw new Error(`Invalid child index: ${c}`); - } - let idx = +m[1]; - if (!Number.isSafeInteger(idx) || idx >= HARDENED_OFFSET) { - throw new Error("Invalid index"); - } - if (m[2] === "'") { - idx += HARDENED_OFFSET; - } - child = child.deriveChild(idx); - } - return child; - } - deriveChild(index) { - if (!this.pubKey || !this.chainCode) { - throw new Error("No publicKey or chainCode set"); - } - let data = toU32(index); - if (index >= HARDENED_OFFSET) { - const priv = this.privateKey; - if (!priv) { - throw new Error("Could not derive hardened child key"); - } - data = concatBytes2(new Uint8Array([0]), priv, data); - } else { - data = concatBytes2(this.pubKey, data); - } - const I = hmac(sha512, this.chainCode, data); - const childTweak = bytesToNumber3(I.slice(0, 32)); - const chainCode = I.slice(32); - if (!utils2.isValidPrivateKey(childTweak)) { - throw new Error("Tweak bigger than curve order"); - } - const opt = { - versions: this.versions, - chainCode, - depth: this.depth + 1, - parentFingerprint: this.fingerprint, - index - }; - try { - if (this.privateKey) { - const added = utils2.mod(this.privKey + childTweak, CURVE2.n); - if (!utils2.isValidPrivateKey(added)) { - throw new Error("The tweak was out of range or the resulted private key is invalid"); - } - opt.privateKey = added; - } else { - const added = Point2.fromHex(this.pubKey).add(Point2.fromPrivateKey(childTweak)); - if (added.equals(Point2.ZERO)) { - throw new Error("The tweak was equal to negative P, which made the result key invalid"); - } - opt.publicKey = added.toRawBytes(true); - } - return new HDKey(opt); - } catch (err) { - return this.deriveChild(index + 1); - } - } - sign(hash2) { - if (!this.privateKey) { - throw new Error("No privateKey set!"); - } - bytes(hash2, 32); - return signSync(hash2, this.privKey, { - canonical: true, - der: false - }); - } - verify(hash2, signature) { - bytes(hash2, 32); - bytes(signature, 64); - if (!this.publicKey) { - throw new Error("No publicKey set!"); - } - let sig; - try { - sig = Signature2.fromCompact(signature); - } catch (error) { - return false; - } - return verify(sig, hash2, this.publicKey); - } - wipePrivateData() { - this.privKey = void 0; - if (this.privKeyBytes) { - this.privKeyBytes.fill(0); - this.privKeyBytes = void 0; - } - return this; - } - toJSON() { - return { - xpriv: this.privateExtendedKey, - xpub: this.publicExtendedKey - }; - } - serialize(version, key) { - if (!this.chainCode) { - throw new Error("No chainCode set"); - } - bytes(key, 33); - return concatBytes2(toU32(version), new Uint8Array([this.depth]), toU32(this.parentFingerprint), toU32(this.index), this.chainCode, key); - } - }; - - // nip06.ts - function privateKeyFromSeedWords(mnemonic, passphrase) { - let root = HDKey.fromMasterSeed((0, import_bip39.mnemonicToSeedSync)(mnemonic, passphrase)); - let privateKey = root.derive(`m/44'/1237'/0'/0/0`).privateKey; - if (!privateKey) - throw new Error("could not derive private key"); - return utils.bytesToHex(privateKey); - } - function generateSeedWords() { - return (0, import_bip39.generateMnemonic)(import_english.wordlist); - } - function validateWords(words) { - return (0, import_bip39.validateMnemonic)(words, import_english.wordlist); - } - - // nip19.ts - var nip19_exports = {}; - __export(nip19_exports, { - decode: () => decode, - naddrEncode: () => naddrEncode, - neventEncode: () => neventEncode, - noteEncode: () => noteEncode, - nprofileEncode: () => nprofileEncode, - npubEncode: () => npubEncode, - nsecEncode: () => nsecEncode - }); - init_define_process(); - var Bech32MaxSize = 5e3; - function decode(nip19) { - let { prefix, words } = bech32.decode(nip19, Bech32MaxSize); - let data = new Uint8Array(bech32.fromWords(words)); - switch (prefix) { - case "nprofile": { - let tlv = parseTLV(data); - if (!tlv[0]?.[0]) - throw new Error("missing TLV 0 for nprofile"); - if (tlv[0][0].length !== 32) - throw new Error("TLV 0 should be 32 bytes"); - return { - type: "nprofile", - data: { - pubkey: utils.bytesToHex(tlv[0][0]), - relays: tlv[1] ? tlv[1].map((d) => utf8Decoder.decode(d)) : [] - } - }; - } - case "nevent": { - let tlv = parseTLV(data); - if (!tlv[0]?.[0]) - throw new Error("missing TLV 0 for nevent"); - if (tlv[0][0].length !== 32) - throw new Error("TLV 0 should be 32 bytes"); - return { - type: "nevent", - data: { - id: utils.bytesToHex(tlv[0][0]), - relays: tlv[1] ? tlv[1].map((d) => utf8Decoder.decode(d)) : [] - } - }; - } - case "naddr": { - let tlv = parseTLV(data); - if (!tlv[0]?.[0]) - throw new Error("missing TLV 0 for naddr"); - if (!tlv[2]?.[0]) - throw new Error("missing TLV 2 for naddr"); - if (tlv[2][0].length !== 32) - throw new Error("TLV 2 should be 32 bytes"); - if (!tlv[3]?.[0]) - throw new Error("missing TLV 3 for naddr"); - if (tlv[3][0].length !== 4) - throw new Error("TLV 3 should be 4 bytes"); - return { - type: "naddr", - data: { - identifier: utf8Decoder.decode(tlv[0][0]), - pubkey: utils.bytesToHex(tlv[2][0]), - kind: parseInt(utils.bytesToHex(tlv[3][0]), 16), - relays: tlv[1] ? tlv[1].map((d) => utf8Decoder.decode(d)) : [] - } - }; - } - case "nsec": - case "npub": - case "note": - return { type: prefix, data: utils.bytesToHex(data) }; - default: - throw new Error(`unknown prefix ${prefix}`); - } - } - function parseTLV(data) { - let result = {}; - let rest = data; - while (rest.length > 0) { - let t = rest[0]; - let l = rest[1]; - let v = rest.slice(2, 2 + l); - rest = rest.slice(2 + l); - if (v.length < l) - continue; - result[t] = result[t] || []; - result[t].push(v); - } - return result; - } - function nsecEncode(hex2) { - return encodeBytes("nsec", hex2); - } - function npubEncode(hex2) { - return encodeBytes("npub", hex2); - } - function noteEncode(hex2) { - return encodeBytes("note", hex2); - } - function encodeBytes(prefix, hex2) { - let data = utils.hexToBytes(hex2); - let words = bech32.toWords(data); - return bech32.encode(prefix, words, Bech32MaxSize); - } - function nprofileEncode(profile) { - let data = encodeTLV({ - 0: [utils.hexToBytes(profile.pubkey)], - 1: (profile.relays || []).map((url) => utf8Encoder.encode(url)) - }); - let words = bech32.toWords(data); - return bech32.encode("nprofile", words, Bech32MaxSize); - } - function neventEncode(event) { - let data = encodeTLV({ - 0: [utils.hexToBytes(event.id)], - 1: (event.relays || []).map((url) => utf8Encoder.encode(url)) - }); - let words = bech32.toWords(data); - return bech32.encode("nevent", words, Bech32MaxSize); - } - function naddrEncode(addr) { - let kind = new ArrayBuffer(4); - new DataView(kind).setUint32(0, addr.kind, false); - let data = encodeTLV({ - 0: [utf8Encoder.encode(addr.identifier)], - 1: (addr.relays || []).map((url) => utf8Encoder.encode(url)), - 2: [utils.hexToBytes(addr.pubkey)], - 3: [new Uint8Array(kind)] - }); - let words = bech32.toWords(data); - return bech32.encode("naddr", words, Bech32MaxSize); - } - function encodeTLV(tlv) { - let entries = []; - Object.entries(tlv).forEach(([t, vs]) => { - vs.forEach((v) => { - let entry = new Uint8Array(v.length + 2); - entry.set([parseInt(t)], 0); - entry.set([v.length], 1); - entry.set(v, 2); - entries.push(entry); - }); - }); - return utils.concatBytes(...entries); - } - - // nip26.ts - var nip26_exports = {}; - __export(nip26_exports, { - createDelegation: () => createDelegation, - getDelegator: () => getDelegator - }); - init_define_process(); - function createDelegation(privateKey, parameters) { - let conditions = []; - if ((parameters.kind || -1) >= 0) - conditions.push(`kind=${parameters.kind}`); - if (parameters.until) - conditions.push(`created_at<${parameters.until}`); - if (parameters.since) - conditions.push(`created_at>${parameters.since}`); - let cond = conditions.join("&"); - if (cond === "") - throw new Error("refusing to create a delegation without any conditions"); - let sighash = sha256( - utf8Encoder.encode(`nostr:delegation:${parameters.pubkey}:${cond}`) - ); - let sig = utils.bytesToHex( - schnorr.signSync(sighash, privateKey) - ); - return { - from: getPublicKey(privateKey), - to: parameters.pubkey, - cond, - sig - }; - } - function getDelegator(event) { - let tag = event.tags.find((tag2) => tag2[0] === "delegation" && tag2.length >= 4); - if (!tag) - return null; - let pubkey = tag[1]; - let cond = tag[2]; - let sig = tag[3]; - let conditions = cond.split("&"); - for (let i = 0; i < conditions.length; i++) { - let [key, operator, value] = conditions[i].split(/\b/); - if (key === "kind" && operator === "=" && event.kind === parseInt(value)) - continue; - else if (key === "created_at" && operator === "<" && event.created_at < parseInt(value)) - continue; - else if (key === "created_at" && operator === ">" && event.created_at > parseInt(value)) - continue; - else - return null; - } - let sighash = sha256( - utf8Encoder.encode(`nostr:delegation:${event.pubkey}:${cond}`) - ); - if (!schnorr.verifySync(sig, sighash, pubkey)) - return null; - return pubkey; - } - - // nip57.ts - var nip57_exports = {}; - __export(nip57_exports, { - getZapEndpoint: () => getZapEndpoint, - makeZapReceipt: () => makeZapReceipt, - makeZapRequest: () => makeZapRequest, - useFetchImplementation: () => useFetchImplementation2, - validateZapRequest: () => validateZapRequest - }); - init_define_process(); - var _fetch2; - try { - _fetch2 = fetch; - } catch { - } - function useFetchImplementation2(fetchImplementation) { - _fetch2 = fetchImplementation; - } - async function getZapEndpoint(metadata) { - try { - let lnurl = ""; - let { lud06, lud16 } = JSON.parse(metadata.content); - if (lud06) { - let { words } = bech32.decode(lud06, 1e3); - let data = bech32.fromWords(words); - lnurl = utf8Decoder.decode(data); - } else if (lud16) { - let [name, domain] = lud16.split("@"); - lnurl = `https://${domain}/.well-known/lnurlp/${name}`; - } else { - return null; - } - let res = await _fetch2(lnurl); - let body = await res.json(); - if (body.allowsNostr && body.nostrPubkey) { - return body.callback; - } - } catch (err) { - } - return null; - } - function makeZapRequest({ - profile, - event, - amount, - relays, - comment = "" - }) { - if (!amount) - throw new Error("amount not given"); - if (!profile) - throw new Error("profile not given"); - let zr = { - kind: 9734, - created_at: Math.round(Date.now() / 1e3), - content: comment, - tags: [ - ["p", profile], - ["amount", amount.toString()], - ["relays", ...relays] - ] - }; - if (event) { - zr.tags.push(["e", event]); - } - return zr; - } - function validateZapRequest(zapRequestString) { - let zapRequest; - try { - zapRequest = JSON.parse(zapRequestString); - } catch (err) { - return "Invalid zap request JSON."; - } - if (!validateEvent(zapRequest)) - return "Zap request is not a valid Nostr event."; - if (!verifySignature(zapRequest)) - return "Invalid signature on zap request."; - let p = zapRequest.tags.find(([t, v]) => t === "p" && v); - if (!p) - return "Zap request doesn't have a 'p' tag."; - if (!p[1].match(/^[a-f0-9]{64}$/)) - return "Zap request 'p' tag is not valid hex."; - let e = zapRequest.tags.find(([t, v]) => t === "e" && v); - if (e && !e[1].match(/^[a-f0-9]{64}$/)) - return "Zap request 'e' tag is not valid hex."; - let relays = zapRequest.tags.find(([t, v]) => t === "relays" && v); - if (!relays) - return "Zap request doesn't have a 'relays' tag."; - return null; - } - function makeZapReceipt({ - zapRequest, - preimage, - bolt11, - paidAt - }) { - let zr = JSON.parse(zapRequest); - let tagsFromZapRequest = zr.tags.filter( - ([t]) => t === "e" || t === "p" || t === "a" - ); - let zap = { - kind: 9735, - created_at: Math.round(paidAt.getTime() / 1e3), - content: "", - tags: [ - ...tagsFromZapRequest, - ["bolt11", bolt11], - ["description", zapRequest] - ] - }; - if (preimage) { - zap.tags.push(["preimage", preimage]); - } - return zap; - } - - // node_modules/@noble/hashes/esm/hmac.js - init_define_process(); - var HMAC2 = class extends Hash { - constructor(hash2, _key) { - super(); - this.finished = false; - this.destroyed = false; - assertHash(hash2); - const key = toBytes(_key); - this.iHash = hash2.create(); - if (!(this.iHash instanceof Hash)) - throw new TypeError("Expected instance of class which extends utils.Hash"); - const blockLen = this.blockLen = this.iHash.blockLen; - this.outputLen = this.iHash.outputLen; - const pad = new Uint8Array(blockLen); - pad.set(key.length > this.iHash.blockLen ? hash2.create().update(key).digest() : key); - for (let i = 0; i < pad.length; i++) - pad[i] ^= 54; - this.iHash.update(pad); - this.oHash = hash2.create(); - for (let i = 0; i < pad.length; i++) - pad[i] ^= 54 ^ 92; - this.oHash.update(pad); - pad.fill(0); - } - update(buf) { - if (this.destroyed) - throw new Error("instance is destroyed"); - this.iHash.update(buf); - return this; - } - digestInto(out) { - if (this.destroyed) - throw new Error("instance is destroyed"); - if (!(out instanceof Uint8Array) || out.length !== this.outputLen) - throw new Error("HMAC: Invalid output buffer"); - if (this.finished) - throw new Error("digest() was already called"); - this.finished = true; - this.iHash.digestInto(out); - this.oHash.update(out); - this.oHash.digestInto(out); - this.destroy(); - } - digest() { - const out = new Uint8Array(this.oHash.outputLen); - this.digestInto(out); - return out; - } - _cloneInto(to) { - to || (to = Object.create(Object.getPrototypeOf(this), {})); - const { oHash, iHash, finished, destroyed, blockLen, outputLen } = this; - to = to; - to.finished = finished; - to.destroyed = destroyed; - to.blockLen = blockLen; - to.outputLen = outputLen; - to.oHash = oHash._cloneInto(to.oHash); - to.iHash = iHash._cloneInto(to.iHash); - return to; - } - destroy() { - this.destroyed = true; - this.oHash.destroy(); - this.iHash.destroy(); - } - }; - var hmac2 = (hash2, key, message) => new HMAC2(hash2, key).update(message).digest(); - hmac2.create = (hash2, key) => new HMAC2(hash2, key); - - // index.ts - utils.hmacSha256Sync = (key, ...msgs) => hmac2(sha256, key, utils.concatBytes(...msgs)); - utils.sha256Sync = (...msgs) => sha256(utils.concatBytes(...msgs)); - return __toCommonJS(nostr_tools_exports); -})(); diff --git a/refactoring/js/lists.js b/refactoring/js/lists.js deleted file mode 100644 index 51e65a0..0000000 --- a/refactoring/js/lists.js +++ /dev/null @@ -1,13 +0,0 @@ -// js/lists.js - -const npubs = [ - "npub13yarr7j6vjqjjkahd63dmr27curypehx45ucue286ac7sft27y0srnpmpe", - "npub15jnttpymeytm80hatjqcvhhqhzrhx6gxp8pq0wn93rhnu8s9h9dsha32lx", - "npub1j37gc05qpqzyrmdc5vetsc9h5qtstas7tr25j0n9sdpqxghz6m4q2ej6n8", - "npub1epvnvv3kskvpnmpqgnm2atevsmdferhp7dg2s0yc7uc0hdmqmgssx09tu2", -]; - -console.log("DEBUG: lists.js loaded, npubs:", npubs); - -export const initialWhitelist = npubs; -export const initialBlacklist = [""]; diff --git a/refactoring/js/nostr.js b/refactoring/js/nostr.js deleted file mode 100644 index 4ac50f6..0000000 --- a/refactoring/js/nostr.js +++ /dev/null @@ -1,677 +0,0 @@ -// js/nostr.js - -import { isDevMode } from "./config.js"; -import { accessControl } from "./accessControl.js"; - -const RELAY_URLS = [ - "wss://relay.damus.io", - "wss://nos.lol", - "wss://relay.snort.social", - "wss://nostr.wine", -]; - -// Rate limiting for error logs -let errorLogCount = 0; -const MAX_ERROR_LOGS = 100; // Adjust as needed - -function logErrorOnce(message, eventContent = null) { - if (errorLogCount < MAX_ERROR_LOGS) { - console.error(message); - if (eventContent) { - console.log(`Event Content: ${eventContent}`); - } - errorLogCount++; - } - if (errorLogCount === MAX_ERROR_LOGS) { - console.error( - "Maximum error log limit reached. Further errors will be suppressed." - ); - } -} - -/** - * A very naive "encryption" function that just reverses the string. - * In a real app, use a proper crypto library (AES-GCM, ECDH, etc.). - */ -function fakeEncrypt(magnet) { - return magnet.split("").reverse().join(""); -} -function fakeDecrypt(encrypted) { - return encrypted.split("").reverse().join(""); -} - -class NostrClient { - constructor() { - this.pool = null; - this.pubkey = null; - this.relays = RELAY_URLS; - } - - /** - * Initializes the Nostr client by connecting to relays. - */ - async init() { - if (isDevMode) console.log("Connecting to relays..."); - - try { - this.pool = new window.NostrTools.SimplePool(); - const results = await this.connectToRelays(); - const successfulRelays = results - .filter((r) => r.success) - .map((r) => r.url); - - if (successfulRelays.length === 0) throw new Error("No relays connected"); - - if (isDevMode) - console.log(`Connected to ${successfulRelays.length} relay(s)`); - } catch (err) { - console.error("Nostr init failed:", err); - throw err; - } - } - - // Helper method to handle relay connections - async connectToRelays() { - return Promise.all( - this.relays.map( - (url) => - new Promise((resolve) => { - const sub = this.pool.sub([url], [{ kinds: [0], limit: 1 }]); - const timeout = setTimeout(() => { - sub.unsub(); - resolve({ url, success: false }); - }, 5000); - - const succeed = () => { - clearTimeout(timeout); - sub.unsub(); - resolve({ url, success: true }); - }; - - sub.on("event", succeed); - sub.on("eose", succeed); - }) - ) - ); - } - - /** - * Logs in the user using a Nostr extension or by entering an NSEC key. - */ - async login() { - try { - if (!window.nostr) { - console.log("No Nostr extension found"); - throw new Error( - "Please install a Nostr extension (like Alby or nos2x)." - ); - } - - const pubkey = await window.nostr.getPublicKey(); - const npub = window.NostrTools.nip19.npubEncode(pubkey); - - // Debug logs - if (isDevMode) { - console.log("Got pubkey:", pubkey); - console.log("Converted to npub:", npub); - console.log("Whitelist:", accessControl.getWhitelist()); - console.log("Blacklist:", accessControl.getBlacklist()); - console.log("Is whitelisted?", accessControl.isWhitelisted(npub)); - console.log("Is blacklisted?", accessControl.isBlacklisted(npub)); - } - - // Check access control - if (!accessControl.canAccess(npub)) { - if (accessControl.isBlacklisted(npub)) { - throw new Error( - "Your account has been blocked from accessing this platform." - ); - } else { - throw new Error( - "Access is currently restricted to whitelisted users only." - ); - } - } - - this.pubkey = pubkey; - if (isDevMode) - console.log( - "Successfully logged in with extension. Public key:", - this.pubkey - ); - return this.pubkey; - } catch (e) { - console.error("Login error:", e); - throw e; - } - } - - /** - * Logs out the user. - */ - logout() { - this.pubkey = null; - if (isDevMode) console.log("User logged out."); - } - - /** - * Decodes an NSEC key. - */ - decodeNsec(nsec) { - try { - const { data } = window.NostrTools.nip19.decode(nsec); - return data; - } catch (error) { - throw new Error("Invalid NSEC key."); - } - } - - /** - * Publishes a new video event to all relays (creates a brand-new note). - */ - async publishVideo(videoData, pubkey) { - if (!pubkey) { - throw new Error("User is not logged in."); - } - - if (isDevMode) { - console.log("Publishing video with data:", videoData); - } - - // If user sets "isPrivate = true", encrypt the magnet - let finalMagnet = videoData.magnet; - if (videoData.isPrivate === true) { - finalMagnet = fakeEncrypt(finalMagnet); - } - - // Default version is 1 if not specified - const version = videoData.version ?? 1; - - const uniqueD = `${Date.now()}-${Math.random() - .toString(36) - .substring(2, 10)}`; - - // Always mark "deleted" false for new posts - const contentObject = { - version, - deleted: false, - isPrivate: videoData.isPrivate || false, - title: videoData.title, - magnet: finalMagnet, - thumbnail: videoData.thumbnail, - description: videoData.description, - mode: videoData.mode, - }; - - const event = { - kind: 30078, - pubkey, - created_at: Math.floor(Date.now() / 1000), - tags: [ - ["t", "video"], - ["d", uniqueD], - ], - content: JSON.stringify(contentObject), - }; - - if (isDevMode) { - console.log("Event content after stringify:", event.content); - console.log("Using d tag:", uniqueD); - } - - try { - const signedEvent = await window.nostr.signEvent(event); - if (isDevMode) { - console.log("Signed event:", signedEvent); - } - - await Promise.all( - this.relays.map(async (url) => { - try { - await this.pool.publish([url], signedEvent); - if (isDevMode) { - console.log(`Event published to ${url}`); - } - } catch (err) { - if (isDevMode) { - console.error(`Failed to publish to ${url}:`, err.message); - } - } - }) - ); - - return signedEvent; - } catch (error) { - if (isDevMode) { - console.error("Failed to sign event:", error.message); - } - throw new Error("Failed to sign event."); - } - } - - /** - * Edits an existing video event by reusing the same "d" tag. - * Allows toggling isPrivate on/off and re-encrypting or decrypting the magnet. - */ - // Minimal fix: ensures we only ever encrypt once per edit operation - async editVideo(originalEvent, updatedVideoData, pubkey) { - if (!pubkey) { - throw new Error("User is not logged in."); - } - if (originalEvent.pubkey !== pubkey) { - throw new Error("You do not own this event (different pubkey)."); - } - - if (isDevMode) { - console.log("Editing video event:", originalEvent); - console.log("New video data:", updatedVideoData); - } - - // Grab the d tag from the original event - const dTag = originalEvent.tags.find((tag) => tag[0] === "d"); - if (!dTag) { - throw new Error( - 'This event has no "d" tag, cannot edit as addressable kind=30078.' - ); - } - const existingD = dTag[1]; - - // Parse old content - const oldContent = JSON.parse(originalEvent.content || "{}"); - if (isDevMode) { - console.log("Old content:", oldContent); - } - - // Keep old version & deleted status - const oldVersion = oldContent.version ?? 1; - const oldDeleted = oldContent.deleted === true; - const newVersion = updatedVideoData.version ?? oldVersion; - - const oldWasPrivate = oldContent.isPrivate === true; - - // 1) If old was private, decrypt the old magnet once => oldPlainMagnet - let oldPlainMagnet = oldContent.magnet || ""; - if (oldWasPrivate && oldPlainMagnet) { - oldPlainMagnet = fakeDecrypt(oldPlainMagnet); - } - - // 2) If updatedVideoData.isPrivate is explicitly set, use that; else keep the old isPrivate - const newIsPrivate = - typeof updatedVideoData.isPrivate === "boolean" - ? updatedVideoData.isPrivate - : oldContent.isPrivate ?? false; - - // 3) The user might type a new magnet or keep oldPlainMagnet - const userTypedMagnet = (updatedVideoData.magnet || "").trim(); - const finalPlainMagnet = userTypedMagnet || oldPlainMagnet; - - // 4) If new is private => encrypt finalPlainMagnet once; otherwise store plaintext - let finalMagnet = finalPlainMagnet; - if (newIsPrivate) { - finalMagnet = fakeEncrypt(finalPlainMagnet); - } - - // Build updated content - const contentObject = { - version: newVersion, - deleted: oldDeleted, - isPrivate: newIsPrivate, - title: updatedVideoData.title, - magnet: finalMagnet, - thumbnail: updatedVideoData.thumbnail, - description: updatedVideoData.description, - mode: updatedVideoData.mode, - }; - - if (isDevMode) { - console.log("Building updated content object:", contentObject); - } - - const event = { - kind: 30078, - pubkey, - created_at: Math.floor(Date.now() / 1000), - tags: [ - ["t", "video"], - ["d", existingD], - ], - content: JSON.stringify(contentObject), - }; - - if (isDevMode) { - console.log("Reusing d tag:", existingD); - console.log("Updated event content:", event.content); - } - - try { - const signedEvent = await window.nostr.signEvent(event); - if (isDevMode) { - console.log("Signed edited event:", signedEvent); - } - - // Publish to all relays - await Promise.all( - this.relays.map(async (url) => { - try { - await this.pool.publish([url], signedEvent); - if (isDevMode) { - console.log( - `Edited event published to ${url} (d="${existingD}")` - ); - } - } catch (err) { - if (isDevMode) { - console.error( - `Failed to publish edited event to ${url}:`, - err.message - ); - } - } - }) - ); - - return signedEvent; - } catch (error) { - if (isDevMode) { - console.error("Failed to sign edited event:", error.message); - } - throw new Error("Failed to sign edited event."); - } - } - - /** - * Soft-delete or hide an existing video by marking content as "deleted: true" - * and republishing with same (kind=30078, pubkey, d) address. - */ - async deleteVideo(originalEvent, pubkey) { - if (!pubkey) { - throw new Error("User is not logged in."); - } - if (originalEvent.pubkey !== pubkey) { - throw new Error("You do not own this event (different pubkey)."); - } - - if (isDevMode) { - console.log("Deleting video event:", originalEvent); - } - - const dTag = originalEvent.tags.find((tag) => tag[0] === "d"); - if (!dTag) { - throw new Error( - 'This event has no "d" tag, cannot delete as addressable kind=30078.' - ); - } - const existingD = dTag[1]; - - const oldContent = JSON.parse(originalEvent.content || "{}"); - const oldVersion = oldContent.version ?? 1; - - const contentObject = { - version: oldVersion, - deleted: true, - title: oldContent.title || "", - magnet: "", - thumbnail: "", - description: "This video has been deleted.", - mode: oldContent.mode || "live", - isPrivate: oldContent.isPrivate || false, - }; - - const event = { - kind: 30078, - pubkey, - created_at: Math.floor(Date.now() / 1000), - tags: [ - ["t", "video"], - ["d", existingD], - ], - content: JSON.stringify(contentObject), - }; - - if (isDevMode) { - console.log("Reusing d tag for delete:", existingD); - console.log("Deleted event content:", event.content); - } - - try { - const signedEvent = await window.nostr.signEvent(event); - if (isDevMode) { - console.log("Signed deleted event:", signedEvent); - } - - await Promise.all( - this.relays.map(async (url) => { - try { - await this.pool.publish([url], signedEvent); - if (isDevMode) { - console.log( - `Deleted event published to ${url} (d="${existingD}")` - ); - } - } catch (err) { - if (isDevMode) { - console.error( - `Failed to publish deleted event to ${url}:`, - err.message - ); - } - } - }) - ); - - return signedEvent; - } catch (error) { - if (isDevMode) { - console.error("Failed to sign deleted event:", error.message); - } - throw new Error("Failed to sign deleted event."); - } - } - - /** - * Fetches videos from all configured relays. - */ - async fetchVideos() { - const filter = { - kinds: [30078], - "#t": ["video"], - limit: 1000, - since: 0, - }; - - const videoEvents = new Map(); - - if (isDevMode) { - console.log("[fetchVideos] Starting fetch from all relays..."); - console.log("[fetchVideos] Filter:", filter); - } - - try { - await Promise.all( - this.relays.map(async (url) => { - if (isDevMode) console.log(`[fetchVideos] Querying relay: ${url}`); - - try { - const events = await this.pool.list([url], [filter]); - - if (isDevMode) { - console.log(`Events from ${url}:`, events.length); - if (events.length > 0) { - events.forEach((evt, idx) => { - console.log( - `[fetchVideos] [${url}] Event[${idx}] ID: ${evt.id} | pubkey: ${evt.pubkey} | created_at: ${evt.created_at}` - ); - }); - } - } - - events.forEach((event) => { - try { - const content = JSON.parse(event.content); - - // If deleted == true, it overrides older notes - if (content.deleted === true) { - videoEvents.delete(event.id); - return; - } - - // If we haven't seen this event.id before, store it - if (!videoEvents.has(event.id)) { - videoEvents.set(event.id, { - id: event.id, - version: content.version ?? 1, - isPrivate: content.isPrivate ?? false, - title: content.title || "", - magnet: content.magnet || "", - thumbnail: content.thumbnail || "", - description: content.description || "", - mode: content.mode || "live", - pubkey: event.pubkey, - created_at: event.created_at, - tags: event.tags, - }); - } - } catch (parseError) { - if (isDevMode) { - console.error( - "[fetchVideos] Event parsing error:", - parseError - ); - } - } - }); - } catch (relayError) { - if (isDevMode) { - console.error( - `[fetchVideos] Error fetching from ${url}:`, - relayError - ); - } - } - }) - ); - - const videos = Array.from(videoEvents.values()).sort( - (a, b) => b.created_at - a.created_at - ); - - // Apply access control filtering - const filteredVideos = accessControl.filterVideos(videos); - - if (isDevMode) { - console.log("[fetchVideos] All relays have responded."); - console.log( - `[fetchVideos] Total unique video events: ${videoEvents.size}` - ); - console.log( - `[fetchVideos] Videos after filtering: ${filteredVideos.length}` - ); - } - - return filteredVideos; - } catch (error) { - if (isDevMode) { - console.error("FETCH VIDEOS ERROR:", error); - } - return []; - } - } - - /** - * Fetches a user profile given a pubkey. - * Returns an object with 'name' and 'picture' properties. - */ - async fetchUserProfile(pubkey) { - if (!pubkey) { - throw new Error("Invalid pubkey provided."); - } - - if (isDevMode) { - console.log(`Fetching profile for pubkey: ${pubkey}`); - } - - const filter = { - kinds: [0], // Profile events - authors: [pubkey], - limit: 1, - }; - - try { - const events = await this.pool.list(this.relays, [filter]); - - if (events.length === 0) { - if (isDevMode) { - console.log(`No profile found for pubkey: ${pubkey}`); - } - return { - name: "Unknown", - picture: `https://robohash.org/${pubkey}`, - }; - } - - const profileContent = JSON.parse(events[0].content || "{}"); - - const profile = { - name: - profileContent.name || - profileContent.display_name || - `User ${pubkey.slice(0, 8)}...`, - picture: profileContent.picture || `https://robohash.org/${pubkey}`, - }; - - if (isDevMode) { - console.log(`Fetched profile for ${pubkey}:`, profile); - } - - return profile; - } catch (error) { - logErrorOnce(`Error fetching profile for ${pubkey}:`, error.message); - throw error; - } - } - - /** - * Validates video content structure. - */ - isValidVideo(content) { - try { - const isValid = - content && - typeof content === "object" && - typeof content.title === "string" && - content.title.length > 0 && - typeof content.magnet === "string" && - content.magnet.length > 0 && - typeof content.mode === "string" && - ["dev", "live"].includes(content.mode) && - (typeof content.thumbnail === "string" || - typeof content.thumbnail === "undefined") && - (typeof content.description === "string" || - typeof content.description === "undefined"); - - if (isDevMode && !isValid) { - console.log("Invalid video content:", content); - console.log("Validation details:", { - hasTitle: typeof content.title === "string", - hasMagnet: typeof content.magnet === "string", - hasMode: typeof content.mode === "string", - validThumbnail: - typeof content.thumbnail === "string" || - typeof content.thumbnail === "undefined", - validDescription: - typeof content.description === "string" || - typeof content.description === "undefined", - }); - } - - return isValid; - } catch (error) { - if (isDevMode) { - console.error("Error validating video:", error); - } - return false; - } - } -} - -export const nostrClient = new NostrClient(); diff --git a/refactoring/js/utils/htmlUtils.js b/refactoring/js/utils/htmlUtils.js deleted file mode 100644 index 320a9df..0000000 --- a/refactoring/js/utils/htmlUtils.js +++ /dev/null @@ -1,9 +0,0 @@ -// js/utils/htmlUtils.js -export function escapeHTML(unsafe) { - return unsafe - .replace(/&/g, "&") - .replace(//g, ">") - .replace(/"/g, """) - .replace(/'/g, "'"); -} diff --git a/refactoring/js/utils/timeUtils.js b/refactoring/js/utils/timeUtils.js deleted file mode 100644 index 49b37e3..0000000 --- a/refactoring/js/utils/timeUtils.js +++ /dev/null @@ -1,21 +0,0 @@ -// js/utils/timeUtils.js -export function formatTimeAgo(timestamp) { - const seconds = Math.floor(Date.now() / 1000 - timestamp); - const intervals = { - year: 31536000, - month: 2592000, - week: 604800, - day: 86400, - hour: 3600, - minute: 60, - }; - - for (const [unit, secondsInUnit] of Object.entries(intervals)) { - const interval = Math.floor(seconds / secondsInUnit); - if (interval >= 1) { - return `${interval} ${unit}${interval === 1 ? "" : "s"} ago`; - } - } - - return "just now"; -} diff --git a/refactoring/js/webtorrent.js b/refactoring/js/webtorrent.js deleted file mode 100644 index 5800a21..0000000 --- a/refactoring/js/webtorrent.js +++ /dev/null @@ -1,286 +0,0 @@ -// js/webtorrent.js - -import WebTorrent from 'https://esm.sh/webtorrent' - -export class TorrentClient { - constructor() { - this.client = new WebTorrent() - this.currentTorrent = null - this.TIMEOUT_DURATION = 60000 // 60 seconds - this.statsInterval = null - } - - log(msg) { - console.log(msg) - } - - async isBrave() { - return (navigator.brave?.isBrave && await navigator.brave.isBrave()) || false - } - - async waitForServiceWorkerActivation(registration) { - return new Promise((resolve, reject) => { - const timeout = setTimeout(() => { - reject(new Error('Service worker activation timeout')) - }, this.TIMEOUT_DURATION) - - this.log('Waiting for service worker activation...') - - const checkActivation = () => { - if (registration.active) { - clearTimeout(timeout) - this.log('Service worker is active') - resolve(registration) - return true - } - return false - } - - if (checkActivation()) return - - registration.addEventListener('activate', () => { - checkActivation() - }) - - if (registration.waiting) { - this.log('Service worker is waiting, sending skip waiting message') - registration.waiting.postMessage({ type: 'SKIP_WAITING' }) - } - - registration.addEventListener('statechange', () => { - checkActivation() - }) - }) - } - - async setupServiceWorker() { - try { - const isBraveBrowser = await this.isBrave() - - if (!window.isSecureContext) { - throw new Error('HTTPS or localhost required') - } - - if (!('serviceWorker' in navigator) || !navigator.serviceWorker) { - throw new Error('Service Worker not supported or disabled') - } - - if (isBraveBrowser) { - this.log('Checking Brave configuration...') - - if (!navigator.serviceWorker) { - throw new Error('Please enable Service Workers in Brave Shield settings') - } - - if (!navigator.mediaDevices || !navigator.mediaDevices.getUserMedia) { - throw new Error('Please enable WebRTC in Brave Shield settings') - } - - const registrations = await navigator.serviceWorker.getRegistrations() - for (const registration of registrations) { - await registration.unregister() - } - await new Promise(resolve => setTimeout(resolve, 1000)) - } - - const currentPath = window.location.pathname - const basePath = currentPath.substring(0, currentPath.lastIndexOf('/') + 1) - - this.log('Registering service worker...') - const registration = await navigator.serviceWorker.register('./sw.min.js', { - scope: basePath, - updateViaCache: 'none' - }) - this.log('Service worker registered') - - if (registration.installing) { - this.log('Waiting for installation...') - await new Promise((resolve, reject) => { - const timeout = setTimeout(() => { - reject(new Error('Installation timeout')) - }, this.TIMEOUT_DURATION) - - registration.installing.addEventListener('statechange', (e) => { - this.log('Service worker state:', e.target.state) - if (e.target.state === 'activated' || e.target.state === 'redundant') { - clearTimeout(timeout) - resolve() - } - }) - }) - } - - await this.waitForServiceWorkerActivation(registration) - this.log('Service worker activated') - - const readyRegistration = await Promise.race([ - navigator.serviceWorker.ready, - new Promise((_, reject) => - setTimeout(() => reject(new Error('Service worker ready timeout')), this.TIMEOUT_DURATION) - ) - ]) - - if (!readyRegistration.active) { - throw new Error('Service worker not active after ready state') - } - - this.log('Service worker ready') - return registration - } catch (error) { - this.log('Service worker setup error:', error) - throw error - } - } - - formatBytes(bytes) { - if (bytes === 0) return '0 B' - const k = 1024 - const sizes = ['B', 'KB', 'MB', 'GB'] - const i = Math.floor(Math.log(bytes) / Math.log(k)) - return `${(bytes / Math.pow(k, i)).toFixed(1)} ${sizes[i]}` - } - - async streamVideo(magnetURI, videoElement) { - try { - // Setup service worker first - const registration = await this.setupServiceWorker() - - if (!registration || !registration.active) { - throw new Error('Service worker setup failed') - } - - // Create WebTorrent server AFTER service worker is ready - this.client.createServer({ controller: registration }) - this.log('WebTorrent server created') - - return new Promise((resolve, reject) => { - this.log('Starting torrent download') - this.client.add(magnetURI, torrent => { - this.log('Torrent added: ' + torrent.name) - const status = document.getElementById('status') - const progress = document.getElementById('progress') - const peers = document.getElementById('peers') - const speed = document.getElementById('speed') - const downloaded = document.getElementById('downloaded') - - if (status) status.textContent = `Loading ${torrent.name}...` - - const file = torrent.files.find(file => - file.name.endsWith('.mp4') || - file.name.endsWith('.webm') || - file.name.endsWith('.mkv') - ) - - if (!file) { - const error = new Error('No compatible video file found in torrent') - this.log(error.message) - if (status) status.textContent = 'Error: No video file found' - reject(error) - return - } - - videoElement.muted = true - videoElement.crossOrigin = 'anonymous' - - videoElement.addEventListener('error', (e) => { - const error = e.target.error - this.log('Video error:', error) - if (error) { - this.log('Error code:', error.code) - this.log('Error message:', error.message) - } - if (status) status.textContent = 'Error playing video. Try disabling Brave Shields.' - }) - - videoElement.addEventListener('canplay', () => { - const playPromise = videoElement.play() - if (playPromise !== undefined) { - playPromise - .then(() => this.log('Autoplay started')) - .catch(err => { - this.log('Autoplay failed:', err) - if (status) status.textContent = 'Click to play video' - videoElement.addEventListener('click', () => { - videoElement.play() - .then(() => this.log('Play started by user')) - .catch(err => this.log('Play failed:', err)) - }, { once: true }) - }) - } - }) - - videoElement.addEventListener('loadedmetadata', () => { - this.log('Video metadata loaded') - if (videoElement.duration === Infinity || isNaN(videoElement.duration)) { - this.log('Invalid duration, attempting to fix...') - videoElement.currentTime = 1e101 - videoElement.currentTime = 0 - } - }) - - try { - file.streamTo(videoElement) - this.log('Streaming started') - - // Update stats every second - this.statsInterval = setInterval(() => { - if (!document.body.contains(videoElement)) { - clearInterval(this.statsInterval) - return - } - - const percentage = torrent.progress * 100 - if (progress) progress.style.width = `${percentage}%` - if (peers) peers.textContent = `Peers: ${torrent.numPeers}` - if (speed) speed.textContent = `${this.formatBytes(torrent.downloadSpeed)}/s` - if (downloaded) downloaded.textContent = - `${this.formatBytes(torrent.downloaded)} / ${this.formatBytes(torrent.length)}` - - if (status) { - status.textContent = torrent.progress === 1 - ? `${torrent.name}` - : `Loading ${torrent.name}...` - } - }, 1000) - - this.currentTorrent = torrent - resolve() - } catch (error) { - this.log('Streaming error:', error) - if (status) status.textContent = 'Error starting video stream' - reject(error) - } - - torrent.on('error', err => { - this.log('Torrent error:', err) - if (status) status.textContent = 'Error loading video' - clearInterval(this.statsInterval) - reject(err) - }) - }) - }) - } catch (error) { - this.log('Failed to setup video streaming:', error) - throw error - } - } - - async cleanup() { - try { - if (this.statsInterval) { - clearInterval(this.statsInterval) - } - if (this.currentTorrent) { - this.currentTorrent.destroy() - } - if (this.client) { - await this.client.destroy() - this.client = new WebTorrent() // Create a new client for future use - } - } catch (error) { - this.log('Cleanup error:', error) - } - } -} - -export const torrentClient = new TorrentClient() \ No newline at end of file diff --git a/refactoring/roadmap.html b/refactoring/roadmap.html deleted file mode 100644 index 5beeacc..0000000 --- a/refactoring/roadmap.html +++ /dev/null @@ -1,185 +0,0 @@ - - - - - - bitvid | Roadmap - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
-
- - - BitVid Logo - -
-
- - -
- -
-

Loading Content...

-
-
- - - -
- - - - - - - - - diff --git a/refactoring/site.webmanifest b/refactoring/site.webmanifest deleted file mode 100644 index f364480..0000000 --- a/refactoring/site.webmanifest +++ /dev/null @@ -1,41 +0,0 @@ -{ - "name": "bitvid - Decentralized Video Sharing", - "short_name": "bitvid", - "description": "seed. zap. subscribe.", - "icons": [ - { - "src": "/android-chrome-192x192.png", - "sizes": "192x192", - "type": "image/png" - }, - { - "src": "/android-chrome-512x512.png", - "sizes": "512x512", - "type": "image/png" - }, - { - "src": "/apple-touch-icon.png", - "sizes": "180x180", - "type": "image/png" - }, - { - "src": "assets/png/favicon-32x32.png", - "sizes": "32x32", - "type": "image/png" - }, - { - "src": "assets/png/favicon-16x16.png", - "sizes": "16x16", - "type": "image/png" - } - ], - "start_url": "/index.html", - "display": "standalone", - "background_color": "#0f172a", - "theme_color": "#0f172a", - "orientation": "portrait-primary", - "scope": "/", - "categories": ["video", "entertainment", "decentralized", "streaming"], - "related_applications": [], - "lang": "en" -} diff --git a/refactoring/sw.min.js b/refactoring/sw.min.js deleted file mode 100644 index 2a99835..0000000 --- a/refactoring/sw.min.js +++ /dev/null @@ -1,132 +0,0 @@ -(() => { - "use strict"; - - let cancelled = false; - - // Handle skip waiting message - self.addEventListener('message', event => { - if (event.data && event.data.type === 'SKIP_WAITING') { - self.skipWaiting() - } - }) - - // Immediately install and activate - self.addEventListener("install", () => { - self.skipWaiting() - }) - - // Claim clients on activation - self.addEventListener('activate', event => { - event.waitUntil( - Promise.all([ - clients.claim(), - self.skipWaiting(), - caches.keys().then(cacheNames => - Promise.all(cacheNames.map(cacheName => caches.delete(cacheName))) - ) - ]) - ) - }) - - // Handle fetch events - self.addEventListener("fetch", s => { - const t = (s => { - const { url: t } = s.request; - - // Only handle webtorrent requests - if (!t.includes(self.registration.scope + "webtorrent/")) { - return null; - } - - // Handle keepalive requests - if (t.includes(self.registration.scope + "webtorrent/keepalive/")) { - return new Response(); - } - - // Handle cancel requests - if (t.includes(self.registration.scope + "webtorrent/cancel/")) { - return new Response(new ReadableStream({ - cancel() { - cancelled = true; - } - })); - } - - // Handle streaming requests - return async function({ request: s }) { - const { url: t, method: n, headers: o, destination: a } = s; - - // Get all window clients - const l = await clients.matchAll({ - type: "window", - includeUncontrolled: true - }); - - // Create message channel and wait for response - const [r, i] = await new Promise(e => { - for (const s of l) { - const l = new MessageChannel, - { port1: r, port2: i } = l; - r.onmessage = ({ data: s }) => { - e([s, r]) - }; - s.postMessage({ - url: t, - method: n, - headers: Object.fromEntries(o.entries()), - scope: self.registration.scope, - destination: a, - type: "webtorrent" - }, [i]); - } - }); - - let c = null; - - const d = () => { - i.postMessage(false); - clearTimeout(c); - i.onmessage = null; - }; - - // Handle non-streaming response - if (r.body !== "STREAM") { - d(); - return new Response(r.body, r); - } - - // Handle streaming response - return new Response(new ReadableStream({ - pull: s => new Promise(t => { - i.onmessage = ({ data: e }) => { - if (e) { - s.enqueue(e); - } else { - d(); - s.close(); - } - t(); - }; - - if (!cancelled && a !== "document") { - clearTimeout(c); - c = setTimeout(() => { - d(); - t(); - }, 5000); - } - - i.postMessage(true); - }), - cancel() { - d(); - } - }), r); - }(s); - })(s); - - if (t) { - s.respondWith(t); - } - }); -})(); \ No newline at end of file