CLI tool for migrating PDS

Resolve identity to avoid asking for current PDS URL and fix auth for data migration

+590 -53
+473 -8
Cargo.lock
··· 72 72 ] 73 73 74 74 [[package]] 75 + name = "async-recursion" 76 + version = "1.1.1" 77 + source = "registry+https://github.com/rust-lang/crates.io-index" 78 + checksum = "3b43422f69d8ff38f95f1b2bb76517c91589a924d1559a0e935d7c8ce0274c11" 79 + dependencies = [ 80 + "proc-macro2", 81 + "quote", 82 + "syn", 83 + ] 84 + 85 + [[package]] 86 + name = "async-trait" 87 + version = "0.1.83" 88 + source = "registry+https://github.com/rust-lang/crates.io-index" 89 + checksum = "721cae7de5c34fbb2acd27e21e6d2cf7b886dce0c27388d46c4e6c47ea4318dd" 90 + dependencies = [ 91 + "proc-macro2", 92 + "quote", 93 + "syn", 94 + ] 95 + 96 + [[package]] 75 97 name = "atrium-api" 76 98 version = "0.25.0" 77 99 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 87 109 "serde", 88 110 "serde_bytes", 89 111 "serde_json", 90 - "thiserror", 112 + "thiserror 1.0.69", 91 113 "tokio", 92 114 "trait-variant", 93 115 ] ··· 101 123 "dashmap", 102 124 "lru", 103 125 "moka", 104 - "thiserror", 126 + "thiserror 1.0.69", 105 127 "tokio", 106 128 "trait-variant", 107 129 "web-time", 108 130 ] 109 131 110 132 [[package]] 133 + name = "atrium-identity" 134 + version = "0.1.1" 135 + source = "registry+https://github.com/rust-lang/crates.io-index" 136 + checksum = "116fec95d2b8088f3e2c064f38bc5ceb6977ea1ce9e2ffd510d19304ded14b1c" 137 + dependencies = [ 138 + "atrium-api", 139 + "atrium-common", 140 + "atrium-xrpc", 141 + "hickory-proto 0.24.4", 142 + "serde", 143 + "serde_html_form", 144 + "serde_json", 145 + "thiserror 1.0.69", 146 + "trait-variant", 147 + ] 148 + 149 + [[package]] 111 150 name = "atrium-xrpc" 112 151 version = "0.12.1" 113 152 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 117 156 "serde", 118 157 "serde_html_form", 119 158 "serde_json", 120 - "thiserror", 159 + "thiserror 1.0.69", 121 160 "trait-variant", 122 161 ] 123 162 ··· 177 216 checksum = "1628fb46dfa0b37568d12e5edd512553eccf6a22a78e8bde00bb4aed84d5bdbf" 178 217 179 218 [[package]] 219 + name = "byteorder" 220 + version = "1.5.0" 221 + source = "registry+https://github.com/rust-lang/crates.io-index" 222 + checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" 223 + 224 + [[package]] 180 225 name = "bytes" 181 226 version = "1.10.1" 182 227 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 270 315 ] 271 316 272 317 [[package]] 318 + name = "critical-section" 319 + version = "1.2.0" 320 + source = "registry+https://github.com/rust-lang/crates.io-index" 321 + checksum = "790eea4361631c5e7d22598ecd5723ff611904e3344ce8720784c93e3d83d40b" 322 + 323 + [[package]] 273 324 name = "crossbeam-channel" 274 325 version = "0.5.14" 275 326 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 345 396 ] 346 397 347 398 [[package]] 399 + name = "enum-as-inner" 400 + version = "0.6.1" 401 + source = "registry+https://github.com/rust-lang/crates.io-index" 402 + checksum = "a1e6a265c649f3f5979b601d26f1d05ada116434c87741c9493cb56218f76cbc" 403 + dependencies = [ 404 + "heck", 405 + "proc-macro2", 406 + "quote", 407 + "syn", 408 + ] 409 + 410 + [[package]] 348 411 name = "equivalent" 349 412 version = "1.0.2" 350 413 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 449 512 checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" 450 513 451 514 [[package]] 515 + name = "futures-io" 516 + version = "0.3.31" 517 + source = "registry+https://github.com/rust-lang/crates.io-index" 518 + checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" 519 + 520 + [[package]] 452 521 name = "futures-macro" 453 522 version = "0.3.31" 454 523 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 495 564 "libc", 496 565 "log", 497 566 "rustversion", 498 - "windows", 567 + "windows 0.58.0", 568 + ] 569 + 570 + [[package]] 571 + name = "getrandom" 572 + version = "0.2.15" 573 + source = "registry+https://github.com/rust-lang/crates.io-index" 574 + checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" 575 + dependencies = [ 576 + "cfg-if", 577 + "libc", 578 + "wasi 0.11.0+wasi-snapshot-preview1", 499 579 ] 500 580 501 581 [[package]] ··· 534 614 ] 535 615 536 616 [[package]] 617 + name = "heck" 618 + version = "0.5.0" 619 + source = "registry+https://github.com/rust-lang/crates.io-index" 620 + checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" 621 + 622 + [[package]] 623 + name = "hickory-proto" 624 + version = "0.24.4" 625 + source = "registry+https://github.com/rust-lang/crates.io-index" 626 + checksum = "92652067c9ce6f66ce53cc38d1169daa36e6e7eb7dd3b63b5103bd9d97117248" 627 + dependencies = [ 628 + "async-trait", 629 + "cfg-if", 630 + "data-encoding", 631 + "enum-as-inner", 632 + "futures-channel", 633 + "futures-io", 634 + "futures-util", 635 + "idna", 636 + "ipnet", 637 + "once_cell", 638 + "rand 0.8.5", 639 + "thiserror 1.0.69", 640 + "tinyvec", 641 + "tracing", 642 + "url", 643 + ] 644 + 645 + [[package]] 646 + name = "hickory-proto" 647 + version = "0.25.1" 648 + source = "registry+https://github.com/rust-lang/crates.io-index" 649 + checksum = "6d844af74f7b799e41c78221be863bade11c430d46042c3b49ca8ae0c6d27287" 650 + dependencies = [ 651 + "async-recursion", 652 + "async-trait", 653 + "cfg-if", 654 + "critical-section", 655 + "data-encoding", 656 + "enum-as-inner", 657 + "futures-channel", 658 + "futures-io", 659 + "futures-util", 660 + "idna", 661 + "ipnet", 662 + "once_cell", 663 + "rand 0.9.0", 664 + "ring", 665 + "thiserror 2.0.12", 666 + "tinyvec", 667 + "tokio", 668 + "tracing", 669 + "url", 670 + ] 671 + 672 + [[package]] 673 + name = "hickory-resolver" 674 + version = "0.25.1" 675 + source = "registry+https://github.com/rust-lang/crates.io-index" 676 + checksum = "a128410b38d6f931fcc6ca5c107a3b02cabd6c05967841269a4ad65d23c44331" 677 + dependencies = [ 678 + "cfg-if", 679 + "futures-util", 680 + "hickory-proto 0.25.1", 681 + "ipconfig", 682 + "moka", 683 + "once_cell", 684 + "parking_lot", 685 + "rand 0.9.0", 686 + "resolv-conf", 687 + "smallvec", 688 + "thiserror 2.0.12", 689 + "tokio", 690 + "tracing", 691 + ] 692 + 693 + [[package]] 694 + name = "hostname" 695 + version = "0.4.0" 696 + source = "registry+https://github.com/rust-lang/crates.io-index" 697 + checksum = "f9c7c7c8ac16c798734b8a24560c1362120597c40d5e1459f09498f8f6c8f2ba" 698 + dependencies = [ 699 + "cfg-if", 700 + "libc", 701 + "windows 0.52.0", 702 + ] 703 + 704 + [[package]] 537 705 name = "http" 538 706 version = "1.3.1" 539 707 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 800 968 ] 801 969 802 970 [[package]] 971 + name = "ipconfig" 972 + version = "0.3.2" 973 + source = "registry+https://github.com/rust-lang/crates.io-index" 974 + checksum = "b58db92f96b720de98181bbbe63c831e87005ab460c1bf306eb2622b4707997f" 975 + dependencies = [ 976 + "socket2", 977 + "widestring", 978 + "windows-sys 0.48.0", 979 + "winreg", 980 + ] 981 + 982 + [[package]] 803 983 name = "ipld-core" 804 984 version = "0.4.2" 805 985 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 962 1142 "rustc_version", 963 1143 "smallvec", 964 1144 "tagptr", 965 - "thiserror", 1145 + "thiserror 1.0.69", 966 1146 "uuid", 967 1147 ] 968 1148 ··· 1038 1218 version = "1.21.0" 1039 1219 source = "registry+https://github.com/rust-lang/crates.io-index" 1040 1220 checksum = "cde51589ab56b20a6f686b2c68f7a0bd6add753d697abf720d63f8db3ab7b1ad" 1221 + dependencies = [ 1222 + "critical-section", 1223 + "portable-atomic", 1224 + ] 1041 1225 1042 1226 [[package]] 1043 1227 name = "openssl" ··· 1123 1307 version = "0.1.0" 1124 1308 dependencies = [ 1125 1309 "atrium-api", 1310 + "atrium-common", 1311 + "atrium-identity", 1126 1312 "atrium-xrpc-client", 1313 + "hickory-resolver", 1127 1314 "tokio", 1128 1315 ] 1129 1316 ··· 1158 1345 checksum = "350e9b48cbc6b0e028b0473b114454c6316e57336ee184ceab6e53f72c178b3e" 1159 1346 1160 1347 [[package]] 1348 + name = "ppv-lite86" 1349 + version = "0.2.20" 1350 + source = "registry+https://github.com/rust-lang/crates.io-index" 1351 + checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04" 1352 + dependencies = [ 1353 + "zerocopy 0.7.35", 1354 + ] 1355 + 1356 + [[package]] 1161 1357 name = "proc-macro2" 1162 1358 version = "1.0.94" 1163 1359 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 1176 1372 ] 1177 1373 1178 1374 [[package]] 1375 + name = "rand" 1376 + version = "0.8.5" 1377 + source = "registry+https://github.com/rust-lang/crates.io-index" 1378 + checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" 1379 + dependencies = [ 1380 + "libc", 1381 + "rand_chacha 0.3.1", 1382 + "rand_core 0.6.4", 1383 + ] 1384 + 1385 + [[package]] 1386 + name = "rand" 1387 + version = "0.9.0" 1388 + source = "registry+https://github.com/rust-lang/crates.io-index" 1389 + checksum = "3779b94aeb87e8bd4e834cee3650289ee9e0d5677f976ecdb6d219e5f4f6cd94" 1390 + dependencies = [ 1391 + "rand_chacha 0.9.0", 1392 + "rand_core 0.9.3", 1393 + "zerocopy 0.8.23", 1394 + ] 1395 + 1396 + [[package]] 1397 + name = "rand_chacha" 1398 + version = "0.3.1" 1399 + source = "registry+https://github.com/rust-lang/crates.io-index" 1400 + checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" 1401 + dependencies = [ 1402 + "ppv-lite86", 1403 + "rand_core 0.6.4", 1404 + ] 1405 + 1406 + [[package]] 1407 + name = "rand_chacha" 1408 + version = "0.9.0" 1409 + source = "registry+https://github.com/rust-lang/crates.io-index" 1410 + checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" 1411 + dependencies = [ 1412 + "ppv-lite86", 1413 + "rand_core 0.9.3", 1414 + ] 1415 + 1416 + [[package]] 1417 + name = "rand_core" 1418 + version = "0.6.4" 1419 + source = "registry+https://github.com/rust-lang/crates.io-index" 1420 + checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" 1421 + dependencies = [ 1422 + "getrandom 0.2.15", 1423 + ] 1424 + 1425 + [[package]] 1426 + name = "rand_core" 1427 + version = "0.9.3" 1428 + source = "registry+https://github.com/rust-lang/crates.io-index" 1429 + checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" 1430 + dependencies = [ 1431 + "getrandom 0.3.1", 1432 + ] 1433 + 1434 + [[package]] 1179 1435 name = "redox_syscall" 1180 1436 version = "0.5.10" 1181 1437 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 1268 1524 "wasm-bindgen-futures", 1269 1525 "web-sys", 1270 1526 "windows-registry", 1527 + ] 1528 + 1529 + [[package]] 1530 + name = "resolv-conf" 1531 + version = "0.7.1" 1532 + source = "registry+https://github.com/rust-lang/crates.io-index" 1533 + checksum = "48375394603e3dd4b2d64371f7148fd8c7baa2680e28741f2cb8d23b59e3d4c4" 1534 + dependencies = [ 1535 + "hostname", 1536 + ] 1537 + 1538 + [[package]] 1539 + name = "ring" 1540 + version = "0.17.14" 1541 + source = "registry+https://github.com/rust-lang/crates.io-index" 1542 + checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7" 1543 + dependencies = [ 1544 + "cc", 1545 + "cfg-if", 1546 + "getrandom 0.2.15", 1547 + "libc", 1548 + "untrusted", 1549 + "windows-sys 0.52.0", 1271 1550 ] 1272 1551 1273 1552 [[package]] ··· 1532 1811 dependencies = [ 1533 1812 "cfg-if", 1534 1813 "fastrand", 1535 - "getrandom", 1814 + "getrandom 0.3.1", 1536 1815 "once_cell", 1537 1816 "rustix", 1538 1817 "windows-sys 0.59.0", ··· 1544 1823 source = "registry+https://github.com/rust-lang/crates.io-index" 1545 1824 checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" 1546 1825 dependencies = [ 1547 - "thiserror-impl", 1826 + "thiserror-impl 1.0.69", 1827 + ] 1828 + 1829 + [[package]] 1830 + name = "thiserror" 1831 + version = "2.0.12" 1832 + source = "registry+https://github.com/rust-lang/crates.io-index" 1833 + checksum = "567b8a2dae586314f7be2a752ec7474332959c6460e02bde30d702a66d488708" 1834 + dependencies = [ 1835 + "thiserror-impl 2.0.12", 1548 1836 ] 1549 1837 1550 1838 [[package]] ··· 1552 1840 version = "1.0.69" 1553 1841 source = "registry+https://github.com/rust-lang/crates.io-index" 1554 1842 checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" 1843 + dependencies = [ 1844 + "proc-macro2", 1845 + "quote", 1846 + "syn", 1847 + ] 1848 + 1849 + [[package]] 1850 + name = "thiserror-impl" 1851 + version = "2.0.12" 1852 + source = "registry+https://github.com/rust-lang/crates.io-index" 1853 + checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d" 1555 1854 dependencies = [ 1556 1855 "proc-macro2", 1557 1856 "quote", ··· 1577 1876 "displaydoc", 1578 1877 "zerovec", 1579 1878 ] 1879 + 1880 + [[package]] 1881 + name = "tinyvec" 1882 + version = "1.6.0" 1883 + source = "registry+https://github.com/rust-lang/crates.io-index" 1884 + checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" 1885 + dependencies = [ 1886 + "tinyvec_macros", 1887 + ] 1888 + 1889 + [[package]] 1890 + name = "tinyvec_macros" 1891 + version = "0.1.1" 1892 + source = "registry+https://github.com/rust-lang/crates.io-index" 1893 + checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" 1580 1894 1581 1895 [[package]] 1582 1896 name = "tokio" ··· 1662 1976 checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0" 1663 1977 dependencies = [ 1664 1978 "pin-project-lite", 1979 + "tracing-attributes", 1665 1980 "tracing-core", 1666 1981 ] 1667 1982 1668 1983 [[package]] 1984 + name = "tracing-attributes" 1985 + version = "0.1.28" 1986 + source = "registry+https://github.com/rust-lang/crates.io-index" 1987 + checksum = "395ae124c09f9e6918a2310af6038fba074bcf474ac352496d5910dd59a2226d" 1988 + dependencies = [ 1989 + "proc-macro2", 1990 + "quote", 1991 + "syn", 1992 + ] 1993 + 1994 + [[package]] 1669 1995 name = "tracing-core" 1670 1996 version = "0.1.33" 1671 1997 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 1732 2058 version = "0.8.0" 1733 2059 source = "registry+https://github.com/rust-lang/crates.io-index" 1734 2060 checksum = "eb066959b24b5196ae73cb057f45598450d2c5f71460e98c49b738086eff9c06" 2061 + 2062 + [[package]] 2063 + name = "untrusted" 2064 + version = "0.9.0" 2065 + source = "registry+https://github.com/rust-lang/crates.io-index" 2066 + checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" 1735 2067 1736 2068 [[package]] 1737 2069 name = "url" ··· 1762 2094 source = "registry+https://github.com/rust-lang/crates.io-index" 1763 2095 checksum = "e0f540e3240398cce6128b64ba83fdbdd86129c16a3aa1a3a252efd66eb3d587" 1764 2096 dependencies = [ 1765 - "getrandom", 2097 + "getrandom 0.3.1", 1766 2098 ] 1767 2099 1768 2100 [[package]] ··· 1893 2225 ] 1894 2226 1895 2227 [[package]] 2228 + name = "widestring" 2229 + version = "1.2.0" 2230 + source = "registry+https://github.com/rust-lang/crates.io-index" 2231 + checksum = "dd7cf3379ca1aac9eea11fba24fd7e315d621f8dfe35c8d7d2be8b793726e07d" 2232 + 2233 + [[package]] 1896 2234 name = "winapi" 1897 2235 version = "0.3.9" 1898 2236 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 1916 2254 1917 2255 [[package]] 1918 2256 name = "windows" 2257 + version = "0.52.0" 2258 + source = "registry+https://github.com/rust-lang/crates.io-index" 2259 + checksum = "e48a53791691ab099e5e2ad123536d0fff50652600abaf43bbf952894110d0be" 2260 + dependencies = [ 2261 + "windows-core 0.52.0", 2262 + "windows-targets 0.52.6", 2263 + ] 2264 + 2265 + [[package]] 2266 + name = "windows" 1919 2267 version = "0.58.0" 1920 2268 source = "registry+https://github.com/rust-lang/crates.io-index" 1921 2269 checksum = "dd04d41d93c4992d421894c18c8b43496aa748dd4c081bac0dc93eb0489272b6" ··· 2024 2372 2025 2373 [[package]] 2026 2374 name = "windows-sys" 2375 + version = "0.48.0" 2376 + source = "registry+https://github.com/rust-lang/crates.io-index" 2377 + checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" 2378 + dependencies = [ 2379 + "windows-targets 0.48.5", 2380 + ] 2381 + 2382 + [[package]] 2383 + name = "windows-sys" 2027 2384 version = "0.52.0" 2028 2385 source = "registry+https://github.com/rust-lang/crates.io-index" 2029 2386 checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" ··· 2042 2399 2043 2400 [[package]] 2044 2401 name = "windows-targets" 2402 + version = "0.48.5" 2403 + source = "registry+https://github.com/rust-lang/crates.io-index" 2404 + checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" 2405 + dependencies = [ 2406 + "windows_aarch64_gnullvm 0.48.5", 2407 + "windows_aarch64_msvc 0.48.5", 2408 + "windows_i686_gnu 0.48.5", 2409 + "windows_i686_msvc 0.48.5", 2410 + "windows_x86_64_gnu 0.48.5", 2411 + "windows_x86_64_gnullvm 0.48.5", 2412 + "windows_x86_64_msvc 0.48.5", 2413 + ] 2414 + 2415 + [[package]] 2416 + name = "windows-targets" 2045 2417 version = "0.52.6" 2046 2418 source = "registry+https://github.com/rust-lang/crates.io-index" 2047 2419 checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" ··· 2074 2446 2075 2447 [[package]] 2076 2448 name = "windows_aarch64_gnullvm" 2449 + version = "0.48.5" 2450 + source = "registry+https://github.com/rust-lang/crates.io-index" 2451 + checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" 2452 + 2453 + [[package]] 2454 + name = "windows_aarch64_gnullvm" 2077 2455 version = "0.52.6" 2078 2456 source = "registry+https://github.com/rust-lang/crates.io-index" 2079 2457 checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" ··· 2086 2464 2087 2465 [[package]] 2088 2466 name = "windows_aarch64_msvc" 2467 + version = "0.48.5" 2468 + source = "registry+https://github.com/rust-lang/crates.io-index" 2469 + checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" 2470 + 2471 + [[package]] 2472 + name = "windows_aarch64_msvc" 2089 2473 version = "0.52.6" 2090 2474 source = "registry+https://github.com/rust-lang/crates.io-index" 2091 2475 checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" ··· 2095 2479 version = "0.53.0" 2096 2480 source = "registry+https://github.com/rust-lang/crates.io-index" 2097 2481 checksum = "c7651a1f62a11b8cbd5e0d42526e55f2c99886c77e007179efff86c2b137e66c" 2482 + 2483 + [[package]] 2484 + name = "windows_i686_gnu" 2485 + version = "0.48.5" 2486 + source = "registry+https://github.com/rust-lang/crates.io-index" 2487 + checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" 2098 2488 2099 2489 [[package]] 2100 2490 name = "windows_i686_gnu" ··· 2122 2512 2123 2513 [[package]] 2124 2514 name = "windows_i686_msvc" 2515 + version = "0.48.5" 2516 + source = "registry+https://github.com/rust-lang/crates.io-index" 2517 + checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" 2518 + 2519 + [[package]] 2520 + name = "windows_i686_msvc" 2125 2521 version = "0.52.6" 2126 2522 source = "registry+https://github.com/rust-lang/crates.io-index" 2127 2523 checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" ··· 2134 2530 2135 2531 [[package]] 2136 2532 name = "windows_x86_64_gnu" 2533 + version = "0.48.5" 2534 + source = "registry+https://github.com/rust-lang/crates.io-index" 2535 + checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" 2536 + 2537 + [[package]] 2538 + name = "windows_x86_64_gnu" 2137 2539 version = "0.52.6" 2138 2540 source = "registry+https://github.com/rust-lang/crates.io-index" 2139 2541 checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" ··· 2146 2548 2147 2549 [[package]] 2148 2550 name = "windows_x86_64_gnullvm" 2551 + version = "0.48.5" 2552 + source = "registry+https://github.com/rust-lang/crates.io-index" 2553 + checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" 2554 + 2555 + [[package]] 2556 + name = "windows_x86_64_gnullvm" 2149 2557 version = "0.52.6" 2150 2558 source = "registry+https://github.com/rust-lang/crates.io-index" 2151 2559 checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" ··· 2158 2566 2159 2567 [[package]] 2160 2568 name = "windows_x86_64_msvc" 2569 + version = "0.48.5" 2570 + source = "registry+https://github.com/rust-lang/crates.io-index" 2571 + checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" 2572 + 2573 + [[package]] 2574 + name = "windows_x86_64_msvc" 2161 2575 version = "0.52.6" 2162 2576 source = "registry+https://github.com/rust-lang/crates.io-index" 2163 2577 checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" ··· 2169 2583 checksum = "271414315aff87387382ec3d271b52d7ae78726f5d44ac98b4f4030c91880486" 2170 2584 2171 2585 [[package]] 2586 + name = "winreg" 2587 + version = "0.50.0" 2588 + source = "registry+https://github.com/rust-lang/crates.io-index" 2589 + checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1" 2590 + dependencies = [ 2591 + "cfg-if", 2592 + "windows-sys 0.48.0", 2593 + ] 2594 + 2595 + [[package]] 2172 2596 name = "wit-bindgen-rt" 2173 2597 version = "0.33.0" 2174 2598 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 2211 2635 "quote", 2212 2636 "syn", 2213 2637 "synstructure", 2638 + ] 2639 + 2640 + [[package]] 2641 + name = "zerocopy" 2642 + version = "0.7.35" 2643 + source = "registry+https://github.com/rust-lang/crates.io-index" 2644 + checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" 2645 + dependencies = [ 2646 + "byteorder", 2647 + "zerocopy-derive 0.7.35", 2648 + ] 2649 + 2650 + [[package]] 2651 + name = "zerocopy" 2652 + version = "0.8.23" 2653 + source = "registry+https://github.com/rust-lang/crates.io-index" 2654 + checksum = "fd97444d05a4328b90e75e503a34bad781f14e28a823ad3557f0750df1ebcbc6" 2655 + dependencies = [ 2656 + "zerocopy-derive 0.8.23", 2657 + ] 2658 + 2659 + [[package]] 2660 + name = "zerocopy-derive" 2661 + version = "0.7.35" 2662 + source = "registry+https://github.com/rust-lang/crates.io-index" 2663 + checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" 2664 + dependencies = [ 2665 + "proc-macro2", 2666 + "quote", 2667 + "syn", 2668 + ] 2669 + 2670 + [[package]] 2671 + name = "zerocopy-derive" 2672 + version = "0.8.23" 2673 + source = "registry+https://github.com/rust-lang/crates.io-index" 2674 + checksum = "6352c01d0edd5db859a63e2605f4ea3183ddbd15e2c4a9e7d32184df75e4f154" 2675 + dependencies = [ 2676 + "proc-macro2", 2677 + "quote", 2678 + "syn", 2214 2679 ] 2215 2680 2216 2681 [[package]]
+3
Cargo.toml
··· 5 5 6 6 [dependencies] 7 7 atrium-api = { version = "0.25.0", default-features = false, features = ["agent", "bluesky"] } 8 + atrium-common = "0.1.0" 9 + atrium-identity = { version = "0.1.1", features = ["doh-handle-resolver"] } 8 10 atrium-xrpc-client = "0.5.11" 11 + hickory-resolver = "0.25.1" 9 12 tokio = { version = "1.44.0", features = ["macros", "rt-multi-thread"]}
+21 -9
src/jwt.rs
··· 1 - use atrium_api::xrpc::{ 2 - http::{Request, Response}, 3 - types::AuthorizationToken, 4 - HttpClient, XrpcClient, 1 + use atrium_api::{ 2 + agent::SessionManager, 3 + types::string::Did, 4 + xrpc::{ 5 + http::{Request, Response}, 6 + types::AuthorizationToken, 7 + HttpClient, XrpcClient, 8 + }, 5 9 }; 6 10 use atrium_xrpc_client::reqwest::ReqwestClient; 7 11 8 - pub struct JwtAuthedClient { 12 + pub struct JwtSessionManager { 13 + did: Did, 9 14 token: String, 10 15 inner: ReqwestClient, 11 16 } 12 17 13 - impl JwtAuthedClient { 14 - pub fn new(base_uri: impl AsRef<str>, token: String) -> Self { 18 + impl JwtSessionManager { 19 + pub fn new(did: Did, token: String, base_uri: impl AsRef<str>) -> Self { 15 20 Self { 21 + did, 16 22 token, 17 23 inner: ReqwestClient::new(base_uri), 18 24 } 19 25 } 20 26 } 21 27 22 - impl HttpClient for JwtAuthedClient { 28 + impl HttpClient for JwtSessionManager { 23 29 async fn send_http( 24 30 &self, 25 31 request: Request<Vec<u8>>, ··· 28 34 } 29 35 } 30 36 31 - impl XrpcClient for JwtAuthedClient { 37 + impl XrpcClient for JwtSessionManager { 32 38 fn base_uri(&self) -> String { 33 39 self.inner.base_uri() 34 40 } ··· 37 43 Some(AuthorizationToken::Bearer(self.token.clone())) 38 44 } 39 45 } 46 + 47 + impl SessionManager for JwtSessionManager { 48 + async fn did(&self) -> Option<Did> { 49 + Some(self.did.clone()) 50 + } 51 + }
+93 -36
src/main.rs
··· 1 1 use atrium_api::{ 2 - agent::atp_agent::{store::MemorySessionStore, AtpAgent}, 2 + agent::{ 3 + atp_agent::{store::MemorySessionStore, AtpAgent}, 4 + Agent, 5 + }, 3 6 app::bsky::actor::{get_preferences, put_preferences}, 4 7 com::atproto::{ 5 - repo::list_missing_blobs, 6 8 server::{create_account, get_service_auth}, 7 9 sync::{get_blob, get_repo, list_blobs}, 8 10 }, 9 - types::string::{Handle, Nsid}, 11 + types::string::{Did, Handle, Nsid}, 12 + }; 13 + use atrium_common::resolver::Resolver; 14 + use atrium_identity::{ 15 + did::{CommonDidResolver, CommonDidResolverConfig}, 16 + handle::{AtprotoHandleResolver, AtprotoHandleResolverConfig, DnsTxtResolver}, 17 + identity_resolver::{IdentityResolver, IdentityResolverConfig}, 10 18 }; 11 19 use atrium_xrpc_client::reqwest::ReqwestClient; 20 + use hickory_resolver::TokioResolver; 12 21 use std::{ 13 - io::{self, Write}, sync::Arc 22 + io::{self, Write}, 23 + sync::Arc, 14 24 }; 15 25 16 26 mod jwt; 17 27 28 + struct HickoryDnsTxtResolver { 29 + resolver: TokioResolver, 30 + } 31 + 32 + impl Default for HickoryDnsTxtResolver { 33 + fn default() -> Self { 34 + Self { 35 + resolver: TokioResolver::builder_tokio().unwrap().build(), 36 + } 37 + } 38 + } 39 + 40 + impl DnsTxtResolver for HickoryDnsTxtResolver { 41 + async fn resolve( 42 + &self, 43 + query: &str, 44 + ) -> core::result::Result<Vec<String>, Box<dyn std::error::Error + Send + Sync + 'static>> { 45 + Ok(self 46 + .resolver 47 + .txt_lookup(query) 48 + .await? 49 + .iter() 50 + .map(|txt| txt.to_string()) 51 + .collect()) 52 + } 53 + } 54 + 18 55 fn readln(message: Option<impl Into<String>>) -> std::io::Result<Arc<str>> { 19 56 if let Some(message) = message { 20 57 print!("{}", message.into()); ··· 28 65 #[tokio::main] 29 66 async fn main() { 30 67 println!("Please log in to your current PDS. Authenticated access is needed throughout the migration process"); 31 - let old_pds_url = match readln(Some("The URL of your current PDS: ")) { 68 + let identifier = match readln(Some("Identifier (handle or did): ")) { 32 69 Ok(string) => string, 33 70 Err(err) => { 34 - println!("Could not read the URL of your current PDS due to error: {err}"); 71 + println!("Could not read username due to error: {err}"); 35 72 return; 36 73 } 37 74 }; 38 - let identity = match readln(Some("Identifier (handle, did or email): ")) { 75 + let password = match readln(Some("Password: ")) { 39 76 Ok(string) => string.trim().to_string(), 40 77 Err(err) => { 41 - println!("Could not read username due to error: {err}"); 78 + println!("Could not read password due to error: {err}"); 42 79 return; 43 80 } 44 81 }; 45 - let password = match readln(Some("Password: ")) { 46 - Ok(string) => string.trim().to_string(), 82 + 83 + let identity_resolver = IdentityResolver::new(IdentityResolverConfig { 84 + did_resolver: CommonDidResolver::new(CommonDidResolverConfig { 85 + plc_directory_url: String::from("https://plc.directory"), 86 + http_client: ReqwestClient::new("").into(), 87 + }), 88 + handle_resolver: AtprotoHandleResolver::new(AtprotoHandleResolverConfig { 89 + dns_txt_resolver: HickoryDnsTxtResolver::default(), 90 + http_client: ReqwestClient::new("").into(), 91 + }), 92 + }); 93 + let identity = match identity_resolver.resolve(identifier.as_ref()).await { 94 + Ok(identity) => identity, 47 95 Err(err) => { 48 - println!("Could not read password due to error: {err}"); 96 + println!("Could not resolve identity from identifier {identifier} due to error: {err}"); 49 97 return; 50 98 } 51 99 }; 52 - println!("Authenticating with your PDS"); 53 - let old_agent = AtpAgent::new( 54 - ReqwestClient::new(&old_pds_url), 100 + 101 + let current_agent = AtpAgent::new( 102 + ReqwestClient::new(&identity.pds), 55 103 MemorySessionStore::default(), 56 104 ); 57 - if let Err(err) = old_agent.login(identity, password).await { 58 - println!("Failed to log in to your account on your current PDS due to error: {err}"); 105 + if let Err(err) = current_agent.login(identifier, password).await { 106 + println!( 107 + "Failed to log in to your account on your current PDS at {} due to error: {err}", 108 + &identity.pds 109 + ); 59 110 return; 60 111 }; 61 - println!("Log in successful!"); 112 + println!("Log in at {} was successful!", &identity.pds); 62 113 println!(); 63 114 64 115 // Create new account ··· 134 185 } 135 186 }; 136 187 let new_pds_did = &describe_res.did; 137 - let service_jwt_res = match old_agent 188 + let service_jwt_res = match current_agent 138 189 .api 139 190 .com 140 191 .atproto ··· 156 207 } 157 208 }; 158 209 159 - let new_agent = AtpAgent::new( 160 - jwt::JwtAuthedClient::new(&new_pds_url, service_jwt_res.token.clone()), 161 - MemorySessionStore::default(), 162 - ); 163 - match new_agent 210 + let new_jwt_agent = Agent::new(jwt::JwtSessionManager::new( 211 + Did::new(identity.did.clone()).unwrap(), 212 + service_jwt_res.token.clone(), 213 + &new_pds_url, 214 + )); 215 + match new_jwt_agent 164 216 .api 165 217 .com 166 218 .atproto 167 219 .server 168 220 .create_account( 169 221 create_account::InputData { 170 - did: old_agent.did().await, 222 + did: current_agent.did().await, 171 223 email: Some(email.to_string()), 172 - handle, 224 + handle: handle.clone(), 173 225 invite_code, 174 226 password: Some(password.to_string()), 175 227 plc_op: None, ··· 187 239 return; 188 240 } 189 241 } 242 + if let Err(err) = new_agent.login(handle.clone(), password).await { 243 + println!("Failed to log in to your account on your new PDS due to error: {err}"); 244 + return; 245 + }; 190 246 println!("Successfully created account on your new PDS!"); 191 247 println!(); 192 248 193 249 // Migrate data 194 250 println!("Migrating your data"); 195 251 196 - let car = match old_agent 252 + let car = match current_agent 197 253 .api 198 254 .com 199 255 .atproto 200 256 .sync 201 257 .get_repo( 202 258 get_repo::ParametersData { 203 - did: old_agent.did().await.unwrap(), 259 + did: current_agent.did().await.unwrap(), 204 260 since: None, 205 261 } 206 262 .into(), ··· 213 269 return; 214 270 } 215 271 }; 272 + println!("CAR file downloaded"); 216 273 217 274 match new_agent.api.com.atproto.repo.import_repo(car).await { 218 275 Ok(_) => (), ··· 223 280 } 224 281 println!("Repository successfully migrated"); 225 282 226 - let mut listed_blobs = match old_agent 283 + let mut listed_blobs = match current_agent 227 284 .api 228 285 .com 229 286 .atproto ··· 231 288 .list_blobs( 232 289 list_blobs::ParametersData { 233 290 cursor: None, 234 - did: old_agent.did().await.unwrap(), 291 + did: current_agent.did().await.unwrap(), 235 292 limit: None, 236 293 since: None, 237 294 } ··· 247 304 }; 248 305 249 306 for cid in listed_blobs.cids.iter() { 250 - let blob = match old_agent 307 + let blob = match current_agent 251 308 .api 252 309 .com 253 310 .atproto ··· 255 312 .get_blob( 256 313 get_blob::ParametersData { 257 314 cid: cid.to_owned(), 258 - did: old_agent.did().await.unwrap(), 315 + did: current_agent.did().await.unwrap(), 259 316 } 260 317 .into(), 261 318 ) ··· 279 336 280 337 let mut cursor = listed_blobs.cursor.clone(); 281 338 while cursor.is_some() { 282 - listed_blobs = match old_agent 339 + listed_blobs = match current_agent 283 340 .api 284 341 .com 285 342 .atproto ··· 287 344 .list_blobs( 288 345 list_blobs::ParametersData { 289 346 cursor: cursor.clone(), 290 - did: old_agent.did().await.unwrap(), 347 + did: current_agent.did().await.unwrap(), 291 348 limit: None, 292 349 since: None, 293 350 } ··· 303 360 }; 304 361 305 362 for cid in listed_blobs.cids.iter() { 306 - let blob = match old_agent 363 + let blob = match current_agent 307 364 .api 308 365 .com 309 366 .atproto ··· 311 368 .get_blob( 312 369 get_blob::ParametersData { 313 370 cid: cid.to_owned(), 314 - did: old_agent.did().await.unwrap(), 371 + did: current_agent.did().await.unwrap(), 315 372 } 316 373 .into(), 317 374 ) ··· 336 393 } 337 394 println!("Blobs successfully migrated!"); 338 395 339 - let prefs = match old_agent 396 + let prefs = match current_agent 340 397 .api 341 398 .app 342 399 .bsky