shinjuku-shield 0.3.238 → 0.3.239
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/manifest.json +118 -6
- package/package.json +5 -4
- package/shinjuku-seller.mjs +258 -44
- package/shinjuku-wallet.mjs +544 -119
- package/tor/darwin-arm64/tor/libevent-2.1.7.dylib +0 -0
- package/tor/darwin-arm64/tor/tor +0 -0
- package/tor/darwin-x64/tor/libevent-2.1.7.dylib +0 -0
- package/tor/darwin-x64/tor/tor +0 -0
- package/tor/docs/libevent.txt +99 -0
- package/tor/docs/openssl.txt +177 -0
- package/tor/docs/tor.txt +416 -0
- package/tor/docs/zlib.txt +22 -0
- package/tor/linux-x64/tor/libcrypto.so.3 +0 -0
- package/tor/linux-x64/tor/libevent-2.1.so.7 +0 -0
- package/tor/linux-x64/tor/libssl.so.3 +0 -0
- package/tor/linux-x64/tor/tor +0 -0
- package/tor/win32-x64/tor/tor.exe +0 -0
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@ web services and AI answers from your private balance, so the payment does
|
|
|
8
8
|
not show who paid. It works inside your AI app (Claude, Cursor, Codex) and in
|
|
9
9
|
a terminal. Only you hold the keys: they never leave your computer.
|
|
10
10
|
|
|
11
|
-
This is version 0.3.
|
|
11
|
+
This is version 0.3.239. The command is `shinjuku`.
|
|
12
12
|
|
|
13
13
|
## Set up
|
|
14
14
|
|
|
@@ -112,7 +112,7 @@ Add it yourself. The name of the wallet in your app is `shinjuku`.
|
|
|
112
112
|
Claude Code:
|
|
113
113
|
|
|
114
114
|
```sh
|
|
115
|
-
claude mcp add --scope user shinjuku -- npx -y --prefer-offline --no-audit --no-fund shinjuku-shield@0.3.
|
|
115
|
+
claude mcp add --scope user shinjuku -- npx -y --prefer-offline --no-audit --no-fund shinjuku-shield@0.3.239 mcp
|
|
116
116
|
```
|
|
117
117
|
|
|
118
118
|
`--prefer-offline` runs the copy of the wallet that npm saved. If npm has not saved it yet, that start asks
|
|
@@ -131,7 +131,7 @@ with the Releases table in
|
|
|
131
131
|
Versions are published from GitHub Actions with npm provenance.
|
|
132
132
|
|
|
133
133
|
`shinjuku-shield` is the package that holds the wallet. `shinjuku-shielded`
|
|
134
|
-
0.3.
|
|
134
|
+
0.3.239, its older name, runs this package at the same version, so wallets
|
|
135
135
|
installed under that name keep updating. New installs use `shinjuku`.
|
|
136
136
|
|
|
137
137
|
The full guide is
|
package/manifest.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schema": "carbon-shielded-wallet/bundle-manifest/v1",
|
|
3
3
|
"file": "shinjuku-wallet.mjs",
|
|
4
|
-
"sha256": "
|
|
5
|
-
"bytes":
|
|
6
|
-
"sourceCommit": "
|
|
4
|
+
"sha256": "dd60a30f807d02b8173861757e05e0854dd9715f4d3b70c023b9195b82ea236b",
|
|
5
|
+
"bytes": 10564737,
|
|
6
|
+
"sourceCommit": "bd027ad77574cb5ddf9adc20998b48facf32c3d3",
|
|
7
7
|
"sourceDirty": false,
|
|
8
8
|
"installRecordMatchesLockfile": true,
|
|
9
9
|
"releaseRule": "valid only when two fresh npm ci --ignore-scripts builds on different OSes give the same sha256; installRecordMatchesLockfile true means every entry npm installed equals its package-lock.json entry and every entry not marked optional, devOptional included, is installed: an optional entry (a package for another platform) may be absent",
|
|
@@ -1075,8 +1075,8 @@
|
|
|
1075
1075
|
],
|
|
1076
1076
|
"seller": {
|
|
1077
1077
|
"file": "shinjuku-seller.mjs",
|
|
1078
|
-
"sha256": "
|
|
1079
|
-
"bytes":
|
|
1078
|
+
"sha256": "b62e0188de8b515c2ce0bb9a0f989bb6fb8881b746ae55f4be96bdb40f5528a7",
|
|
1079
|
+
"bytes": 4214803,
|
|
1080
1080
|
"entry": "wallet/src/seller/exact/index.mjs",
|
|
1081
1081
|
"external": [
|
|
1082
1082
|
"@x402/core/http",
|
|
@@ -1968,5 +1968,117 @@
|
|
|
1968
1968
|
}
|
|
1969
1969
|
]
|
|
1970
1970
|
},
|
|
1971
|
-
"
|
|
1971
|
+
"tor": {
|
|
1972
|
+
"version": "15.0.25",
|
|
1973
|
+
"platforms": {
|
|
1974
|
+
"win32-x64": {
|
|
1975
|
+
"archive": {
|
|
1976
|
+
"name": "tor-expert-bundle-windows-x86_64-15.0.25.tar.gz",
|
|
1977
|
+
"url": "https://archive.torproject.org/tor-package-archive/torbrowser/15.0.25/tor-expert-bundle-windows-x86_64-15.0.25.tar.gz",
|
|
1978
|
+
"sha256": "c1988c701de2f24f7d098d1d6d7f507b58f27740d097f29c246e0524d639b252"
|
|
1979
|
+
},
|
|
1980
|
+
"files": [
|
|
1981
|
+
{
|
|
1982
|
+
"path": "tor/tor.exe",
|
|
1983
|
+
"sha256": "8c38513b3c4584154158e7c584f4144849dc679a64cd679553d72dad28230c54",
|
|
1984
|
+
"bytes": 10237952
|
|
1985
|
+
}
|
|
1986
|
+
]
|
|
1987
|
+
},
|
|
1988
|
+
"darwin-arm64": {
|
|
1989
|
+
"archive": {
|
|
1990
|
+
"name": "tor-expert-bundle-macos-aarch64-15.0.25.tar.gz",
|
|
1991
|
+
"url": "https://archive.torproject.org/tor-package-archive/torbrowser/15.0.25/tor-expert-bundle-macos-aarch64-15.0.25.tar.gz",
|
|
1992
|
+
"sha256": "a3febb6179152b0b4f56a0f5cc57bf5cc8ecef7db35e7c3e9d5a044c8158c26c"
|
|
1993
|
+
},
|
|
1994
|
+
"files": [
|
|
1995
|
+
{
|
|
1996
|
+
"path": "tor/tor",
|
|
1997
|
+
"sha256": "7d5a89b6cec99aab47420040ad86dd5fd5174192e71b6c201b0b10170ba57ebb",
|
|
1998
|
+
"bytes": 8612912
|
|
1999
|
+
},
|
|
2000
|
+
{
|
|
2001
|
+
"path": "tor/libevent-2.1.7.dylib",
|
|
2002
|
+
"sha256": "6dde3faf59255b7cf0cc20d0b3cdf78622266fbf13c534300b8884c76d89b739",
|
|
2003
|
+
"bytes": 411372
|
|
2004
|
+
}
|
|
2005
|
+
]
|
|
2006
|
+
},
|
|
2007
|
+
"darwin-x64": {
|
|
2008
|
+
"archive": {
|
|
2009
|
+
"name": "tor-expert-bundle-macos-x86_64-15.0.25.tar.gz",
|
|
2010
|
+
"url": "https://archive.torproject.org/tor-package-archive/torbrowser/15.0.25/tor-expert-bundle-macos-x86_64-15.0.25.tar.gz",
|
|
2011
|
+
"sha256": "e1ae4d4a734d28bb590839188511deb3cebc26fcbce9df66d01b2c452060fe95"
|
|
2012
|
+
},
|
|
2013
|
+
"files": [
|
|
2014
|
+
{
|
|
2015
|
+
"path": "tor/tor",
|
|
2016
|
+
"sha256": "e249a521aa5b0ff44a39c1dc4b5707ae8cb109d8a26c637b6acbbf6832bf2f14",
|
|
2017
|
+
"bytes": 8878480
|
|
2018
|
+
},
|
|
2019
|
+
{
|
|
2020
|
+
"path": "tor/libevent-2.1.7.dylib",
|
|
2021
|
+
"sha256": "38aea0316e01e1fc52a15941bf523c8bc018ca90655cfa90de568b4a86a82b4b",
|
|
2022
|
+
"bytes": 366480
|
|
2023
|
+
}
|
|
2024
|
+
]
|
|
2025
|
+
},
|
|
2026
|
+
"linux-x64": {
|
|
2027
|
+
"archive": {
|
|
2028
|
+
"name": "tor-expert-bundle-linux-x86_64-15.0.25.tar.gz",
|
|
2029
|
+
"url": "https://archive.torproject.org/tor-package-archive/torbrowser/15.0.25/tor-expert-bundle-linux-x86_64-15.0.25.tar.gz",
|
|
2030
|
+
"sha256": "19cf18726eecb362e0f21d27afa9ea9efe5da928bfdfbb1ceb5fe54519e87f4a"
|
|
2031
|
+
},
|
|
2032
|
+
"files": [
|
|
2033
|
+
{
|
|
2034
|
+
"path": "tor/tor",
|
|
2035
|
+
"sha256": "39c9db0654d2ec218892bd00f75eccb5b641a7222754436c2e4a8d2f764a57d3",
|
|
2036
|
+
"bytes": 3614616
|
|
2037
|
+
},
|
|
2038
|
+
{
|
|
2039
|
+
"path": "tor/libevent-2.1.so.7",
|
|
2040
|
+
"sha256": "b51ca562ec232785856c454ce4f3621d957f39d0db87919e237590b0331544ff",
|
|
2041
|
+
"bytes": 346424
|
|
2042
|
+
},
|
|
2043
|
+
{
|
|
2044
|
+
"path": "tor/libssl.so.3",
|
|
2045
|
+
"sha256": "9c2438d086d6c299db04b0bc337bbc8c0acd26c19c71eada2173a5b2ef7cecac",
|
|
2046
|
+
"bytes": 1056448
|
|
2047
|
+
},
|
|
2048
|
+
{
|
|
2049
|
+
"path": "tor/libcrypto.so.3",
|
|
2050
|
+
"sha256": "418208c5c738864cb5653f3eeab650debcc71afbe50d08b0bd5a04b20f1d3c05",
|
|
2051
|
+
"bytes": 5493040
|
|
2052
|
+
}
|
|
2053
|
+
]
|
|
2054
|
+
}
|
|
2055
|
+
},
|
|
2056
|
+
"docs": [
|
|
2057
|
+
{
|
|
2058
|
+
"path": "docs/tor.txt",
|
|
2059
|
+
"sha256": "5dc29ea302cc75db6db4a7c88d7b5d4638b4e0f5f1d2e6d21ce71f707470b766",
|
|
2060
|
+
"bytes": 21086,
|
|
2061
|
+
"from": "windows-x86_64"
|
|
2062
|
+
},
|
|
2063
|
+
{
|
|
2064
|
+
"path": "docs/openssl.txt",
|
|
2065
|
+
"sha256": "7d5450cb2d142651b8afa315b5f238efc805dad827d91ba367d8516bc9d49e7a",
|
|
2066
|
+
"bytes": 10175,
|
|
2067
|
+
"from": "windows-x86_64"
|
|
2068
|
+
},
|
|
2069
|
+
{
|
|
2070
|
+
"path": "docs/libevent.txt",
|
|
2071
|
+
"sha256": "ff02effc9b331edcdac387d198691bfa3e575e7d244ad10cb826aa51ef085670",
|
|
2072
|
+
"bytes": 4528,
|
|
2073
|
+
"from": "windows-x86_64"
|
|
2074
|
+
},
|
|
2075
|
+
{
|
|
2076
|
+
"path": "docs/zlib.txt",
|
|
2077
|
+
"sha256": "e32ff4e00d9d94930537635291da39e7e612703334bf6fde8c7f1686fe8a45a2",
|
|
2078
|
+
"bytes": 1002,
|
|
2079
|
+
"from": "windows-x86_64"
|
|
2080
|
+
}
|
|
2081
|
+
]
|
|
2082
|
+
},
|
|
2083
|
+
"publishedAt": "2026-11-17T15:22:15.952Z"
|
|
1972
2084
|
}
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "shinjuku-shield",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.239",
|
|
4
4
|
"mcpName": "io.github.ShinjukuStaition/shinjuku-shield",
|
|
5
5
|
"description": "Shinjuku Shield, private x402 payments on Solana: the self-custody wallet CLI and its MCP server. Shield, pay, and unshield USDC from any MCP agent, under caps you set.",
|
|
6
|
-
"shinjukuRelease": "
|
|
7
|
-
"shinjukuSha256": "
|
|
6
|
+
"shinjukuRelease": "dd60a30f",
|
|
7
|
+
"shinjukuSha256": "dd60a30f807d02b8173861757e05e0854dd9715f4d3b70c023b9195b82ea236b",
|
|
8
8
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
9
9
|
"author": "Shinjuku Shield",
|
|
10
10
|
"homepage": "https://github.com/ShinjukuStaition/shinjuku-shield#readme",
|
|
@@ -44,7 +44,8 @@
|
|
|
44
44
|
"LICENSE.txt",
|
|
45
45
|
"THIRD_PARTY_NOTICES.txt",
|
|
46
46
|
"SELLER_THIRD_PARTY_NOTICES.txt",
|
|
47
|
-
"manifest.json"
|
|
47
|
+
"manifest.json",
|
|
48
|
+
"tor/"
|
|
48
49
|
],
|
|
49
50
|
"engines": {
|
|
50
51
|
"node": "^22.21.0 || >=24.0.0"
|
package/shinjuku-seller.mjs
CHANGED
|
@@ -38185,7 +38185,7 @@ async function rpcFetch(input, init) {
|
|
|
38185
38185
|
rpcNotBefore.set(post.key, Math.max(rpcNotBefore.get(post.key) ?? 0, Date.now() + retryAfterMs(response)));
|
|
38186
38186
|
}
|
|
38187
38187
|
}
|
|
38188
|
-
var relayKeyOf, READ_ONLY_METHOD, readOnlyPost, TOR_HTTP_TUNNEL, LOCAL_PROOF_TIMEOUT_MS, LOCAL_PROOF_MAX_BYTES, MARK, ownProxyRefused, ONION_V3, RETRY_AFTER_CAP_MS, RETRY_AFTER_FLOOR_MS, RETRY_AFTER_DEFAULT_MS, RPC_NO_ANSWER_LIMIT_MS, RPC_PACING_CAP_MS, PACING_NOTICE_EVERY_MS, PACING_RATE_WINDOW_MS, TOR_MAX_ROTATIONS, runStartedAt, rpcNotBefore, pacingWaiters, pacingSince, pacedMs, rpcAnswered, lastAnswerAt, readSteps, pacingNoticeAt, pacingSamples, torMoves, torCircuitId, torTagStartedAt, torMovesRefused, pendingMove, inTorRunOf, inTorRun, isOnionOrigin, ownTorControlAllowance, OWN_TOR_CONTROL_ALLOWANCE_MS, tunnelSockets, TOR_MIN_VERSION, TOR_EXPERT_BUNDLE, TOR_EXPERT_BUNDLE_SHA256, TOR_ARCHIVE, TOR_EXPERT_BUNDLE_URL, TOR_EXPERT_BUNDLES, TUNNEL_LINE, TOR_DEB_KEY, TOR_DEB_KEYRING, TOR_INSTALL, torStart, LOCAL_TUNNEL, torStartText, TOR_WINDOW, torUpdateHow, TOR_STOP_OLD_WINDOWS, torTooOldWhy, TOR_WAIT_WORDS, TOR_WAIT_PLAIN, withRunTag, proxyEnv, pacedSoFar, RESENDABLE_METHOD, torCircuit, laneDispatchers, laneOfDispatcher, ONION_COLD_KEEP_MS, coldStallSaidOn, HOUR_CLOSURES;
|
|
38188
|
+
var relayKeyOf, READ_ONLY_METHOD, readOnlyPost, TOR_HTTP_TUNNEL, LOCAL_PROOF_TIMEOUT_MS, LOCAL_PROOF_MAX_BYTES, MARK, ownProxyRefused, ONION_V3, RETRY_AFTER_CAP_MS, RETRY_AFTER_FLOOR_MS, RETRY_AFTER_DEFAULT_MS, RPC_NO_ANSWER_LIMIT_MS, RPC_PACING_CAP_MS, PACING_NOTICE_EVERY_MS, PACING_RATE_WINDOW_MS, TOR_MAX_ROTATIONS, runStartedAt, rpcNotBefore, pacingWaiters, pacingSince, pacedMs, rpcAnswered, lastAnswerAt, readSteps, pacingNoticeAt, pacingSamples, torMoves, torCircuitId, torTagStartedAt, torMovesRefused, pendingMove, inTorRunOf, inTorRun, isOnionOrigin, ownTorControlAllowance, OWN_TOR_CONTROL_ALLOWANCE_MS, tunnelSockets, TOR_MIN_VERSION, TOR_EXPERT_BUNDLE, TOR_EXPERT_BUNDLE_SHA256, TOR_ARCHIVE, TOR_EXPERT_BUNDLE_URL, TOR_EXPERT_BUNDLES, TOR_PACKAGED, TOR_PACKAGED_DOCS, TUNNEL_LINE, TOR_DEB_KEY, TOR_DEB_KEYRING, TOR_INSTALL, torStart, LOCAL_TUNNEL, torStartText, TOR_WINDOW, torUpdateHow, TOR_STOP_OLD_WINDOWS, torTooOldWhy, TOR_WAIT_WORDS, TOR_WAIT_PLAIN, withRunTag, proxyEnv, pacedSoFar, RESENDABLE_METHOD, torCircuit, laneDispatchers, laneOfDispatcher, ONION_COLD_KEEP_MS, coldStallSaidOn, HOUR_CLOSURES;
|
|
38189
38189
|
var init_proxy = __esm({
|
|
38190
38190
|
"wallet/src/net/proxy.mjs"() {
|
|
38191
38191
|
"use strict";
|
|
@@ -38273,6 +38273,31 @@ var init_proxy = __esm({
|
|
|
38273
38273
|
mb: 31
|
|
38274
38274
|
})
|
|
38275
38275
|
});
|
|
38276
|
+
TOR_PACKAGED = Object.freeze({
|
|
38277
|
+
"win32-x64": Object.freeze({ archive: "windows-x86_64", files: Object.freeze([
|
|
38278
|
+
Object.freeze({ path: "tor/tor.exe", sha256: "8c38513b3c4584154158e7c584f4144849dc679a64cd679553d72dad28230c54", bytes: 10237952 })
|
|
38279
|
+
]) }),
|
|
38280
|
+
"darwin-arm64": Object.freeze({ archive: "macos-aarch64", files: Object.freeze([
|
|
38281
|
+
Object.freeze({ path: "tor/tor", sha256: "7d5a89b6cec99aab47420040ad86dd5fd5174192e71b6c201b0b10170ba57ebb", bytes: 8612912 }),
|
|
38282
|
+
Object.freeze({ path: "tor/libevent-2.1.7.dylib", sha256: "6dde3faf59255b7cf0cc20d0b3cdf78622266fbf13c534300b8884c76d89b739", bytes: 411372 })
|
|
38283
|
+
]) }),
|
|
38284
|
+
"darwin-x64": Object.freeze({ archive: "macos-x86_64", files: Object.freeze([
|
|
38285
|
+
Object.freeze({ path: "tor/tor", sha256: "e249a521aa5b0ff44a39c1dc4b5707ae8cb109d8a26c637b6acbbf6832bf2f14", bytes: 8878480 }),
|
|
38286
|
+
Object.freeze({ path: "tor/libevent-2.1.7.dylib", sha256: "38aea0316e01e1fc52a15941bf523c8bc018ca90655cfa90de568b4a86a82b4b", bytes: 366480 })
|
|
38287
|
+
]) }),
|
|
38288
|
+
"linux-x64": Object.freeze({ archive: "linux-x86_64", files: Object.freeze([
|
|
38289
|
+
Object.freeze({ path: "tor/tor", sha256: "39c9db0654d2ec218892bd00f75eccb5b641a7222754436c2e4a8d2f764a57d3", bytes: 3614616 }),
|
|
38290
|
+
Object.freeze({ path: "tor/libevent-2.1.so.7", sha256: "b51ca562ec232785856c454ce4f3621d957f39d0db87919e237590b0331544ff", bytes: 346424 }),
|
|
38291
|
+
Object.freeze({ path: "tor/libssl.so.3", sha256: "9c2438d086d6c299db04b0bc337bbc8c0acd26c19c71eada2173a5b2ef7cecac", bytes: 1056448 }),
|
|
38292
|
+
Object.freeze({ path: "tor/libcrypto.so.3", sha256: "418208c5c738864cb5653f3eeab650debcc71afbe50d08b0bd5a04b20f1d3c05", bytes: 5493040 })
|
|
38293
|
+
]) })
|
|
38294
|
+
});
|
|
38295
|
+
TOR_PACKAGED_DOCS = Object.freeze([
|
|
38296
|
+
Object.freeze({ path: "docs/tor.txt", sha256: "5dc29ea302cc75db6db4a7c88d7b5d4638b4e0f5f1d2e6d21ce71f707470b766", bytes: 21086 }),
|
|
38297
|
+
Object.freeze({ path: "docs/openssl.txt", sha256: "7d5450cb2d142651b8afa315b5f238efc805dad827d91ba367d8516bc9d49e7a", bytes: 10175 }),
|
|
38298
|
+
Object.freeze({ path: "docs/libevent.txt", sha256: "ff02effc9b331edcdac387d198691bfa3e575e7d244ad10cb826aa51ef085670", bytes: 4528 }),
|
|
38299
|
+
Object.freeze({ path: "docs/zlib.txt", sha256: "e32ff4e00d9d94930537635291da39e7e612703334bf6fde8c7f1686fe8a45a2", bytes: 1002 })
|
|
38300
|
+
]);
|
|
38276
38301
|
TUNNEL_LINE = "HTTPTunnelPort 127.0.0.1:9080 IsolateDestAddr";
|
|
38277
38302
|
TOR_DEB_KEY = "https://deb.torproject.org/torproject.org/A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89.asc";
|
|
38278
38303
|
TOR_DEB_KEYRING = "/usr/share/keyrings/deb.torproject.org-keyring.gpg";
|
|
@@ -60206,7 +60231,7 @@ function comparePrefixPages(pages, prefix, { pool: pool2, from }) {
|
|
|
60206
60231
|
const onPage = (entry) => (start === 0 || entry?.afterOrdinal > start) && entry?.afterOrdinal <= reach;
|
|
60207
60232
|
const imports = (list) => (Array.isArray(list) ? list : []).filter(onPage);
|
|
60208
60233
|
return sameJson(imports(prefix.imports), imports(result.imports)) ? "match" : "mismatch";
|
|
60209
|
-
}, () => "unavailable");
|
|
60234
|
+
}, () => "unavailable").catch(() => "mismatch");
|
|
60210
60235
|
const checks = pages.filter(([start]) => start < from).map(one);
|
|
60211
60236
|
return new Promise((resolve18) => {
|
|
60212
60237
|
for (const check of checks) check.then((result) => {
|
|
@@ -60748,6 +60773,80 @@ async function readCompactP03HistoryNow({
|
|
|
60748
60773
|
return list;
|
|
60749
60774
|
};
|
|
60750
60775
|
let prefixCheck;
|
|
60776
|
+
const scalar = (value2) => value2 === null || value2 === void 0 || ["string", "number", "boolean"].includes(typeof value2);
|
|
60777
|
+
const sameValue = (left, right) => Array.isArray(left) || Array.isArray(right) ? Array.isArray(left) && Array.isArray(right) && left.length === right.length && left.every((value2, at) => scalar(value2) && value2 === right[at]) : scalar(left) && left === right;
|
|
60778
|
+
const sameFields = (left, right, fields) => left !== null && typeof left === "object" && right !== null && typeof right === "object" && fields.every((field4) => sameValue(left[field4], right[field4]));
|
|
60779
|
+
const sameList = (left, right) => {
|
|
60780
|
+
try {
|
|
60781
|
+
const leftImports = Array.isArray(left?.imports) ? left.imports : [];
|
|
60782
|
+
const rightImports = Array.isArray(right?.imports) ? right.imports : [];
|
|
60783
|
+
return Array.isArray(left?.records) && Array.isArray(right?.records) && left.records.length === right.records.length && left.records.every((record, ordinal) => sameFields(record, right.records[ordinal], RACE_RECORD_FIELDS)) && leftImports.length === rightImports.length && leftImports.every((entry, at) => sameFields(entry, rightImports[at], IMPORT_KEYS)) && (left.initialization === void 0 && right.initialization === void 0 || sameFields(left.initialization, right.initialization, ["signature", "slot"]));
|
|
60784
|
+
} catch {
|
|
60785
|
+
return false;
|
|
60786
|
+
}
|
|
60787
|
+
};
|
|
60788
|
+
let listPassed = false;
|
|
60789
|
+
const raceWarnings = [];
|
|
60790
|
+
const writeRaceWarning = (winner) => {
|
|
60791
|
+
try {
|
|
60792
|
+
process.stderr.write(`history: WARNING the history source's pages and this wallet's cached records with the pool's last page give different lists at the same count; this read took the ${winner} list, which passed the pool account's checks
|
|
60793
|
+
`);
|
|
60794
|
+
} catch {
|
|
60795
|
+
}
|
|
60796
|
+
};
|
|
60797
|
+
const raceMismatch = (winner) => {
|
|
60798
|
+
markPhase(`compact-race-mismatch-${winner}`);
|
|
60799
|
+
if (listPassed) writeRaceWarning(winner);
|
|
60800
|
+
else raceWarnings.push(winner);
|
|
60801
|
+
};
|
|
60802
|
+
const raceTailAndPages = async (zero, tailRead, cachedRecords, from, sent) => {
|
|
60803
|
+
const pagesRun = readServedPages(zero);
|
|
60804
|
+
pagesRun.catch(() => {
|
|
60805
|
+
});
|
|
60806
|
+
const tailRun = tailRead.then((answer) => combineCompactTail(cachedRecords, answer, { pool: poolString, from, count: count2, size: sent.tailSize })).catch(() => ({ miss: "fetch-failed" }));
|
|
60807
|
+
const pagesDone = pagesRun.then((list) => ({ by: "pages", list }), (error) => ({ by: "pages", error }));
|
|
60808
|
+
let won = await Promise.race([pagesDone, tailRun.then((combined2) => combined2.miss === void 0 ? { by: "tail", combined: combined2 } : pagesDone)]);
|
|
60809
|
+
if (won.by === "pages" && won.error !== void 0) {
|
|
60810
|
+
const combined2 = await tailRun;
|
|
60811
|
+
if (combined2.miss !== void 0) throw won.error;
|
|
60812
|
+
won = { by: "tail", combined: combined2 };
|
|
60813
|
+
}
|
|
60814
|
+
if (won.by === "pages") {
|
|
60815
|
+
markPhase("compact-race-pages-won");
|
|
60816
|
+
const list = won.list;
|
|
60817
|
+
tailRun.then((combined2) => {
|
|
60818
|
+
if (combined2.miss === void 0 && !sameList(combined2.page, list)) raceMismatch("pages");
|
|
60819
|
+
}).catch(() => raceMismatch("pages"));
|
|
60820
|
+
return list;
|
|
60821
|
+
}
|
|
60822
|
+
markPhase("compact-race-tail-won");
|
|
60823
|
+
const { combined } = won;
|
|
60824
|
+
if (aheadHere?.kind === "tail") aheadHere.list = combined.page.records;
|
|
60825
|
+
const prefix2 = comparePrefixPages(
|
|
60826
|
+
[[0, zero], ...[...sent.pages].map(([start, handle]) => [start, handle.read])],
|
|
60827
|
+
cachedRecords,
|
|
60828
|
+
{ pool: poolString, from }
|
|
60829
|
+
);
|
|
60830
|
+
const whole = pagesRun.then((list) => {
|
|
60831
|
+
if (sameList(list, combined.page)) return "match";
|
|
60832
|
+
raceMismatch("tail");
|
|
60833
|
+
return "mismatch";
|
|
60834
|
+
}, () => "unavailable").catch(() => {
|
|
60835
|
+
raceMismatch("tail");
|
|
60836
|
+
return "mismatch";
|
|
60837
|
+
});
|
|
60838
|
+
prefixCheck = new Promise((resolve18) => {
|
|
60839
|
+
for (const check of [prefix2, whole]) check.then((result) => {
|
|
60840
|
+
if (result === "mismatch") resolve18("mismatch");
|
|
60841
|
+
}).catch(() => resolve18("mismatch"));
|
|
60842
|
+
Promise.all([prefix2, whole]).then((results) => resolve18(results.includes("mismatch") ? "mismatch" : results.includes("unavailable") ? "unavailable" : "match")).catch(() => resolve18("mismatch"));
|
|
60843
|
+
});
|
|
60844
|
+
try {
|
|
60845
|
+
onTailHit?.({ first: zero, snapshot, check: prefixCheck, rest: sent });
|
|
60846
|
+
} catch {
|
|
60847
|
+
}
|
|
60848
|
+
return combined.page;
|
|
60849
|
+
};
|
|
60751
60850
|
const readTailOrPages = async () => {
|
|
60752
60851
|
if (reusedFirst !== void 0 || !tail) return readServedPages();
|
|
60753
60852
|
const zero = first ?? preFirst ?? requestPage(source, poolString, 0, signal);
|
|
@@ -60787,8 +60886,8 @@ async function readCompactP03HistoryNow({
|
|
|
60787
60886
|
}
|
|
60788
60887
|
}
|
|
60789
60888
|
if (await Promise.race([zero.then((answer) => answer.error === void 0), tailRead.then(() => false)])) {
|
|
60790
|
-
markPhase("compact-tail-
|
|
60791
|
-
return
|
|
60889
|
+
markPhase("compact-tail-race-page0-first");
|
|
60890
|
+
return raceTailAndPages(zero, tailRead, cachedRecords, from, sent);
|
|
60792
60891
|
}
|
|
60793
60892
|
const combined = combineCompactTail(cachedRecords, await tailRead, { pool: poolString, from, count: count2, size: sent.tailSize });
|
|
60794
60893
|
if (combined.miss === "behind") {
|
|
@@ -60966,6 +61065,8 @@ async function readCompactP03HistoryNow({
|
|
|
60966
61065
|
throw error;
|
|
60967
61066
|
}
|
|
60968
61067
|
listValidOpen();
|
|
61068
|
+
listPassed = true;
|
|
61069
|
+
for (const winner of raceWarnings.splice(0)) writeRaceWarning(winner);
|
|
60969
61070
|
markPhase("compact-fold");
|
|
60970
61071
|
const [verifiedInitialization, alongsideResult] = await reads;
|
|
60971
61072
|
const finished = contexts;
|
|
@@ -61337,7 +61438,7 @@ async function tryCompactP03HistoryReport(options) {
|
|
|
61337
61438
|
return { ok: false, reason, ...detail ? { detail } : {}, error };
|
|
61338
61439
|
}
|
|
61339
61440
|
}
|
|
61340
|
-
var import_web398, P03_COMPACT_HISTORY_SOURCE_MODEL, P03_COMPACT_PAGE, P03_COMPACT_SPOT_CHECKS, FIELD_MODULUS5, SUBTREE_LEAVES3, LOCAL_DEPTH2, OUTER_DEPTH2, PRIMARY_PROOF_BYTES2, FIELD_BYTES4, ED25519_SPKI_PREFIX3, VERSION_1_PREFIX2, HEX642, BASE58, REPLAY_STORE_INDEXED2, PROFILES2, MOVE_HEAD_BYTES2, MOVE_INSERTED_VALUES2, refuse2, hash4, bitAt, zeroRootsMemo, lastFolds, PRE_FOLD_SLICE_MS, preFolds, FOLD_CHECKPOINT_EVERY, foldNode, foldFrontier, foldHex, servedWithoutRecords, isSignature, isIndex, IMPORT_KEYS, IMPORT_MAX_VALUES, LIST_ATTEMPTS, listInFlight, HISTORY_STALL_LANE, HISTORY_LANE_MAX_MOVES, stallLaneCircuit, stallLaneMoves, stallLaneGen, stallLaneSpent, LIST_HEAD_TIMEOUT_MS, LIST_HEAD_STALLED, LIST_BODY_STALL_MS, LIST_TOTAL_CAP_MS, OWN_READ_TIMEOUT_MS, BOUNDED_OWN_METHODS, P03_COMPACT_TAIL_GRID, TAIL_RETRY_REFUSALS, tailFrom, sameJson, SPOT_HEDGE_AFTER_MS, SPOT_HEDGE_LANE, POOL_HEDGE_AFTER_MS, POOL_HEDGE_LANE, compactReportsRunning, P03_UPGRADE_CHECKED_AT;
|
|
61441
|
+
var import_web398, P03_COMPACT_HISTORY_SOURCE_MODEL, P03_COMPACT_PAGE, P03_COMPACT_SPOT_CHECKS, FIELD_MODULUS5, SUBTREE_LEAVES3, LOCAL_DEPTH2, OUTER_DEPTH2, PRIMARY_PROOF_BYTES2, FIELD_BYTES4, ED25519_SPKI_PREFIX3, VERSION_1_PREFIX2, HEX642, BASE58, REPLAY_STORE_INDEXED2, PROFILES2, MOVE_HEAD_BYTES2, MOVE_INSERTED_VALUES2, refuse2, hash4, bitAt, zeroRootsMemo, lastFolds, PRE_FOLD_SLICE_MS, preFolds, FOLD_CHECKPOINT_EVERY, foldNode, foldFrontier, foldHex, servedWithoutRecords, isSignature, isIndex, IMPORT_KEYS, IMPORT_MAX_VALUES, RACE_RECORD_FIELDS, LIST_ATTEMPTS, listInFlight, HISTORY_STALL_LANE, HISTORY_LANE_MAX_MOVES, stallLaneCircuit, stallLaneMoves, stallLaneGen, stallLaneSpent, LIST_HEAD_TIMEOUT_MS, LIST_HEAD_STALLED, LIST_BODY_STALL_MS, LIST_TOTAL_CAP_MS, OWN_READ_TIMEOUT_MS, BOUNDED_OWN_METHODS, P03_COMPACT_TAIL_GRID, TAIL_RETRY_REFUSALS, tailFrom, sameJson, SPOT_HEDGE_AFTER_MS, SPOT_HEDGE_LANE, POOL_HEDGE_AFTER_MS, POOL_HEDGE_LANE, compactReportsRunning, P03_UPGRADE_CHECKED_AT;
|
|
61341
61442
|
var init_compact = __esm({
|
|
61342
61443
|
"wallet/src/history/compact.mjs"() {
|
|
61343
61444
|
"use strict";
|
|
@@ -61481,6 +61582,23 @@ var init_compact = __esm({
|
|
|
61481
61582
|
isIndex = (value2) => Number.isSafeInteger(value2) && value2 >= 0;
|
|
61482
61583
|
IMPORT_KEYS = ["afterOrdinal", "instructionIndex", "record", "signature", "slot", "transactionIndex", "values"];
|
|
61483
61584
|
IMPORT_MAX_VALUES = 3;
|
|
61585
|
+
RACE_RECORD_FIELDS = Object.freeze([
|
|
61586
|
+
"ordinal",
|
|
61587
|
+
"kind",
|
|
61588
|
+
"outCommitment",
|
|
61589
|
+
"contextCommitment",
|
|
61590
|
+
"memoDigest",
|
|
61591
|
+
"epoch",
|
|
61592
|
+
"replayValues",
|
|
61593
|
+
"payloadSha256",
|
|
61594
|
+
"signature",
|
|
61595
|
+
"slot",
|
|
61596
|
+
"transactionIndex",
|
|
61597
|
+
"instructionIndex",
|
|
61598
|
+
"buffer",
|
|
61599
|
+
"bufferWriteSignatures",
|
|
61600
|
+
"primaryProofForm"
|
|
61601
|
+
]);
|
|
61484
61602
|
LIST_ATTEMPTS = 6;
|
|
61485
61603
|
listInFlight = /* @__PURE__ */ new Map();
|
|
61486
61604
|
HISTORY_STALL_LANE = "history-stall";
|
|
@@ -61504,7 +61622,13 @@ var init_compact = __esm({
|
|
|
61504
61622
|
"p03_compact_history_source_answer_invalid"
|
|
61505
61623
|
]);
|
|
61506
61624
|
tailFrom = (count2, grid) => Math.floor((count2 - 1) / grid) * grid;
|
|
61507
|
-
sameJson = (left, right) =>
|
|
61625
|
+
sameJson = (left, right) => {
|
|
61626
|
+
try {
|
|
61627
|
+
return JSON.stringify(left) === JSON.stringify(right);
|
|
61628
|
+
} catch {
|
|
61629
|
+
return false;
|
|
61630
|
+
}
|
|
61631
|
+
};
|
|
61508
61632
|
SPOT_HEDGE_AFTER_MS = 4e3;
|
|
61509
61633
|
SPOT_HEDGE_LANE = "spot-hedge";
|
|
61510
61634
|
POOL_HEDGE_AFTER_MS = 5e3;
|
|
@@ -79715,19 +79839,18 @@ import net3 from "node:net";
|
|
|
79715
79839
|
import { basename as basename6, dirname as dirname20, join as join24, sep as sep3 } from "node:path";
|
|
79716
79840
|
import { Readable } from "node:stream";
|
|
79717
79841
|
import { pipeline } from "node:stream/promises";
|
|
79842
|
+
import { fileURLToPath as fileURLToPath9 } from "node:url";
|
|
79718
79843
|
var ownTorPlatform = (platform = process.platform, arch = process.arch) => platform === "win32" || platform === "darwin" || platform === "linux" && arch === "x64";
|
|
79719
79844
|
var MAC = process.platform === "darwin";
|
|
79720
79845
|
var LINUX = process.platform === "linux";
|
|
79721
79846
|
var SYSTEM2 = MAC ? "macOS" : LINUX ? "Linux" : "Windows";
|
|
79722
|
-
var
|
|
79847
|
+
var platformKey = () => MAC ? `darwin-${macChipArch()}` : LINUX ? "linux-x64" : "win32-x64";
|
|
79848
|
+
var bundle = () => TOR_EXPERT_BUNDLES[platformKey()];
|
|
79723
79849
|
var managedTorDir = (home) => join24(home, "tor");
|
|
79724
79850
|
var stateFile = (home) => join24(managedTorDir(home), "managed.json");
|
|
79725
79851
|
var bundleDir = (home) => join24(managedTorDir(home), `expert-bundle-${TOR_EXPERT_BUNDLE}`);
|
|
79726
79852
|
var torExe = (home) => join24(bundleDir(home), "tor", MAC || LINUX ? "tor" : "tor.exe");
|
|
79727
|
-
var MAC_SIGNED = [["tor", "libevent-2.1.7.dylib"], ["tor", "tor"]];
|
|
79728
79853
|
var COMPLETE = ".complete";
|
|
79729
|
-
var LINUX_TOR = [["tor", "tor"], ["tor", "libevent-2.1.so.7"], ["tor", "libssl.so.3"], ["tor", "libcrypto.so.3"]];
|
|
79730
|
-
var BUNDLE_FILES = MAC ? [...MAC_SIGNED, ["data", "geoip"], ["data", "geoip6"]] : LINUX ? [...LINUX_TOR, ["data", "geoip"], ["data", "geoip6"]] : [["tor", "tor.exe"], ["data", "geoip"], ["data", "geoip6"]];
|
|
79731
79854
|
var logFile = (home) => join24(managedTorDir(home), "notice.log");
|
|
79732
79855
|
var BOOTSTRAP_STALL_MS = 6e4;
|
|
79733
79856
|
var BOOTSTRAP_MAX_MS = 3e5;
|
|
@@ -80219,24 +80342,46 @@ async function takeLock(home, say, deadline) {
|
|
|
80219
80342
|
clearTimeout(timer);
|
|
80220
80343
|
}
|
|
80221
80344
|
}
|
|
80222
|
-
var
|
|
80223
|
-
var
|
|
80224
|
-
|
|
80225
|
-
function writeLinuxHashes(dir) {
|
|
80226
|
-
const list = Object.fromEntries(LINUX_TOR.map((parts) => [parts.join("/"), fileSha256(join24(dir, ...parts))]));
|
|
80227
|
-
writeFileSync(join24(dir, LINUX_HASHES), `${JSON.stringify(list)}
|
|
80228
|
-
`, { mode: 384 });
|
|
80229
|
-
}
|
|
80230
|
-
function linuxTorIntact(dir) {
|
|
80345
|
+
var pinnedFiles = () => TOR_PACKAGED[platformKey()]?.files ?? [];
|
|
80346
|
+
var SIGNED_HASHES = ".signed-hashes.json";
|
|
80347
|
+
function plainPath(base, path) {
|
|
80231
80348
|
try {
|
|
80232
|
-
|
|
80233
|
-
|
|
80349
|
+
if (!lstatSync(base).isDirectory()) return false;
|
|
80350
|
+
const parts = path.slice(base.length + 1).split(sep3);
|
|
80351
|
+
for (let i = 1; i < parts.length; i += 1) if (!lstatSync(join24(base, ...parts.slice(0, i))).isDirectory()) return false;
|
|
80352
|
+
return lstatSync(path).isFile();
|
|
80234
80353
|
} catch {
|
|
80235
80354
|
return false;
|
|
80236
80355
|
}
|
|
80237
80356
|
}
|
|
80357
|
+
function plainFileHash(dir, relative8) {
|
|
80358
|
+
const path = join24(dir, ...relative8.split("/"));
|
|
80359
|
+
if (!plainPath(dir, path)) return void 0;
|
|
80360
|
+
try {
|
|
80361
|
+
const bytes2 = readFileSync(path);
|
|
80362
|
+
return { sha256: createHash27("sha256").update(bytes2).digest("hex"), bytes: bytes2.length };
|
|
80363
|
+
} catch {
|
|
80364
|
+
return void 0;
|
|
80365
|
+
}
|
|
80366
|
+
}
|
|
80367
|
+
var torFilesIntact = (dir, files) => files.length > 0 && files.every((file) => {
|
|
80368
|
+
const seen = plainFileHash(dir, file.path);
|
|
80369
|
+
return seen !== void 0 && seen.sha256 === file.sha256 && seen.bytes === file.bytes;
|
|
80370
|
+
});
|
|
80371
|
+
function installedExpected(dir) {
|
|
80372
|
+
if (!MAC) return pinnedFiles();
|
|
80373
|
+
if (!plainPath(dir, join24(dir, SIGNED_HASHES))) return [];
|
|
80374
|
+
try {
|
|
80375
|
+
const list = JSON.parse(readFileSync(join24(dir, SIGNED_HASHES), "utf8"));
|
|
80376
|
+
return pinnedFiles().map((file) => ({ path: file.path, sha256: list?.[file.path]?.sha256, bytes: list?.[file.path]?.bytes }));
|
|
80377
|
+
} catch {
|
|
80378
|
+
return [];
|
|
80379
|
+
}
|
|
80380
|
+
}
|
|
80381
|
+
var bundleComplete = (home) => plainPath(bundleDir(home), join24(bundleDir(home), COMPLETE)) && torFilesIntact(bundleDir(home), installedExpected(bundleDir(home)));
|
|
80238
80382
|
function signMacTor(unpacking) {
|
|
80239
|
-
for (const
|
|
80383
|
+
for (const pinned of pinnedFiles()) {
|
|
80384
|
+
const parts = pinned.path.split("/");
|
|
80240
80385
|
const file = join24(unpacking, ...parts);
|
|
80241
80386
|
for (const args of [["--force", "--sign", "-", file], ["--verify", file]]) {
|
|
80242
80387
|
const result = spawnSync3("/usr/bin/codesign", args, { encoding: "utf8", timeout: 6e4 });
|
|
@@ -80268,13 +80413,55 @@ function prepareLinuxTor(unpacking) {
|
|
|
80268
80413
|
return `the files could not be prepared (${error?.code ?? error?.message ?? error})`;
|
|
80269
80414
|
}
|
|
80270
80415
|
}
|
|
80271
|
-
|
|
80272
|
-
|
|
80416
|
+
function packagedTorRoot(moduleUrl = new URL("__bundled_source__/wallet/src/net/managedTor.mjs", import.meta.url).href) {
|
|
80417
|
+
let here3;
|
|
80418
|
+
try {
|
|
80419
|
+
here3 = fileURLToPath9(moduleUrl);
|
|
80420
|
+
} catch {
|
|
80421
|
+
return void 0;
|
|
80422
|
+
}
|
|
80423
|
+
const at = here3.lastIndexOf(`${sep3}__bundled_source__${sep3}`);
|
|
80424
|
+
if (at === -1) return void 0;
|
|
80425
|
+
try {
|
|
80426
|
+
return join24(realpathSync(here3.slice(0, at)), "tor");
|
|
80427
|
+
} catch {
|
|
80428
|
+
return void 0;
|
|
80429
|
+
}
|
|
80430
|
+
}
|
|
80431
|
+
function copyPackagedTor(unpacking) {
|
|
80432
|
+
const packaged = TOR_PACKAGED[platformKey()];
|
|
80433
|
+
const root = packagedTorRoot();
|
|
80434
|
+
let carries = false;
|
|
80435
|
+
try {
|
|
80436
|
+
carries = Boolean(root) && lstatSync(root).isDirectory() && lstatSync(join24(root, "docs", "tor.txt")).isFile();
|
|
80437
|
+
} catch {
|
|
80438
|
+
carries = false;
|
|
80439
|
+
}
|
|
80440
|
+
if (!packaged || !carries) return "absent";
|
|
80441
|
+
const from = join24(root, platformKey());
|
|
80442
|
+
for (const file of packaged.files) {
|
|
80443
|
+
const source = join24(from, ...file.path.split("/"));
|
|
80444
|
+
let bytes2;
|
|
80445
|
+
try {
|
|
80446
|
+
bytes2 = plainPath(root, source) ? readFileSync(source) : void 0;
|
|
80447
|
+
} catch {
|
|
80448
|
+
bytes2 = void 0;
|
|
80449
|
+
}
|
|
80450
|
+
if (!bytes2 || bytes2.length !== file.bytes || createHash27("sha256").update(bytes2).digest("hex") !== file.sha256) {
|
|
80451
|
+
throw failure(`the Tor files of this install do not match the ones the wallet expects (${file.path}), so the wallet ran nothing. Install the wallet again, then ask again`, `the packaged Tor file ${file.path} does not match its pinned sha256 or size`);
|
|
80452
|
+
}
|
|
80453
|
+
const target = join24(unpacking, ...file.path.split("/"));
|
|
80454
|
+
mkdirSync(dirname20(target), { recursive: true });
|
|
80455
|
+
writeFileSync(target, bytes2, { mode: 448 });
|
|
80456
|
+
}
|
|
80457
|
+
return "copied";
|
|
80458
|
+
}
|
|
80459
|
+
async function downloadBundle(home, say, unpacking) {
|
|
80273
80460
|
const dir = managedTorDir(home);
|
|
80274
80461
|
const pinned = bundle();
|
|
80275
80462
|
const archive = join24(dir, `tor-expert-bundle-${TOR_EXPERT_BUNDLE}.tar.gz`);
|
|
80276
80463
|
const part = `${archive}.part`;
|
|
80277
|
-
say(`Getting Tor for the wallet (once, about ${pinned.mb} MB from the Tor Project, checked).`);
|
|
80464
|
+
say(`Getting Tor for the wallet (once, about ${pinned.mb} MB from the Tor Project, checked). This one download comes straight from the Tor Project: it sees this computer's IP address and that it gets Tor, nothing else. Every request after it goes through Tor.`);
|
|
80278
80465
|
let response;
|
|
80279
80466
|
try {
|
|
80280
80467
|
response = await fetch(pinned.url, { redirect: "error", signal: AbortSignal.timeout(DOWNLOAD_TIMEOUT_MS) });
|
|
@@ -80304,23 +80491,57 @@ async function installBundle(home, say) {
|
|
|
80304
80491
|
throw failure("the Tor download arrived damaged, so the wallet deleted it and ran nothing. Ask again", "the Tor download does not match its pinned sha256, so it was deleted and not run");
|
|
80305
80492
|
}
|
|
80306
80493
|
renameSync(part, archive);
|
|
80494
|
+
const tar = MAC ? "/usr/bin/tar" : LINUX ? existsSync("/usr/bin/tar") ? "/usr/bin/tar" : "/bin/tar" : join24(process.env.SystemRoot ?? "C:\\Windows", "System32", "tar.exe");
|
|
80495
|
+
const result = spawnSync3(tar, ["-xzf", archive, "-C", unpacking, ...LINUX ? ["--no-same-owner"] : []], { windowsHide: true, encoding: "utf8", timeout: 12e4 });
|
|
80496
|
+
rmSync(archive, { force: true });
|
|
80497
|
+
return result;
|
|
80498
|
+
}
|
|
80499
|
+
async function installBundle(home, say) {
|
|
80500
|
+
if (bundleComplete(home)) return;
|
|
80501
|
+
const dir = managedTorDir(home);
|
|
80502
|
+
const pinned = bundle();
|
|
80307
80503
|
const target = bundleDir(home);
|
|
80308
80504
|
const unpacking = `${target}.unpacking`;
|
|
80309
80505
|
rmSync(unpacking, { recursive: true, force: true });
|
|
80310
80506
|
rmSync(target, { recursive: true, force: true });
|
|
80311
80507
|
mkdirSync(unpacking, { recursive: true });
|
|
80312
|
-
|
|
80313
|
-
|
|
80314
|
-
|
|
80315
|
-
|
|
80508
|
+
let packaged;
|
|
80509
|
+
try {
|
|
80510
|
+
packaged = copyPackagedTor(unpacking);
|
|
80511
|
+
} catch (error) {
|
|
80316
80512
|
rmSync(unpacking, { recursive: true, force: true });
|
|
80317
|
-
throw
|
|
80318
|
-
|
|
80319
|
-
|
|
80320
|
-
);
|
|
80513
|
+
throw error;
|
|
80514
|
+
}
|
|
80515
|
+
if (packaged === "copied") {
|
|
80516
|
+
say("Preparing Tor for the wallet (once, from the files this install carries, checked).");
|
|
80517
|
+
} else {
|
|
80518
|
+
const result = await downloadBundle(home, say, unpacking);
|
|
80519
|
+
if (result.status !== 0 || !pinnedFiles().every((file) => existsSync(join24(unpacking, ...file.path.split("/"))))) {
|
|
80520
|
+
rmSync(unpacking, { recursive: true, force: true });
|
|
80521
|
+
throw failure(
|
|
80522
|
+
`the Tor download did not unpack whole (${result.status !== 0 ? `the unpack ended with code ${result.status ?? "none"}` : "files were missing after the unpack"}; the folder: ${dir}). Ask again; if this stays, check whether a security program removes files there`,
|
|
80523
|
+
`the Tor download could not be unpacked (${String(result.stderr || result.error?.message || `exit ${result.status}`).trim().slice(0, 160)})`
|
|
80524
|
+
);
|
|
80525
|
+
}
|
|
80526
|
+
}
|
|
80527
|
+
if (!torFilesIntact(unpacking, pinnedFiles())) {
|
|
80528
|
+
rmSync(unpacking, { recursive: true, force: true });
|
|
80529
|
+
throw failure(`the Tor files did not match the ones the wallet expects, so the wallet deleted them and ran nothing (the folder: ${dir}). ` + (packaged === "copied" ? "Install the wallet again, then ask again" : "Ask again"), "the Tor files do not match their pinned sha256 or size");
|
|
80321
80530
|
}
|
|
80322
80531
|
if (MAC) {
|
|
80323
|
-
|
|
80532
|
+
let unsigned = signMacTor(unpacking);
|
|
80533
|
+
if (!unsigned) {
|
|
80534
|
+
const signed = Object.fromEntries(pinnedFiles().map((file) => [file.path, plainFileHash(unpacking, file.path)]));
|
|
80535
|
+
if (Object.values(signed).some((seen) => seen === void 0)) unsigned = "a signed file could not be read";
|
|
80536
|
+
else {
|
|
80537
|
+
try {
|
|
80538
|
+
writeFileSync(join24(unpacking, SIGNED_HASHES), `${JSON.stringify(signed)}
|
|
80539
|
+
`, { mode: 384 });
|
|
80540
|
+
} catch (error) {
|
|
80541
|
+
unsigned = `the signed hashes could not be written (${error?.code ?? error?.message ?? error})`;
|
|
80542
|
+
}
|
|
80543
|
+
}
|
|
80544
|
+
}
|
|
80324
80545
|
if (unsigned) {
|
|
80325
80546
|
rmSync(unpacking, { recursive: true, force: true });
|
|
80326
80547
|
throw failure(
|
|
@@ -80330,23 +80551,16 @@ async function installBundle(home, say) {
|
|
|
80330
80551
|
}
|
|
80331
80552
|
}
|
|
80332
80553
|
if (LINUX) {
|
|
80333
|
-
|
|
80334
|
-
if (!refused2) {
|
|
80335
|
-
try {
|
|
80336
|
-
writeLinuxHashes(unpacking);
|
|
80337
|
-
} catch (error) {
|
|
80338
|
-
refused2 = `the hash list could not be written (${error?.code ?? error?.message ?? error})`;
|
|
80339
|
-
}
|
|
80340
|
-
}
|
|
80554
|
+
const refused2 = prepareLinuxTor(unpacking);
|
|
80341
80555
|
if (refused2) {
|
|
80342
80556
|
rmSync(unpacking, { recursive: true, force: true });
|
|
80343
80557
|
throw failure(
|
|
80344
|
-
`the Tor
|
|
80558
|
+
`the Tor files did not unpack as expected, so the wallet deleted them and ran nothing (the folder: ${dir}). Ask again`,
|
|
80345
80559
|
`the Tor files were refused (${refused2})`
|
|
80346
80560
|
);
|
|
80347
80561
|
}
|
|
80348
80562
|
}
|
|
80349
|
-
writeFileSync(join24(unpacking, COMPLETE), `${pinned.sha256}
|
|
80563
|
+
writeFileSync(join24(unpacking, COMPLETE), `${pinned.sha256}${packaged === "copied" ? " packaged" : ""}
|
|
80350
80564
|
`);
|
|
80351
80565
|
renameSync(unpacking, target);
|
|
80352
80566
|
}
|