|
17 | 17 | // Elsewhere, where no Tor is running, Settings → Wi-Fi's Set Up Tor gets one |
18 | 18 | // of Din's own, as Settings → Assistant's Install OpenCode does: the Tor |
19 | 19 | // Project's Expert Bundle for Linux, downloaded into ~/.local/share/din/tor, |
20 | | -// its checksum taken from the release's signed list (checked against the Tor |
21 | | -// Browser Developers' key where gpg is there to check it), and run by Din as |
| 20 | +// its checksum taken from the release's list, signed by the Tor Browser |
| 21 | +// Developers' key (which takes gpg to check: no gpg, no Tor), and run by Din as |
22 | 22 | // the user, from login while it's on, on a SOCKS port of its own. Din looks |
23 | 23 | // for a newer bundle now and then, and moves to it. A torrc there is read |
24 | 24 | // too, for bridges and the like. |
@@ -484,16 +484,18 @@ function execGpg(args: string[], home: string): Promise<string> { |
484 | 484 | /** |
485 | 485 | * Check the release's checksums are signed by the Tor Browser Developers, |
486 | 486 | * with their key from torproject.org's Web Key Directory in a keyring of its |
487 | | - * own. Where there's no gpg, HTTPS from the Tor Project's server is all |
488 | | - * there is, as for OpenCode's installer. |
| 487 | + * own. Without gpg there's no setting Tor up: HTTPS from the Tor Project's |
| 488 | + * server alone isn't enough for the program onion sites trust. |
489 | 489 | */ |
490 | 490 | async function verifySums(sums: string, signature: string): Promise<void> { |
491 | 491 | const home = fs.mkdtempSync(path.join(os.tmpdir(), 'din-tor-gpg-')); |
492 | 492 | try { |
493 | 493 | try { |
494 | 494 | await execGpg(['--version'], home); |
495 | 495 | } catch (error) { |
496 | | - if ((error as { code?: unknown }).code === 'ENOENT') return; |
| 496 | + if ((error as { code?: unknown }).code === 'ENOENT') { |
| 497 | + throw new Error('Setting up Tor needs gpg, to check the Tor Project’s signature. Install GnuPG and try again.', { cause: error }); |
| 498 | + } |
497 | 499 | throw error; |
498 | 500 | } |
499 | 501 | fs.writeFileSync(path.join(home, 'sums.txt'), sums); |
|
0 commit comments