shinjuku-shield 0.3.142 → 0.3.143

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 CHANGED
@@ -6,19 +6,19 @@ answers privately, in a terminal chat or for your agent app. Its `mcp`
6
6
  command runs a local MCP server (stdio) for your agent. Your keys never
7
7
  leave your machine.
8
8
 
9
- This is version 0.3.142. The npm packages `shinjuku-shield` and
9
+ This is version 0.3.143. The npm packages `shinjuku-shield` and
10
10
  `shinjuku-shielded` hold the same files. The command is `shinjuku`.
11
11
 
12
12
  ## Set up
13
13
 
14
14
  ```sh
15
- npm install -g shinjuku@0.3.142
15
+ npm install -g shinjuku@0.3.143
16
16
  shinjuku setup
17
17
  ```
18
18
 
19
19
  Type the two lines as they are. `npx install shinjuku` does not work: npx
20
20
  reads `install` as the name of another npm package. To set up without
21
- installing, type `npx shinjuku@0.3.142 setup`.
21
+ installing, type `npx shinjuku@0.3.143 setup`.
22
22
 
23
23
  Setup makes the wallet on this machine, a private passphrase file, and the
24
24
  checked proof tools (about 191 MB), and writes `config.json`. It also writes
@@ -36,13 +36,13 @@ Every wallet command works after `shinjuku`, for example `shinjuku balance`,
36
36
  Claude Code:
37
37
 
38
38
  ```sh
39
- claude mcp add --scope user shinjuku -- npx -y --no-audit --no-fund shinjuku-shield@0.3.142 mcp
39
+ claude mcp add --scope user shinjuku -- npx -y --no-audit --no-fund shinjuku-shield@0.3.143 mcp
40
40
  ```
41
41
 
42
42
  Claude Desktop (`claude_desktop_config.json`) or Cursor (`~/.cursor/mcp.json`):
43
43
 
44
44
  ```json
45
- { "mcpServers": { "shinjuku": { "command": "npx", "args": ["-y", "--no-audit", "--no-fund", "shinjuku-shield@0.3.142", "mcp"] } } }
45
+ { "mcpServers": { "shinjuku": { "command": "npx", "args": ["-y", "--no-audit", "--no-fund", "shinjuku-shield@0.3.143", "mcp"] } } }
46
46
  ```
47
47
 
48
48
  On native Windows, if the host cannot find `npx`, use `"command": "cmd"` and
@@ -55,7 +55,7 @@ Codex (the Codex app and Codex CLI read the same file, `~/.codex/config.toml`):
55
55
  ```toml
56
56
  [mcp_servers.shinjuku]
57
57
  command = "npx"
58
- args = ["-y", "--no-audit", "--no-fund", "shinjuku-shield@0.3.142", "mcp"]
58
+ args = ["-y", "--no-audit", "--no-fund", "shinjuku-shield@0.3.143", "mcp"]
59
59
  startup_timeout_sec = 120
60
60
  tool_timeout_sec = 300
61
61
  ```
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": "88aadc6644df79f42aba537416608eea0462184073f62a0053c9d6f83f3cb46d",
5
- "bytes": 8972142,
6
- "sourceCommit": "9787e6457056edc02c707b855c12db300b81beac",
4
+ "sha256": "d1d7233b86e252e58009678280970cb3aaa264c8569bd29f790e5a592a948138",
5
+ "bytes": 8974175,
6
+ "sourceCommit": "d25e1296d250570e9a2a5c427ea98730b75a1cee",
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",
@@ -38,6 +38,7 @@
38
38
  "src/server/payments/shielded/p03LoopLag.ts",
39
39
  "src/server/payments/shielded/p03MinContextSlotRetry.ts",
40
40
  "src/server/payments/shielded/p03PhotonHost.ts",
41
+ "src/server/payments/shielded/p03QuoteRingAnchor.ts",
41
42
  "src/server/payments/shielded/poseidon/poseidon_params_t_2.json",
42
43
  "src/server/payments/shielded/poseidon/poseidon_params_t_3.json",
43
44
  "src/server/payments/shielded/poseidon/poseidon_params_t_6.json",
@@ -1037,5 +1038,5 @@
1037
1038
  "version": "1.8.0"
1038
1039
  }
1039
1040
  ],
1040
- "publishedAt": "2026-11-01T08:46:43.152Z"
1041
+ "publishedAt": "2026-11-01T09:22:38.910Z"
1041
1042
  }
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "shinjuku-shield",
3
- "version": "0.3.142",
3
+ "version": "0.3.143",
4
4
  "mcpName": "io.github.ShinjukuStaition/shinjuku-mcp",
5
5
  "description": "Shinjuku Shielded, the private x402 facilitator 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": "88aadc66",
7
- "shinjukuSha256": "88aadc6644df79f42aba537416608eea0462184073f62a0053c9d6f83f3cb46d",
6
+ "shinjukuRelease": "d1d7233b",
7
+ "shinjukuSha256": "d1d7233b86e252e58009678280970cb3aaa264c8569bd29f790e5a592a948138",
8
8
  "license": "SEE LICENSE IN LICENSE.txt",
9
9
  "author": "Shinjuku Shielded",
10
10
  "homepage": "https://github.com/ShinjukuStaition/shinjuku-shield#readme",
@@ -80044,6 +80044,35 @@ var init_ShieldedSolanaP03Types = __esm({
80044
80044
  }
80045
80045
  });
80046
80046
 
80047
+ // src/server/payments/shielded/p03QuoteRingAnchor.ts
80048
+ function p03QuoteValidBefore(epoch) {
80049
+ return (epoch + 2n) * EPOCH_SECONDS;
80050
+ }
80051
+ function p03RingAnchorHasQuoteMargin(epoch, chainTimestamp) {
80052
+ return p03QuoteValidBefore(epoch) - chainTimestamp >= P03_QUOTE_RING_ANCHOR_MIN_SECONDS_LEFT;
80053
+ }
80054
+ function p03StaleQuoteAnchorRing(error) {
80055
+ return error instanceof P03QuoteAnchorStaleError ? error.ring : void 0;
80056
+ }
80057
+ function p03RingAnchorServesQuote(anchor, ring) {
80058
+ return p03RingAnchorHasQuoteMargin(anchor.epoch, ring.chainTimestamp) && ring.anchors.some((slot3) => slot3.epoch === anchor.epoch && slot3.anchorIndex === anchor.anchorIndex && slot3.anchorRoot === anchor.anchorRoot);
80059
+ }
80060
+ var P03_QUOTE_RING_ANCHOR_MIN_SECONDS_LEFT, EPOCH_SECONDS, P03QuoteAnchorStaleError;
80061
+ var init_p03QuoteRingAnchor = __esm({
80062
+ "src/server/payments/shielded/p03QuoteRingAnchor.ts"() {
80063
+ "use strict";
80064
+ P03_QUOTE_RING_ANCHOR_MIN_SECONDS_LEFT = 120n;
80065
+ EPOCH_SECONDS = 300n;
80066
+ P03QuoteAnchorStaleError = class extends Error {
80067
+ ring;
80068
+ constructor(ring) {
80069
+ super("p03_quote_anchor_stale");
80070
+ this.ring = Object.freeze({ ...ring, anchors: Object.freeze(ring.anchors.map((anchor) => Object.freeze({ ...anchor }))) });
80071
+ }
80072
+ };
80073
+ }
80074
+ });
80075
+
80047
80076
  // src/server/payments/shielded/ShieldedSolanaP03Quote.ts
80048
80077
  function deriveShieldedSolanaP03SvmMappings(input) {
80049
80078
  const network = canonicalNetwork(input.network);
@@ -80100,8 +80129,8 @@ function parseAnchor(raw, label) {
80100
80129
  });
80101
80130
  }
80102
80131
  function checkedValidBefore(epoch) {
80103
- if (epoch > U64_LIMIT / EPOCH_SECONDS - 2n) throw new Error("p03_quote_expiry_overflow");
80104
- return (epoch + 2n) * EPOCH_SECONDS;
80132
+ if (epoch > U64_LIMIT / EPOCH_SECONDS2 - 2n) throw new Error("p03_quote_expiry_overflow");
80133
+ return (epoch + 2n) * EPOCH_SECONDS2;
80105
80134
  }
80106
80135
  function canonicalPublicInput(value2) {
80107
80136
  if (value2 instanceof Uint8Array) {
@@ -80228,7 +80257,7 @@ function assertExactKeys(value2, expectedKeys, label) {
80228
80257
  throw new Error(`p03_quote_${label}_shape_invalid`);
80229
80258
  }
80230
80259
  }
80231
- var import_web3108, U48_LIMIT, U64_LIMIT, EPOCH_SECONDS, QUOTE_DOMAIN_LABEL, POOL_DOMAIN_LABEL, SHIELDED_SOLANA_P03_QUOTE_DOMAIN, REQUIREMENT_KEYS, EXTRA_KEYS, ShieldedSolanaP03QuoteIssuer;
80260
+ var import_web3108, U48_LIMIT, U64_LIMIT, EPOCH_SECONDS2, QUOTE_DOMAIN_LABEL, POOL_DOMAIN_LABEL, SHIELDED_SOLANA_P03_QUOTE_DOMAIN, REQUIREMENT_KEYS, EXTRA_KEYS, ShieldedSolanaP03QuoteIssuer;
80232
80261
  var init_ShieldedSolanaP03Quote = __esm({
80233
80262
  "src/server/payments/shielded/ShieldedSolanaP03Quote.ts"() {
80234
80263
  "use strict";
@@ -80236,10 +80265,11 @@ var init_ShieldedSolanaP03Quote = __esm({
80236
80265
  init_sha3();
80237
80266
  init_utils();
80238
80267
  init_ShieldedSolanaP03Types();
80268
+ init_p03QuoteRingAnchor();
80239
80269
  init_ShieldedSolanaP03QuoteCrypto();
80240
80270
  U48_LIMIT = 1n << 48n;
80241
80271
  U64_LIMIT = 1n << 64n;
80242
- EPOCH_SECONDS = 300n;
80272
+ EPOCH_SECONDS2 = 300n;
80243
80273
  QUOTE_DOMAIN_LABEL = utf8ToBytes("carbon-shielded-exact/quote/v1");
80244
80274
  POOL_DOMAIN_LABEL = utf8ToBytes("carbon-shielded-exact/pool/v1");
80245
80275
  SHIELDED_SOLANA_P03_QUOTE_DOMAIN = bytesToBigInt2(keccak_256(QUOTE_DOMAIN_LABEL)) % SHIELDED_SOLANA_P03_QUOTE_FIELD_MODULUS;
@@ -80307,7 +80337,7 @@ var init_ShieldedSolanaP03Quote = __esm({
80307
80337
  }
80308
80338
  async issue(recipientAddress) {
80309
80339
  const evidence = parseAnchorEvidence(await this.readCurrentQuoteAnchor());
80310
- const chainEpoch = evidence.chainTimestamp / EPOCH_SECONDS;
80340
+ const chainEpoch = evidence.chainTimestamp / EPOCH_SECONDS2;
80311
80341
  if (evidence.current.epoch !== chainEpoch) throw new Error("p03_quote_anchor_not_current");
80312
80342
  const nonceResult = this.randomBytes(32);
80313
80343
  if (!(nonceResult instanceof Uint8Array) || nonceResult.length !== 32) {
@@ -80337,7 +80367,17 @@ var init_ShieldedSolanaP03Quote = __esm({
80337
80367
  }
80338
80368
  async authenticate(input) {
80339
80369
  const parsed2 = this.parseAuthentication(input);
80340
- const evidence = parseAnchorEvidence(await this.readCurrentQuoteAnchor());
80370
+ let raw;
80371
+ try {
80372
+ raw = await this.readCurrentQuoteAnchor();
80373
+ } catch (error) {
80374
+ const ring = p03StaleQuoteAnchorRing(error);
80375
+ if (ring === void 0) throw error;
80376
+ if (ring.chainTimestamp >= parsed2.validBefore) throw new Error("p03_quote_expired");
80377
+ if (!p03RingAnchorServesQuote(parsed2.anchor, ring)) throw error;
80378
+ return this.authenticateParsed(input, parsed2);
80379
+ }
80380
+ const evidence = parseAnchorEvidence(raw);
80341
80381
  if (evidence.chainTimestamp >= parsed2.validBefore) throw new Error("p03_quote_expired");
80342
80382
  if (parsed2.anchor.epoch > evidence.current.epoch || parsed2.anchor.epoch === evidence.current.epoch && parsed2.anchor.anchorIndex > evidence.current.anchorIndex) {
80343
80383
  throw new Error("p03_quote_anchor_stale");
@@ -82217,8 +82257,10 @@ function createAnchorReader({ connection, profile }) {
82217
82257
  if (chainTimestamp < 0n) fail17("chain_clock_invalid");
82218
82258
  const anchors = state.validAnchors.map((a) => ({ epoch: a.epoch, anchorIndex: a.index, anchorRoot: bigint(a.root) }));
82219
82259
  const current = anchors.find((a) => a.epoch === chainTimestamp / 300n);
82220
- if (requireCapacity && !current) fail17("anchor_not_ready");
82221
- const selected = current ?? anchors[0];
82260
+ const newest = anchors[0];
82261
+ const ringSlotServes = !current && requireCapacity && state.anchorMode === 2 && state.anchorRing !== null && newest !== void 0 && newest.anchorIndex === BigInt(state.currentIndex) && p03RingAnchorHasQuoteMargin(BigInt(newest.epoch), chainTimestamp);
82262
+ if (requireCapacity && !current && !ringSlotServes) fail17("anchor_not_ready");
82263
+ const selected = current ?? newest;
82222
82264
  return {
82223
82265
  ...selected,
82224
82266
  chainTimestamp,
@@ -83142,6 +83184,7 @@ var init_service = __esm({
83142
83184
  init_EncryptedJsonFile();
83143
83185
  init_finalizedReadMemo();
83144
83186
  init_ShieldedSolanaP03Quote();
83187
+ init_p03QuoteRingAnchor();
83145
83188
  init_ShieldedSolanaP03MemoScanner();
83146
83189
  init_SolanaP03Wire();
83147
83190
  init_ShieldedSolanaP03QuoteCrypto();