shinjuku-shield 0.3.216 → 0.3.217
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 +4 -4
- package/manifest.json +6 -6
- package/package.json +3 -3
- package/shinjuku-seller.mjs +107 -81
- package/shinjuku-wallet.mjs +542 -358
package/README.md
CHANGED
|
@@ -5,12 +5,12 @@ web services and AI answers from your private balance, so the payment does
|
|
|
5
5
|
not show who paid. It works inside your AI app (Claude, Cursor, Codex) and in
|
|
6
6
|
a terminal. Only you hold the keys: they never leave your computer.
|
|
7
7
|
|
|
8
|
-
This is version 0.3.
|
|
8
|
+
This is version 0.3.217. The command is `shinjuku`.
|
|
9
9
|
|
|
10
10
|
## Set up
|
|
11
11
|
|
|
12
12
|
```sh
|
|
13
|
-
npx -y shinjuku@0.3.
|
|
13
|
+
npx -y shinjuku@0.3.217 setup
|
|
14
14
|
```
|
|
15
15
|
|
|
16
16
|
Setup does every step for you:
|
|
@@ -100,7 +100,7 @@ Add it yourself. The name of the wallet in your app is `shinjuku`.
|
|
|
100
100
|
Claude Code:
|
|
101
101
|
|
|
102
102
|
```sh
|
|
103
|
-
claude mcp add --scope user shinjuku -- npx -y --no-audit --no-fund shinjuku-shield@0.3.
|
|
103
|
+
claude mcp add --scope user shinjuku -- npx -y --no-audit --no-fund shinjuku-shield@0.3.217 mcp
|
|
104
104
|
```
|
|
105
105
|
|
|
106
106
|
## For builders: check what you install
|
|
@@ -116,7 +116,7 @@ with the Releases table in
|
|
|
116
116
|
Versions are published from GitHub Actions with npm provenance.
|
|
117
117
|
|
|
118
118
|
`shinjuku-shield` is the package that holds the wallet. `shinjuku-shielded`
|
|
119
|
-
0.3.
|
|
119
|
+
0.3.217, its older name, runs this package at the same version, so wallets
|
|
120
120
|
installed under that name keep updating. New installs use `shinjuku`.
|
|
121
121
|
|
|
122
122
|
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": "808517662304749b5963afa0417a3bc175db75431d3793f73e64378abf7b3f13",
|
|
5
|
+
"bytes": 10206582,
|
|
6
|
+
"sourceCommit": "36b341433b3e8325221dbb7d23a3d84e280dee21",
|
|
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": "231d4d87879c0f949b345db341c345a688c866b04eab794082b454ffed4c602d",
|
|
1079
|
+
"bytes": 4168434,
|
|
1080
1080
|
"entry": "wallet/src/seller/exact/index.mjs",
|
|
1081
1081
|
"external": [
|
|
1082
1082
|
"@x402/core/http",
|
|
@@ -1968,5 +1968,5 @@
|
|
|
1968
1968
|
}
|
|
1969
1969
|
]
|
|
1970
1970
|
},
|
|
1971
|
-
"publishedAt": "2026-11-
|
|
1971
|
+
"publishedAt": "2026-11-11T20:03:14.131Z"
|
|
1972
1972
|
}
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "shinjuku-shield",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.217",
|
|
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": "80851766",
|
|
7
|
+
"shinjukuSha256": "808517662304749b5963afa0417a3bc175db75431d3793f73e64378abf7b3f13",
|
|
8
8
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
9
9
|
"author": "Shinjuku Shield",
|
|
10
10
|
"homepage": "https://github.com/ShinjukuStaition/shinjuku-shield#readme",
|
package/shinjuku-seller.mjs
CHANGED
|
@@ -59625,25 +59625,29 @@ async function readPages(history, pool2, needed, first, { wakeSlot, pages, signa
|
|
|
59625
59625
|
syncedSlot = Math.max(syncedSlot ?? 0, result.syncedSlot);
|
|
59626
59626
|
records.push(...result.records);
|
|
59627
59627
|
if (result.total < needed) {
|
|
59628
|
-
|
|
59629
|
-
Promise.resolve().then(() => history._rpcRequest("getP03Transitions", [pool2, {
|
|
59630
|
-
commitment: "finalized",
|
|
59631
|
-
fromOrdinal: 0,
|
|
59632
|
-
toOrdinal: 1,
|
|
59633
|
-
minContextSlot: wakeSlot
|
|
59634
|
-
}])).catch(() => {
|
|
59635
|
-
});
|
|
59636
|
-
markPhase("compact-behind-wake");
|
|
59637
|
-
}
|
|
59628
|
+
wakeBehindSource(history, pool2, wakeSlot);
|
|
59638
59629
|
throw refuse2("p03_compact_history_source_behind");
|
|
59639
59630
|
}
|
|
59640
59631
|
}
|
|
59641
59632
|
} catch (error) {
|
|
59642
|
-
|
|
59633
|
+
if (error?.compactHistoryRefusal !== "p03_compact_history_source_behind") {
|
|
59634
|
+
for (const handle of pages?.values() ?? []) handle.release();
|
|
59635
|
+
}
|
|
59643
59636
|
throw error;
|
|
59644
59637
|
}
|
|
59645
59638
|
return { records: records.slice(0, needed), imports, initialization, syncedSlot };
|
|
59646
59639
|
}
|
|
59640
|
+
function wakeBehindSource(history, pool2, wakeSlot) {
|
|
59641
|
+
if (!isIndex(wakeSlot)) return;
|
|
59642
|
+
Promise.resolve().then(() => history._rpcRequest("getP03Transitions", [pool2, {
|
|
59643
|
+
commitment: "finalized",
|
|
59644
|
+
fromOrdinal: 0,
|
|
59645
|
+
toOrdinal: 1,
|
|
59646
|
+
minContextSlot: wakeSlot
|
|
59647
|
+
}])).catch(() => {
|
|
59648
|
+
});
|
|
59649
|
+
markPhase("compact-behind-wake");
|
|
59650
|
+
}
|
|
59647
59651
|
function startCompactPoolSnapshot({ connection, programId, pool: pool2 }) {
|
|
59648
59652
|
const own = withBoundedOwnReads(connection);
|
|
59649
59653
|
const program = new import_web398.PublicKey(programId);
|
|
@@ -60305,6 +60309,11 @@ async function readCompactP03HistoryNow({
|
|
|
60305
60309
|
return readServedPages(zero);
|
|
60306
60310
|
}
|
|
60307
60311
|
const combined = combineCompactTail(cachedRecords, await tailRead, { pool: poolString, from, count: count2, size: sent.tailSize });
|
|
60312
|
+
if (combined.miss === "behind") {
|
|
60313
|
+
markPhase("compact-tail-miss-behind");
|
|
60314
|
+
wakeBehindSource(source, poolString, snapshot.slot);
|
|
60315
|
+
throw refuse2("p03_compact_history_source_behind");
|
|
60316
|
+
}
|
|
60308
60317
|
if (combined.miss !== void 0) {
|
|
60309
60318
|
markPhase(`compact-tail-miss-${combined.miss}`);
|
|
60310
60319
|
return readServedPages(zero);
|
|
@@ -69953,8 +69962,23 @@ var init_files = __esm({
|
|
|
69953
69962
|
}
|
|
69954
69963
|
});
|
|
69955
69964
|
|
|
69965
|
+
// wallet/src/seller/seedKeys.mjs
|
|
69966
|
+
import { join as join19 } from "node:path";
|
|
69967
|
+
var SELLER_FOLDER, SELLER_ATTESTATION_FILE, SELLER_STORE_KEY_FILE, SELLER_ETA_FILE, holdsSeller;
|
|
69968
|
+
var init_seedKeys = __esm({
|
|
69969
|
+
"wallet/src/seller/seedKeys.mjs"() {
|
|
69970
|
+
"use strict";
|
|
69971
|
+
init_fs();
|
|
69972
|
+
SELLER_FOLDER = "seller";
|
|
69973
|
+
SELLER_ATTESTATION_FILE = "attestation.key";
|
|
69974
|
+
SELLER_STORE_KEY_FILE = "store.key";
|
|
69975
|
+
SELLER_ETA_FILE = "eta.txt";
|
|
69976
|
+
holdsSeller = (home) => existsSync(join19(home, SELLER_FOLDER, SELLER_ETA_FILE));
|
|
69977
|
+
}
|
|
69978
|
+
});
|
|
69979
|
+
|
|
69956
69980
|
// wallet/src/balance/balance.mjs
|
|
69957
|
-
import { dirname as dirname17, join as
|
|
69981
|
+
import { dirname as dirname17, join as join20 } from "node:path";
|
|
69958
69982
|
function snapshotFile(store) {
|
|
69959
69983
|
const file = sealedCacheFile(store, { file: BALANCE_SNAPSHOT_FILE, schema: BALANCE_SNAPSHOT_SCHEMA, keyLabel: SNAPSHOT_KEY_LABEL });
|
|
69960
69984
|
if (!file) throw new Error("balance_snapshot_seed_invalid");
|
|
@@ -70216,7 +70240,7 @@ function computeBalance({ store, snapshotRead, source = "local", now = Date.now(
|
|
|
70216
70240
|
if (!couldHoldValue && !state2.restoredFromRecoveryText && !snapshotRead?.unreadable) {
|
|
70217
70241
|
const proved = pendingDeposits.find((entry) => entry.state === "proved");
|
|
70218
70242
|
const awaiting = pendingDeposits.find((entry) => entry.state === "awaiting_funds");
|
|
70219
|
-
if (records.every(planOnly) && !(store.path && sellsOnSalePath(store.path))) {
|
|
70243
|
+
if (records.every(planOnly) && !(store.path && (sellsOnSalePath(store.path) || holdsSeller(dirname17(dirname17(store.path)))))) {
|
|
70220
70244
|
Object.assign(detail, { unspentAtomic: "0", reservedAtomic: "0", balanceSource: "new_wallet_nothing_received" });
|
|
70221
70245
|
return report(
|
|
70222
70246
|
"empty",
|
|
@@ -70279,18 +70303,18 @@ It asks the amount, then gives a one-time address and its QR code: send USDC to
|
|
|
70279
70303
|
const noteSettling = (name) => {
|
|
70280
70304
|
if (settlingRecent) return;
|
|
70281
70305
|
try {
|
|
70282
|
-
settlingRecent = store.walDirectory === void 0 || now - statSync(
|
|
70306
|
+
settlingRecent = store.walDirectory === void 0 || now - statSync(join20(store.walDirectory, `${name}.json`)).mtimeMs < PAYMENT_SETTLING_MS;
|
|
70283
70307
|
} catch {
|
|
70284
70308
|
settlingRecent = true;
|
|
70285
70309
|
}
|
|
70286
70310
|
};
|
|
70287
70311
|
const settlingPayment = (entry) => {
|
|
70288
70312
|
if (entry.type !== "payment" || String(entry.record.url ?? "").includes(POOL_MOVE_PATH)) return void 0;
|
|
70289
|
-
const
|
|
70290
|
-
if (!
|
|
70313
|
+
const join27 = joinedAccountOf(entry, byName) !== void 0;
|
|
70314
|
+
if (!join27 && String(entry.record.url ?? "").startsWith(SELF_PAY_ORIGIN)) return void 0;
|
|
70291
70315
|
const inputs = provenInputs(byName.get(`resource-proof-${entry.name.slice("resource-payment-".length)}`)?.record);
|
|
70292
|
-
const amount =
|
|
70293
|
-
return inputs !== void 0 && amount !== void 0 && inputs.every((commitment) => unspent.has(commitment)) ? { inputs, amountAtomic: BigInt(amount), join:
|
|
70316
|
+
const amount = join27 ? "0" : paymentAmount(entry.record);
|
|
70317
|
+
return inputs !== void 0 && amount !== void 0 && inputs.every((commitment) => unspent.has(commitment)) ? { inputs, amountAtomic: BigInt(amount), join: join27 } : void 0;
|
|
70294
70318
|
};
|
|
70295
70319
|
const spentInSnapshot = new Set(snapshot.outputs.filter((output2) => output2.spendStatus === "spent").map((output2) => output2.commitment));
|
|
70296
70320
|
const heldByWalk = (entry) => {
|
|
@@ -70317,9 +70341,9 @@ It asks the amount, then gives a one-time address and its QR code: send USDC to
|
|
|
70317
70341
|
const before = Object.hasOwn(snapshot.walStates, entry.name) ? snapshot.walStates[entry.name] : void 0;
|
|
70318
70342
|
const beforePhase = before === void 0 ? "absent" : entry.type === "payment-proof" ? entry.phase : classify(entry.name, { ...entry.record, state: before }).phase;
|
|
70319
70343
|
if (entry.type === "unshield" && before !== entry.state && joinedAccountOf(entry, byName) !== void 0) continue;
|
|
70320
|
-
const
|
|
70344
|
+
const join27 = entry.type === "payment" && joinedAccountOf(entry, byName) !== void 0;
|
|
70321
70345
|
if (entry.phase === "done" && beforePhase !== "done") {
|
|
70322
|
-
if (
|
|
70346
|
+
if (join27 && snapshotDigests.has(digestKey(entry.record.memoDigest))) continue;
|
|
70323
70347
|
const answeredExit = ["unshield", "note-exit"].includes(entry.type) ? answeredExits.get(String(entry.record.noteCommitment)) : void 0;
|
|
70324
70348
|
if (answeredExit !== void 0) {
|
|
70325
70349
|
const note = String(entry.record.noteCommitment);
|
|
@@ -70350,7 +70374,7 @@ It asks the amount, then gives a one-time address and its QR code: send USDC to
|
|
|
70350
70374
|
(entry.record.memoFault === void 0 ? depositsComing : depositsRecordFault).push({ depositId: entry.record.depositId, amountAtomic: entry.record.amountAtomic });
|
|
70351
70375
|
continue;
|
|
70352
70376
|
}
|
|
70353
|
-
const answered = entry.type === "payment" && (
|
|
70377
|
+
const answered = entry.type === "payment" && (join27 || ["pending", "confirmed"].includes(entry.record.receiptFinality));
|
|
70354
70378
|
const paying = answered ? settlingPayment(entry) : void 0;
|
|
70355
70379
|
if (paying) {
|
|
70356
70380
|
settling.push(paying);
|
|
@@ -70565,6 +70589,7 @@ var init_balance = __esm({
|
|
|
70565
70589
|
init_book2();
|
|
70566
70590
|
init_files();
|
|
70567
70591
|
init_config();
|
|
70592
|
+
init_seedKeys();
|
|
70568
70593
|
init_commandName();
|
|
70569
70594
|
init_requestId();
|
|
70570
70595
|
init_floatPay();
|
|
@@ -75174,11 +75199,11 @@ var init_verify_production_parameter_bundle2 = __esm({
|
|
|
75174
75199
|
|
|
75175
75200
|
// spikes/shielded-x402-solana/scripts/production-proof-bundle.mjs
|
|
75176
75201
|
import { homedir as homedir3 } from "node:os";
|
|
75177
|
-
import { join as
|
|
75202
|
+
import { join as join21, resolve as resolve14 } from "node:path";
|
|
75178
75203
|
import { createHmac as createHmac11, randomBytes as randomBytes16, timingSafeEqual as timingSafeEqual3 } from "node:crypto";
|
|
75179
75204
|
function machineParamsCheckDir2({ env = process.env, platform = process.platform, home = homedir3() } = {}) {
|
|
75180
|
-
const base = platform === "win32" ? env.LOCALAPPDATA ||
|
|
75181
|
-
return
|
|
75205
|
+
const base = platform === "win32" ? env.LOCALAPPDATA || join21(home, "AppData", "Local") : platform === "darwin" ? join21(home, "Library", "Caches") : env.XDG_CACHE_HOME && env.XDG_CACHE_HOME.startsWith("/") ? env.XDG_CACHE_HOME : join21(home, ".cache");
|
|
75206
|
+
return join21(base, "shinjuku-shield", "params-checked");
|
|
75182
75207
|
}
|
|
75183
75208
|
function machineKey2(recordDir, { create }) {
|
|
75184
75209
|
const path = resolve14(recordDir, MACHINE_KEY_FILE2);
|
|
@@ -75350,7 +75375,7 @@ var init_production_proof_bundle2 = __esm({
|
|
|
75350
75375
|
// spikes/shielded-x402-wallet/lib/p03-recovered-exit.mjs
|
|
75351
75376
|
import { spawn as spawn2 } from "node:child_process";
|
|
75352
75377
|
import { createHash as createHash25 } from "node:crypto";
|
|
75353
|
-
import { dirname as dirname19, isAbsolute as isAbsolute6, join as
|
|
75378
|
+
import { dirname as dirname19, isAbsolute as isAbsolute6, join as join22, relative as relative7, resolve as resolve15 } from "node:path";
|
|
75354
75379
|
import { tmpdir as tmpdir3 } from "node:os";
|
|
75355
75380
|
function fail18(reason) {
|
|
75356
75381
|
throw new Error(`p03_recovered_exit_${reason}`);
|
|
@@ -75641,11 +75666,11 @@ function proveRecoveredP03Exit({ request, tools }) {
|
|
|
75641
75666
|
return proveLoadedExit({ request, tools, kind, primaryProver, bundle: bundle2 });
|
|
75642
75667
|
}
|
|
75643
75668
|
async function proveLoadedExit({ request, tools, kind, primaryProver, bundle: bundle2 }) {
|
|
75644
|
-
const scratch = mkdtempSync(
|
|
75669
|
+
const scratch = mkdtempSync(join22(tmpdir3(), kind.scratchPrefix));
|
|
75645
75670
|
try {
|
|
75646
|
-
const vectors =
|
|
75647
|
-
const primaryProofs =
|
|
75648
|
-
const appendProofs =
|
|
75671
|
+
const vectors = join22(scratch, "vectors");
|
|
75672
|
+
const primaryProofs = join22(scratch, "primary-proof");
|
|
75673
|
+
const appendProofs = join22(scratch, "append-proof");
|
|
75649
75674
|
mkdirSync(vectors, { recursive: true, mode: 448 });
|
|
75650
75675
|
mkdirSync(primaryProofs, { recursive: true, mode: 448 });
|
|
75651
75676
|
mkdirSync(appendProofs, { recursive: true, mode: 448 });
|
|
@@ -75663,10 +75688,10 @@ async function proveLoadedExit({ request, tools, kind, primaryProver, bundle: bu
|
|
|
75663
75688
|
if (output2?.schema !== "carbon-shielded-x402/p03-recovered-exit-witness/v1" || output2.relation !== request.exitKind || output2.ownerRole !== kind.ownerRole) {
|
|
75664
75689
|
fail18("witness_output_invalid");
|
|
75665
75690
|
}
|
|
75666
|
-
const primaryVector =
|
|
75691
|
+
const primaryVector = join22(vectors, kind.vectorName);
|
|
75667
75692
|
const appendVector = oneItemAppendVector(
|
|
75668
|
-
|
|
75669
|
-
|
|
75693
|
+
join22(vectors, "tree-append-v1.json"),
|
|
75694
|
+
join22(vectors, "tree-append-sequence.json")
|
|
75670
75695
|
);
|
|
75671
75696
|
try {
|
|
75672
75697
|
await runTool2(primaryProver, [kind.command], {
|
|
@@ -75688,8 +75713,8 @@ async function proveLoadedExit({ request, tools, kind, primaryProver, bundle: bu
|
|
|
75688
75713
|
} catch (error) {
|
|
75689
75714
|
throw new Error("p03_recovered_exit_append_prover_phase_failed", { cause: error });
|
|
75690
75715
|
}
|
|
75691
|
-
const primary = JSON.parse(readFileSync(
|
|
75692
|
-
const append = JSON.parse(readFileSync(
|
|
75716
|
+
const primary = JSON.parse(readFileSync(join22(primaryProofs, kind.proofName), "utf8"));
|
|
75717
|
+
const append = JSON.parse(readFileSync(join22(appendProofs, "tree-append-v1-deposit.json"), "utf8"));
|
|
75693
75718
|
if (JSON.stringify(primary.publicInputBytesHex) !== JSON.stringify(output2.primaryWitness.publicInputBytesHex) || JSON.stringify(append.publicInputBytesHex) !== JSON.stringify(output2.treeAppendWitness.publicInputBytesHex)) {
|
|
75694
75719
|
fail18("proof_public_inputs_mismatch");
|
|
75695
75720
|
}
|
|
@@ -75750,7 +75775,7 @@ var init_p03_recovered_exit = __esm({
|
|
|
75750
75775
|
|
|
75751
75776
|
// spikes/shielded-x402-wallet/bin/shielded-wallet.mjs
|
|
75752
75777
|
import { createHash as createHash26 } from "node:crypto";
|
|
75753
|
-
import { join as
|
|
75778
|
+
import { join as join23, resolve as resolve16 } from "node:path";
|
|
75754
75779
|
import { fileURLToPath as fileURLToPath8 } from "node:url";
|
|
75755
75780
|
import {
|
|
75756
75781
|
decodePaymentRequiredHeader as decodePaymentRequiredHeader3,
|
|
@@ -75762,7 +75787,7 @@ function walletHome() {
|
|
|
75762
75787
|
return setupHome(process.env);
|
|
75763
75788
|
}
|
|
75764
75789
|
function walletPath(pool2) {
|
|
75765
|
-
return
|
|
75790
|
+
return join23(walletHome(), pool2, "wallet.json");
|
|
75766
75791
|
}
|
|
75767
75792
|
function initialWalletState({ pool: pool2, network, asset, decimals, binding, config, keys: keys3, memoStart }) {
|
|
75768
75793
|
const seedHex = keys3?.seedHex ?? Buffer.from(generateSeed()).toString("hex");
|
|
@@ -75820,16 +75845,16 @@ function readCallerJson(path, code) {
|
|
|
75820
75845
|
}
|
|
75821
75846
|
function loadProfileDirectory(profileDir) {
|
|
75822
75847
|
const directory = resolve16(profileDir);
|
|
75823
|
-
const profile = readCallerJson(
|
|
75824
|
-
const vector = readCallerJson(
|
|
75848
|
+
const profile = readCallerJson(join23(directory, "profile.json"), "profile_json_invalid");
|
|
75849
|
+
const vector = readCallerJson(join23(directory, "rust-vectors.json"), "profile_vectors_json_invalid");
|
|
75825
75850
|
const production = profile.schema === "carbon-shielded-exact/svm-mainnet-bounded-alpha-profile/v4";
|
|
75826
|
-
const artifactDir =
|
|
75851
|
+
const artifactDir = join23(directory, production ? "proofs" : "artifacts");
|
|
75827
75852
|
return { directory, profile, vector, production, artifactDir };
|
|
75828
75853
|
}
|
|
75829
75854
|
function pinnedGenerator3(profileVector) {
|
|
75830
75855
|
if (profileVector?.payerKeys?.generator) return profileVector.payerKeys.generator;
|
|
75831
75856
|
const committed = JSON.parse(readFileSync(
|
|
75832
|
-
|
|
75857
|
+
join23(MODEL_DIR3, "vectors", "rust-vectors.json"),
|
|
75833
75858
|
"utf8"
|
|
75834
75859
|
));
|
|
75835
75860
|
return committed.payerKeys.generator;
|
|
@@ -75989,7 +76014,7 @@ function proveFromProfile({ binding, profileDir }) {
|
|
|
75989
76014
|
const proved = provePayment({
|
|
75990
76015
|
binding,
|
|
75991
76016
|
modelDir: MODEL_DIR3,
|
|
75992
|
-
vectorPath:
|
|
76017
|
+
vectorPath: join23(resolve16(profileDir), "rust-vectors.json"),
|
|
75993
76018
|
artifactDir,
|
|
75994
76019
|
production: production ? {
|
|
75995
76020
|
parameterPathByRelation: profile.parameterBundle?.parameterPathByRelation,
|
|
@@ -77287,7 +77312,7 @@ async function main(argv = process.argv.slice(2)) {
|
|
|
77287
77312
|
case "backup-verify": {
|
|
77288
77313
|
const pool2 = flag(args, "--pool") ?? requiredPoolFromHome();
|
|
77289
77314
|
const backupDir = flag(args, "--backup-dir");
|
|
77290
|
-
const path = backupDir ?
|
|
77315
|
+
const path = backupDir ? join23(backupDir, "wallet.json") : walletPath(pool2);
|
|
77291
77316
|
const store = openWalletStore(path, passphrase());
|
|
77292
77317
|
if (store.state.pool !== pool2) throw new Error("backup-verify pool does not match wallet");
|
|
77293
77318
|
const bundle2 = backupDir ? verifyWalletRecoveryBundle(backupDir, passphrase()) : void 0;
|
|
@@ -77457,7 +77482,7 @@ async function runValueMove(command, args) {
|
|
|
77457
77482
|
const vault = vaultAddress(programId, pool2, mint);
|
|
77458
77483
|
const poolState2 = await readPoolState(connection, pool2);
|
|
77459
77484
|
if (!poolState2) throw new Error("pool account not found");
|
|
77460
|
-
const readProof = (name) => JSON.parse(readFileSync(
|
|
77485
|
+
const readProof = (name) => JSON.parse(readFileSync(join23(artifactDir, name), "utf8"));
|
|
77461
77486
|
if (command === "deposit") {
|
|
77462
77487
|
const proofName = production ? "deposit-v1.json" : "UNSAFE_TEST_ONLY-deposit-v1-proof.json";
|
|
77463
77488
|
const appendName2 = production ? "tree-append-v1-deposit.json" : "UNSAFE_TEST_ONLY-tree-append-v1-deposit-proof.json";
|
|
@@ -78291,6 +78316,7 @@ var init_backup = __esm({
|
|
|
78291
78316
|
"use strict";
|
|
78292
78317
|
init_fs();
|
|
78293
78318
|
init_config();
|
|
78319
|
+
init_seedKeys();
|
|
78294
78320
|
}
|
|
78295
78321
|
});
|
|
78296
78322
|
|
|
@@ -78446,7 +78472,7 @@ var init_v1Adapter = __esm({
|
|
|
78446
78472
|
// wallet/src/seller/exact/index.mjs
|
|
78447
78473
|
init_config();
|
|
78448
78474
|
import { homedir as homedir4 } from "node:os";
|
|
78449
|
-
import { join as
|
|
78475
|
+
import { join as join26 } from "node:path";
|
|
78450
78476
|
|
|
78451
78477
|
// wallet/src/setup/setup.mjs
|
|
78452
78478
|
init_processLease();
|
|
@@ -79071,7 +79097,6 @@ function assertSaleFeePayer(requirement, saleReceive) {
|
|
|
79071
79097
|
init_fs();
|
|
79072
79098
|
import http2 from "node:http";
|
|
79073
79099
|
import { createHash as createHash28, randomBytes as randomBytes18 } from "node:crypto";
|
|
79074
|
-
import { join as join24, resolve as resolve17 } from "node:path";
|
|
79075
79100
|
init_config2();
|
|
79076
79101
|
init_amounts();
|
|
79077
79102
|
init_recoveryFile();
|
|
@@ -79080,6 +79105,7 @@ init_config();
|
|
|
79080
79105
|
init_commandName();
|
|
79081
79106
|
init_rpcDefault();
|
|
79082
79107
|
init_proxy();
|
|
79108
|
+
import { join as join25, resolve as resolve17 } from "node:path";
|
|
79083
79109
|
|
|
79084
79110
|
// wallet/src/net/managedTor.mjs
|
|
79085
79111
|
init_fs();
|
|
@@ -79094,7 +79120,7 @@ init_timing();
|
|
|
79094
79120
|
import { spawn as spawn3, spawnSync as spawnSync3 } from "node:child_process";
|
|
79095
79121
|
import { createHash as createHash27, createHmac as createHmac12, randomBytes as randomBytes17, timingSafeEqual as timingSafeEqual4 } from "node:crypto";
|
|
79096
79122
|
import net3 from "node:net";
|
|
79097
|
-
import { basename as basename6, dirname as dirname20, join as
|
|
79123
|
+
import { basename as basename6, dirname as dirname20, join as join24 } from "node:path";
|
|
79098
79124
|
import { Readable } from "node:stream";
|
|
79099
79125
|
import { pipeline } from "node:stream/promises";
|
|
79100
79126
|
var ownTorPlatform = (platform = process.platform, arch = process.arch) => platform === "win32" || platform === "darwin" || platform === "linux" && arch === "x64";
|
|
@@ -79102,15 +79128,15 @@ var MAC = process.platform === "darwin";
|
|
|
79102
79128
|
var LINUX = process.platform === "linux";
|
|
79103
79129
|
var SYSTEM2 = MAC ? "macOS" : LINUX ? "Linux" : "Windows";
|
|
79104
79130
|
var bundle = () => TOR_EXPERT_BUNDLES[MAC ? `darwin-${macChipArch()}` : LINUX ? "linux-x64" : "win32-x64"];
|
|
79105
|
-
var managedTorDir = (home) =>
|
|
79106
|
-
var stateFile = (home) =>
|
|
79107
|
-
var bundleDir = (home) =>
|
|
79108
|
-
var torExe = (home) =>
|
|
79131
|
+
var managedTorDir = (home) => join24(home, "tor");
|
|
79132
|
+
var stateFile = (home) => join24(managedTorDir(home), "managed.json");
|
|
79133
|
+
var bundleDir = (home) => join24(managedTorDir(home), `expert-bundle-${TOR_EXPERT_BUNDLE}`);
|
|
79134
|
+
var torExe = (home) => join24(bundleDir(home), "tor", MAC || LINUX ? "tor" : "tor.exe");
|
|
79109
79135
|
var MAC_SIGNED = [["tor", "libevent-2.1.7.dylib"], ["tor", "tor"]];
|
|
79110
79136
|
var COMPLETE = ".complete";
|
|
79111
79137
|
var LINUX_TOR = [["tor", "tor"], ["tor", "libevent-2.1.so.7"], ["tor", "libssl.so.3"], ["tor", "libcrypto.so.3"]];
|
|
79112
79138
|
var BUNDLE_FILES = MAC ? [...MAC_SIGNED, ["data", "geoip"], ["data", "geoip6"]] : LINUX ? [...LINUX_TOR, ["data", "geoip"], ["data", "geoip6"]] : [["tor", "tor.exe"], ["data", "geoip"], ["data", "geoip6"]];
|
|
79113
|
-
var logFile = (home) =>
|
|
79139
|
+
var logFile = (home) => join24(managedTorDir(home), "notice.log");
|
|
79114
79140
|
var BOOTSTRAP_STALL_MS = 6e4;
|
|
79115
79141
|
var BOOTSTRAP_MAX_MS = 3e5;
|
|
79116
79142
|
var STALL_RESTART_PERCENT = 50;
|
|
@@ -79374,7 +79400,7 @@ function portClosed(port) {
|
|
|
79374
79400
|
socket.once("error", (error) => done(error?.code === "ECONNREFUSED"));
|
|
79375
79401
|
});
|
|
79376
79402
|
}
|
|
79377
|
-
var cookieFile = (home) =>
|
|
79403
|
+
var cookieFile = (home) => join24(managedTorDir(home), "control.cookie");
|
|
79378
79404
|
var CONTROL_TIMEOUT_MS = 3e3;
|
|
79379
79405
|
var SERVER_KEY = "Tor safe cookie authentication server-to-controller hash";
|
|
79380
79406
|
var CLIENT_KEY = "Tor safe cookie authentication controller-to-server hash";
|
|
@@ -79578,25 +79604,25 @@ async function takeLock(home, say, deadline) {
|
|
|
79578
79604
|
clearTimeout(timer);
|
|
79579
79605
|
}
|
|
79580
79606
|
}
|
|
79581
|
-
var bundleComplete = (home) => existsSync(
|
|
79607
|
+
var bundleComplete = (home) => existsSync(join24(bundleDir(home), COMPLETE)) && BUNDLE_FILES.every((parts) => existsSync(join24(bundleDir(home), ...parts))) && (!LINUX || linuxTorIntact(bundleDir(home)));
|
|
79582
79608
|
var LINUX_HASHES = ".hashes.json";
|
|
79583
79609
|
var fileSha256 = (path) => createHash27("sha256").update(readFileSync(path)).digest("hex");
|
|
79584
79610
|
function writeLinuxHashes(dir) {
|
|
79585
|
-
const list = Object.fromEntries(LINUX_TOR.map((parts) => [parts.join("/"), fileSha256(
|
|
79586
|
-
writeFileSync(
|
|
79611
|
+
const list = Object.fromEntries(LINUX_TOR.map((parts) => [parts.join("/"), fileSha256(join24(dir, ...parts))]));
|
|
79612
|
+
writeFileSync(join24(dir, LINUX_HASHES), `${JSON.stringify(list)}
|
|
79587
79613
|
`, { mode: 384 });
|
|
79588
79614
|
}
|
|
79589
79615
|
function linuxTorIntact(dir) {
|
|
79590
79616
|
try {
|
|
79591
|
-
const list = JSON.parse(readFileSync(
|
|
79592
|
-
return LINUX_TOR.every((parts) => typeof list?.[parts.join("/")] === "string" && list[parts.join("/")] === fileSha256(
|
|
79617
|
+
const list = JSON.parse(readFileSync(join24(dir, LINUX_HASHES), "utf8"));
|
|
79618
|
+
return LINUX_TOR.every((parts) => typeof list?.[parts.join("/")] === "string" && list[parts.join("/")] === fileSha256(join24(dir, ...parts)));
|
|
79593
79619
|
} catch {
|
|
79594
79620
|
return false;
|
|
79595
79621
|
}
|
|
79596
79622
|
}
|
|
79597
79623
|
function signMacTor(unpacking) {
|
|
79598
79624
|
for (const parts of MAC_SIGNED) {
|
|
79599
|
-
const file =
|
|
79625
|
+
const file = join24(unpacking, ...parts);
|
|
79600
79626
|
for (const args of [["--force", "--sign", "-", file], ["--verify", file]]) {
|
|
79601
79627
|
const result = spawnSync3("/usr/bin/codesign", args, { encoding: "utf8", timeout: 6e4 });
|
|
79602
79628
|
if (result.status !== 0) return `codesign ${args[0]} ${parts.join("/")}: ${String(result.stderr || result.error?.message || `exit ${result.status}`).trim().slice(0, 160)}`;
|
|
@@ -79605,10 +79631,10 @@ function signMacTor(unpacking) {
|
|
|
79605
79631
|
return void 0;
|
|
79606
79632
|
}
|
|
79607
79633
|
function prepareLinuxTor(unpacking) {
|
|
79608
|
-
const exe =
|
|
79634
|
+
const exe = join24(unpacking, "tor", "tor");
|
|
79609
79635
|
const walk = (dir) => {
|
|
79610
79636
|
for (const name of readdirSync(dir)) {
|
|
79611
|
-
const path =
|
|
79637
|
+
const path = join24(dir, name);
|
|
79612
79638
|
const kind = lstatSync(path);
|
|
79613
79639
|
if (kind.isDirectory()) {
|
|
79614
79640
|
chmodSync(path, 448);
|
|
@@ -79631,7 +79657,7 @@ async function installBundle(home, say) {
|
|
|
79631
79657
|
if (bundleComplete(home)) return;
|
|
79632
79658
|
const dir = managedTorDir(home);
|
|
79633
79659
|
const pinned = bundle();
|
|
79634
|
-
const archive =
|
|
79660
|
+
const archive = join24(dir, `tor-expert-bundle-${TOR_EXPERT_BUNDLE}.tar.gz`);
|
|
79635
79661
|
const part = `${archive}.part`;
|
|
79636
79662
|
say(`Getting Tor for the wallet (once, about ${pinned.mb} MB from the Tor Project, checked).`);
|
|
79637
79663
|
let response;
|
|
@@ -79668,10 +79694,10 @@ async function installBundle(home, say) {
|
|
|
79668
79694
|
rmSync(unpacking, { recursive: true, force: true });
|
|
79669
79695
|
rmSync(target, { recursive: true, force: true });
|
|
79670
79696
|
mkdirSync(unpacking, { recursive: true });
|
|
79671
|
-
const tar = MAC ? "/usr/bin/tar" : LINUX ? existsSync("/usr/bin/tar") ? "/usr/bin/tar" : "/bin/tar" :
|
|
79697
|
+
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");
|
|
79672
79698
|
const result = spawnSync3(tar, ["-xzf", archive, "-C", unpacking, ...LINUX ? ["--no-same-owner"] : []], { windowsHide: true, encoding: "utf8", timeout: 12e4 });
|
|
79673
79699
|
rmSync(archive, { force: true });
|
|
79674
|
-
if (result.status !== 0 || !BUNDLE_FILES.every((parts) => existsSync(
|
|
79700
|
+
if (result.status !== 0 || !BUNDLE_FILES.every((parts) => existsSync(join24(unpacking, ...parts)))) {
|
|
79675
79701
|
rmSync(unpacking, { recursive: true, force: true });
|
|
79676
79702
|
throw failure(
|
|
79677
79703
|
`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`,
|
|
@@ -79705,7 +79731,7 @@ async function installBundle(home, say) {
|
|
|
79705
79731
|
);
|
|
79706
79732
|
}
|
|
79707
79733
|
}
|
|
79708
|
-
writeFileSync(
|
|
79734
|
+
writeFileSync(join24(unpacking, COMPLETE), `${pinned.sha256}
|
|
79709
79735
|
`);
|
|
79710
79736
|
renameSync(unpacking, target);
|
|
79711
79737
|
}
|
|
@@ -79716,7 +79742,7 @@ function bootstrappedSince(home, from) {
|
|
|
79716
79742
|
return false;
|
|
79717
79743
|
}
|
|
79718
79744
|
}
|
|
79719
|
-
var startErrorsFile = (home) =>
|
|
79745
|
+
var startErrorsFile = (home) => join24(managedTorDir(home), "start-errors.log");
|
|
79720
79746
|
function startErrorsTail(home) {
|
|
79721
79747
|
try {
|
|
79722
79748
|
const text2 = readFileSync(startErrorsFile(home), "utf8");
|
|
@@ -79799,9 +79825,9 @@ ${early}`)) {
|
|
|
79799
79825
|
async function startTor(home, port, say, assertHeld = () => {
|
|
79800
79826
|
}, deadline = void 0) {
|
|
79801
79827
|
const dir = managedTorDir(home);
|
|
79802
|
-
const dataDir =
|
|
79828
|
+
const dataDir = join24(dir, "data");
|
|
79803
79829
|
mkdirSync(dataDir, { recursive: true, mode: 448 });
|
|
79804
|
-
const torrc =
|
|
79830
|
+
const torrc = join24(dir, "torrc");
|
|
79805
79831
|
if (!existsSync(torrc)) writeFileSync(torrc, "", { mode: 384 });
|
|
79806
79832
|
let from = 0;
|
|
79807
79833
|
try {
|
|
@@ -79813,7 +79839,7 @@ async function startTor(home, port, say, assertHeld = () => {
|
|
|
79813
79839
|
rmSync(logFile(home), { force: true });
|
|
79814
79840
|
from = 0;
|
|
79815
79841
|
}
|
|
79816
|
-
const geo =
|
|
79842
|
+
const geo = join24(bundleDir(home), "data");
|
|
79817
79843
|
const blocked = (error) => failure(
|
|
79818
79844
|
`${SYSTEM2} did not run Tor (the file: ${torExe(home)}; it answered ${error?.code ?? "an error"}). Ask again; if this stays, check whether a security program blocks that file`,
|
|
79819
79845
|
`Tor did not start (${error?.code ?? error?.message ?? error})`
|
|
@@ -79849,9 +79875,9 @@ async function startTor(home, port, say, assertHeld = () => {
|
|
|
79849
79875
|
"--CookieAuthFile",
|
|
79850
79876
|
cookieFile(home),
|
|
79851
79877
|
"--GeoIPFile",
|
|
79852
|
-
|
|
79878
|
+
join24(geo, "geoip"),
|
|
79853
79879
|
"--GeoIPv6File",
|
|
79854
|
-
|
|
79880
|
+
join24(geo, "geoip6"),
|
|
79855
79881
|
"--Log",
|
|
79856
79882
|
`notice file ${logFile(home)}`
|
|
79857
79883
|
], {
|
|
@@ -80015,7 +80041,7 @@ async function ownTorReady(home, state2, { wait = true, deadline } = {}) {
|
|
|
80015
80041
|
function ownPortOf(home) {
|
|
80016
80042
|
const state2 = managedTorState(home);
|
|
80017
80043
|
if (state2) return state2.port;
|
|
80018
|
-
if (!bundleComplete(home) && !existsSync(
|
|
80044
|
+
if (!bundleComplete(home) && !existsSync(join24(managedTorDir(home), "torrc"))) return void 0;
|
|
80019
80045
|
try {
|
|
80020
80046
|
return Number(new URL(readSetupConfig(home)?.torTunnel ?? "").port) || void 0;
|
|
80021
80047
|
} catch {
|
|
@@ -80206,7 +80232,7 @@ function startTorTimingMarks() {
|
|
|
80206
80232
|
}
|
|
80207
80233
|
if (!state2 || typeof pool2 !== "string" || !/^[1-9A-HJ-NP-Za-km-z]{32,44}$/.test(pool2) || tunnel.hostname !== "127.0.0.1" || state2.port !== Number(tunnel.port)) return;
|
|
80208
80234
|
const ours = ownOnionPrefixes();
|
|
80209
|
-
const mark = createTimingLog(
|
|
80235
|
+
const mark = createTimingLog(join24(home, pool2, "wallet.json.timing.log"), { component: "tor" }).start({ startedAt: Date.now() - performance.now() });
|
|
80210
80236
|
let marks = 0;
|
|
80211
80237
|
const once2 = (phase, outcome) => {
|
|
80212
80238
|
if (marks >= TOR_TIMING_MAX) return;
|
|
@@ -80231,6 +80257,7 @@ init_tunnelGuard();
|
|
|
80231
80257
|
init_serviceUrl();
|
|
80232
80258
|
init_backup();
|
|
80233
80259
|
init_files();
|
|
80260
|
+
init_seedKeys();
|
|
80234
80261
|
init_globalDispatcher();
|
|
80235
80262
|
var cli = () => commandPrefix();
|
|
80236
80263
|
var SellerRefusal = class extends Error {
|
|
@@ -80240,14 +80267,13 @@ var SellerRefusal = class extends Error {
|
|
|
80240
80267
|
this.plain = plain;
|
|
80241
80268
|
}
|
|
80242
80269
|
};
|
|
80243
|
-
var SELLER_FOLDER = "seller";
|
|
80244
80270
|
var FILES2 = Object.freeze({
|
|
80245
80271
|
config: "config.json",
|
|
80246
80272
|
profile: "public-profile.json",
|
|
80247
80273
|
eta: "eta.txt",
|
|
80248
80274
|
publicKeyX: "public-key-x.txt",
|
|
80249
|
-
attestation:
|
|
80250
|
-
encryption:
|
|
80275
|
+
attestation: SELLER_ATTESTATION_FILE,
|
|
80276
|
+
encryption: SELLER_STORE_KEY_FILE,
|
|
80251
80277
|
store: "state/offers.enc.json",
|
|
80252
80278
|
backup: "backup-confirmed.json",
|
|
80253
80279
|
network: "network.json",
|
|
@@ -80256,14 +80282,14 @@ var FILES2 = Object.freeze({
|
|
|
80256
80282
|
});
|
|
80257
80283
|
var SELLER_MODES = Object.freeze({ anyBuyer: "any-buyer", shinjukuOnly: "shinjuku-only" });
|
|
80258
80284
|
var MODE_SCHEMA = "shinjuku-seller-mode/v1";
|
|
80259
|
-
var modeFile = (home) =>
|
|
80285
|
+
var modeFile = (home) => join25(sellerDir(home), FILES2.mode);
|
|
80260
80286
|
var ANY_BUYER_PATH = /^\/[^?#\s*:[\]]*$/;
|
|
80261
80287
|
var KEY_FILES = Object.freeze([FILES2.eta, FILES2.publicKeyX, FILES2.attestation, FILES2.encryption]);
|
|
80262
80288
|
var MAX_PRICE_ATOMIC = 1000n * 1000000n;
|
|
80263
|
-
var sellerDir = (home) =>
|
|
80264
|
-
var sellerConfigPath = (home) =>
|
|
80289
|
+
var sellerDir = (home) => join25(home, SELLER_FOLDER);
|
|
80290
|
+
var sellerConfigPath = (home) => join25(sellerDir(home), FILES2.config);
|
|
80265
80291
|
function separateSellerHome(env, userHome) {
|
|
80266
|
-
return env.SHIELDED_WALLET_HOME ? `${resolve17(env.SHIELDED_WALLET_HOME)}-seller` :
|
|
80292
|
+
return env.SHIELDED_WALLET_HOME ? `${resolve17(env.SHIELDED_WALLET_HOME)}-seller` : join25(userHome, ".shinjuku-shield-seller");
|
|
80267
80293
|
}
|
|
80268
80294
|
function setUpSellerHome(env, userHome) {
|
|
80269
80295
|
return [setupHome(env, userHome), separateSellerHome(env, userHome)].find((home) => existsSync(sellerConfigPath(home)) || sellerMode(home) !== void 0);
|
|
@@ -80285,7 +80311,7 @@ function sellerMode(home) {
|
|
|
80285
80311
|
}
|
|
80286
80312
|
function networkChoice(home) {
|
|
80287
80313
|
try {
|
|
80288
|
-
const record = JSON.parse(readFileSync(
|
|
80314
|
+
const record = JSON.parse(readFileSync(join25(sellerDir(home), FILES2.network), "utf8"));
|
|
80289
80315
|
if (record?.tor === false) return { tor: false };
|
|
80290
80316
|
return record?.tor === true && typeof record.tunnel === "string" && /^http:\/\/127\.0\.0\.1:\d{1,5}$/.test(record.tunnel) ? { tor: true, tunnel: record.tunnel } : void 0;
|
|
80291
80317
|
} catch {
|
|
@@ -80497,7 +80523,7 @@ async function createShinjukuSeller({ home, passphraseFile, routes, fetchImpl =
|
|
|
80497
80523
|
if (!proofTools.depositProver) fail21("proof_tools_missing: rerun shinjuku setup (it keeps the wallet)");
|
|
80498
80524
|
const store = openWalletStore(
|
|
80499
80525
|
homeWalletPath(walletHome2, config.pool),
|
|
80500
|
-
readSecretText(passphraseFile ?? config.passphraseFile ??
|
|
80526
|
+
readSecretText(passphraseFile ?? config.passphraseFile ?? join26(walletHome2, PASSPHRASE_FILE), "the passphrase file")
|
|
80501
80527
|
);
|
|
80502
80528
|
await walletLease(store.path);
|
|
80503
80529
|
if (inbound.network !== network || config.network !== network || inbound.mint !== store.state.asset) fail21("network_mismatch: the wallet and the facilitator name another network or token");
|