Skip to content

Commit 029a132

Browse files
author
Chad Curtis
committed
Setting up Tor needs gpg: without it to check the Tor Project's signature on the release, Din won't download Tor on HTTPS alone, and says to install GnuPG
1 parent 9497d48 commit 029a132

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

‎electron/tor.mts‎

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
// Elsewhere, where no Tor is running, Settings → Wi-Fi's Set Up Tor gets one
1818
// of Din's own, as Settings → Assistant's Install OpenCode does: the Tor
1919
// 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
2222
// the user, from login while it's on, on a SOCKS port of its own. Din looks
2323
// for a newer bundle now and then, and moves to it. A torrc there is read
2424
// too, for bridges and the like.
@@ -484,16 +484,18 @@ function execGpg(args: string[], home: string): Promise<string> {
484484
/**
485485
* Check the release's checksums are signed by the Tor Browser Developers,
486486
* 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.
489489
*/
490490
async function verifySums(sums: string, signature: string): Promise<void> {
491491
const home = fs.mkdtempSync(path.join(os.tmpdir(), 'din-tor-gpg-'));
492492
try {
493493
try {
494494
await execGpg(['--version'], home);
495495
} 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+
}
497499
throw error;
498500
}
499501
fs.writeFileSync(path.join(home, 'sums.txt'), sums);

0 commit comments

Comments
 (0)