@needmoretruth/nmts-cli 0.53.0 → 0.54.0

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/CHANGELOG.md CHANGED
@@ -3,6 +3,13 @@
3
3
  Each version's entry is what changed for the person or the program using `nmts`. The product's own
4
4
  update history, which covers the site and the server too, is at https://nmts.me/updates.
5
5
 
6
+ ## 0.54.0 — 2026-11-08
7
+
8
+ - `put --pay wallet --sui-key-file <file>` pays for the upload from another Sui wallet you hold, read
9
+ from a key file, instead of from your NMTS key's wallet. The review names that wallet. A key file
10
+ other users can read is refused with a `chmod 600` hint, and the key is never printed. It cannot be
11
+ combined with `--wallet` or used with `push`.
12
+
6
13
  ## 0.53.0 — 2026-11-08
7
14
 
8
15
  - A command that fails for a reason other than how it was typed now ends its error with one line
package/README.ko.md CHANGED
@@ -50,7 +50,7 @@ nmts --help
50
50
 
51
51
  ```sh
52
52
  npm install -g github:needmoretruth/nmts-cli # 기본 브랜치
53
- npm install -g github:needmoretruth/nmts-cli#v0.53.0 # 버전을 고정할 때
53
+ npm install -g github:needmoretruth/nmts-cli#v0.54.0 # 버전을 고정할 때
54
54
  npm install -g https://github.com/needmoretruth/nmts-cli/releases/latest/download/nmts.tgz
55
55
  ```
56
56
 
@@ -245,6 +245,7 @@ nmts put film.mov --part-size 256MiB # 조각을 키우면: 구매 횟수는
245
245
  nmts put film.mov --pay wallet --dry-run # 검토만: WAL 값, 팁, 수수료, 잔액, 날수. 서명하지 않습니다
246
246
  nmts put film.mov --pay wallet --epochs 6 # 저장 네트워크의 에포크 6개(기본 2)
247
247
  nmts put film.mov --pay wallet --storage fit # 지갑이 이미 든 저장 자원을 크기에 맞춰 잘라 씁니다
248
+ nmts put film.mov --pay wallet --sui-key-file ~/.sui/agent.key # 가지고 있는 다른 Sui 지갑이 냅니다
248
249
  ```
249
250
 
250
251
  파일을 같은 조각으로 나누고, 체인이 조각마다 WAL 값과 중계의 팁(SUI)을
@@ -260,6 +261,10 @@ nmts put film.mov --pay wallet --storage fit # 지갑이 이미 든 저
260
261
  목록의 저장 네트워크 사본을 싣지 않습니다 — 오늘은 브라우저의 작은 파일 업로드만 싣습니다.
261
262
  `push --pay wallet`은 같은 일을 파일마다 합니다.
262
263
 
264
+ `--sui-key-file <파일>`을 주면 `put`이 NMTS 키의 지갑 대신 가지고 있는 다른 Sui 지갑에서 내고, 검토가 그
265
+ 지갑을 밝힙니다. 파일에는 그 지갑의 `suiprivkey1…` 줄이 들어 있어야 합니다. 다른 사용자가 읽을 수 있는
266
+ 파일은 거절하고, 키는 어디에도 찍지 않습니다. `--wallet`과 함께 쓸 수 없고 `push`에는 쓰지 않습니다.
267
+
263
268
  `push`는 디렉터리를 올리고 **첫 실패에서 멈추며**, 이미 올라간 것을 말합니다. 목적지에 같은
264
269
  이름이 이미 있는 파일은 건너뛰므로 다시 돌려도 안전합니다. 점으로 시작하는 이름은 `--hidden`을
265
270
  주지 않는 한 건드리지 않고, 심볼릭 링크는 따라가지 않습니다.
package/README.md CHANGED
@@ -51,7 +51,7 @@ default branch, from a pinned version, or from the tarball attached to the
51
51
 
52
52
  ```sh
53
53
  npm install -g github:needmoretruth/nmts-cli # the default branch
54
- npm install -g github:needmoretruth/nmts-cli#v0.53.0 # a pinned version
54
+ npm install -g github:needmoretruth/nmts-cli#v0.54.0 # a pinned version
55
55
  npm install -g https://github.com/needmoretruth/nmts-cli/releases/latest/download/nmts.tgz
56
56
  ```
57
57
 
@@ -256,6 +256,7 @@ interrupted upload: the retry costs nothing more.
256
256
  nmts put film.mov --pay wallet --dry-run # the review: WAL price, tip, fee, balances, days. Signs nothing
257
257
  nmts put film.mov --pay wallet --epochs 6 # six of the storage network's epochs (default 2)
258
258
  nmts put film.mov --pay wallet --storage fit # use a storage resource the wallet already holds, cut to size
259
+ nmts put film.mov --pay wallet --sui-key-file ~/.sui/agent.key # another Sui wallet you hold pays instead
259
260
  ```
260
261
 
261
262
  The file is planned into the same parts, the chain quotes each part in WAL
@@ -273,6 +274,11 @@ can extend it. A wallet-paid upload does not carry the recovery list's storage-n
273
274
  whichever way the account's switch is set — today only the browser's small-file uploads do. `push
274
275
  --pay wallet` does the same one file at a time.
275
276
 
277
+ With `--sui-key-file <file>`, `put` pays from another Sui wallet you hold instead of your NMTS key's
278
+ wallet, and the review names that wallet. The file holds the wallet's `suiprivkey1…` line; a file other
279
+ users can read is refused, and the key is never printed. It cannot be combined with `--wallet` or used
280
+ with `push`.
281
+
276
282
  `push` uploads a directory and **stops at the first failure**, saying what is already uploaded.
277
283
  Files whose name is already in the destination are skipped, so running it again is safe. Names
278
284
  beginning with a dot are left alone unless `--hidden` is given, and symbolic links are not followed.
@@ -11,7 +11,7 @@ export declare const CRYPTO_SPEC_URL = "https://github.com/needmoretruth/nmts-re
11
11
  * is the field's own contract — what the writer says about itself — and a person holding two
12
12
  * copies of one account's artefacts can then tell which program made each.
13
13
  */
14
- export declare const WRITTEN_BY = "nmts-cli 0.53.0";
14
+ export declare const WRITTEN_BY = "nmts-cli 0.54.0";
15
15
  /** Which of the three artefacts a wrapper is. A reader holding several can sort them. */
16
16
  export type ArtifactKind = "recovery-list" | "file-list" | "recovery-kit";
17
17
  /**
@@ -7,5 +7,5 @@ export type ClientKind = "cli" | "mcp" | "sdk";
7
7
  * points with `"sdk"` and the SDK's own version.
8
8
  */
9
9
  export declare function identifyClient(next: ClientKind, nextVersion?: string): void;
10
- /** `cli/0.53.0`, `mcp/0.53.0`, `sdk/0.17.0`. */
10
+ /** `cli/0.54.0`, `mcp/0.54.0`, `sdk/0.17.0`. */
11
11
  export declare function clientHeaderValue(): string;
package/dist/client-id.js CHANGED
@@ -24,7 +24,7 @@ export function identifyClient(next, nextVersion = VERSION) {
24
24
  kind = next;
25
25
  version = nextVersion;
26
26
  }
27
- /** `cli/0.53.0`, `mcp/0.53.0`, `sdk/0.17.0`. */
27
+ /** `cli/0.54.0`, `mcp/0.54.0`, `sdk/0.17.0`. */
28
28
  export function clientHeaderValue() {
29
29
  return `${kind}/${version}`;
30
30
  }
@@ -8,6 +8,7 @@ export declare function refuseWalletOnlyOptions(options: {
8
8
  wallet?: string | undefined;
9
9
  trustServerTipAddress?: boolean;
10
10
  from?: string | undefined;
11
+ suiKeyFile?: string | undefined;
11
12
  }): void;
12
13
  /** What NMTS Heavy adds to an upload command line: the tier, and the self-paid knobs. */
13
14
  export interface HeavyFlags {
@@ -40,6 +40,12 @@ export function refuseWalletOnlyOptions(options) {
40
40
  nextStep: `Nothing was sent. Add --pay wallet to use a storage resource this wallet holds.`,
41
41
  });
42
42
  }
43
+ if (options.suiKeyFile !== undefined) {
44
+ throw new NmtsError("--sui-key-file only applies with --pay wallet: credits are not paid from a wallet.", {
45
+ exitCode: 2,
46
+ nextStep: `Nothing was sent. Add --pay wallet to pay this upload from the wallet in that file.`,
47
+ });
48
+ }
43
49
  if (options.from !== undefined) {
44
50
  throw new NmtsError("--from only applies with --pay wallet: it is how a credit-paid file moves onto the wallet.", {
45
51
  exitCode: 2,
@@ -0,0 +1,3 @@
1
+ import type { WalletPutReview } from "../upload-wallet-put.ts";
2
+ /** The review as `--json` prints it: base units as strings, with the coin amounts beside them. */
3
+ export declare function factsOf(review: WalletPutReview): Record<string, unknown>;
@@ -0,0 +1,26 @@
1
+ import { coinAmount } from "../wallet.js";
2
+ /** The review as `--json` prints it: base units as strings, with the coin amounts beside them. */
3
+ export function factsOf(review) {
4
+ const { budget, storage } = review;
5
+ return {
6
+ bytes: review.bytes,
7
+ sealedBytes: review.sealedBytes,
8
+ parts: review.parts,
9
+ epochs: review.epochs,
10
+ days: review.days,
11
+ endEpoch: review.endEpoch,
12
+ paidFrom: "wallet",
13
+ priceFrost: budget.walNeededFrost.toString(),
14
+ priceWal: coinAmount(budget.walNeededFrost),
15
+ tipMist: review.tipMist.toString(),
16
+ tipSui: coinAmount(review.tipMist),
17
+ feeMist: budget.feeMist === null ? null : budget.feeMist.toString(),
18
+ feeSui: budget.feeMist === null ? null : coinAmount(budget.feeMist),
19
+ wallet: budget.address,
20
+ walletWal: budget.walFrost === null ? null : coinAmount(budget.walFrost),
21
+ walletSui: budget.suiMist === null ? null : coinAmount(budget.suiMist),
22
+ storage: storage.kind === "buy"
23
+ ? { kind: "buy" }
24
+ : { kind: "reuse", objectId: storage.objectId, cutToBytes: storage.cutToBytes, leftoverBytes: storage.leftoverBytes },
25
+ };
26
+ }
@@ -7,6 +7,7 @@ import type { AccountSettings } from "../shared/lib/drive/manifest-settings.ts";
7
7
  import type { StandingTipInput } from "../standing-tip.ts";
8
8
  import { type WalletUploadReads } from "../upload-wallet-plan.ts";
9
9
  import type { BlobProtocol, UploadApi } from "../upload-wire.ts";
10
+ import type { ExternalPayer } from "../wallet-sign-external.ts";
10
11
  import type { SignBlobCertify, SignBlobRegister } from "../wallet-sign.ts";
11
12
  import { type PutOptions } from "./put.ts";
12
13
  /** What paying from the wallet adds to an upload command. */
@@ -75,6 +76,8 @@ export interface WalletUploadContext {
75
76
  settings?: AccountSettings | undefined;
76
77
  /** Which of this key's wallets pays (`wallet-pay-index.ts`). Read from the same list as above. */
77
78
  wallet: number;
79
+ /** A wallet this key does not derive pays instead (`--sui-key-file` · L338); `wallet` is then unused. */
80
+ payer?: ExternalPayer | undefined;
78
81
  /**
79
82
  * Does this account ask its uploads to carry the recovery list's storage-network copy?
80
83
  *
@@ -35,9 +35,9 @@ import { measureLocal } from "../upload-price-node.js";
35
35
  import { downloadForRefill, findOriginal, settleRefill } from "../refill-source.js";
36
36
  import { describeUploadReview } from "../upload-wallet-plan.js";
37
37
  import { walletPut } from "../upload-wallet-put.js";
38
- import { coinAmount } from "../wallet.js";
39
38
  import { recordWalletSpend, requireWalletGrant } from "../wallet-grant.js";
40
39
  import { folderIdFor } from "./put.js";
40
+ import { factsOf } from "./put-wallet-facts.js";
41
41
  export async function putWithWallet(target, options) {
42
42
  const say = options.write ?? ((line) => process.stdout.write(`${line}\n`));
43
43
  const from = options.from;
@@ -45,6 +45,7 @@ export async function putWithWallet(target, options) {
45
45
  if (from === undefined && (target === undefined || target === "")) {
46
46
  throw new NmtsError("Say which file to put.", { exitCode: 2, nextStep: `\`${BINARY_NAME} put <file> --pay wallet\`` });
47
47
  }
48
+ const payer = options.suiKeyFile === undefined ? undefined : (await import("../payer-key-file.js")).keyFilePayer(options.suiKeyFile, options.wallet);
48
49
  const resolved = await requireAccountCode();
49
50
  const key = resolveApiKey();
50
51
  if (key === null) {
@@ -88,6 +89,7 @@ export async function putWithWallet(target, options) {
88
89
  onCollision: asked,
89
90
  settings: list.manifest?.settings,
90
91
  wallet,
92
+ payer,
91
93
  networkCopy: options.json === true ? false : await readNetworkCopy(server, key.key),
92
94
  progress: new Progress(options.json === true ? silentSink() : stderrSink(), "uploading"),
93
95
  say,
@@ -180,12 +182,14 @@ export async function uploadOneWithWallet(ctx, file, options) {
180
182
  partSize: ctx.partSize,
181
183
  rule: ctx.rule,
182
184
  onCollision: ctx.onCollision,
185
+ ...(ctx.payer === undefined ? {} : { payer: { address: ctx.payer.address } }),
183
186
  }, { source: fileSource(file.localPath, file.size), name: file.name, parentId: file.parentId, destination: file.destination, thumbOf: file.thumbOf }, {
184
187
  epochs: options.epochs,
185
188
  storage: options.storage,
186
189
  dryRun: options.dryRun,
187
190
  readChain: options.readChain,
188
- sign: options.sign,
191
+ // ⛔ THE KEY FILE'S WALLET SIGNS WHAT ITS ADDRESS WAS PRICED FOR (the SDK's `pay: { signer }` road).
192
+ sign: options.sign ?? (ctx.payer === undefined ? undefined : (await import("../wallet-sign-external.js")).externalBlobSigners(ctx.payer)),
189
193
  protocol: options.protocol,
190
194
  api: options.api,
191
195
  onProgress: (sent, total) => ctx.progress.update(sent, total),
@@ -231,17 +235,19 @@ export async function uploadOneWithWallet(ctx, file, options) {
231
235
  // ⛔ THE STANDING SHARE, AFTER THE PAYMENT AND NEVER INSIDE IT: a gift that fails must not fail
232
236
  // the upload. A resumed run paid nothing now, so it owes nothing now. In --json the tip speaks
233
237
  // on stderr — stdout carries the machine's one answer and nothing else.
234
- await (await import("../standing-tip.js")).standingTipAfter({
235
- server: ctx.server,
236
- network: ctx.network,
237
- code: ctx.code,
238
- settings: ctx.settings,
239
- wallet: ctx.wallet,
240
- paidWalFrost: outcome.resumed ? 0n : outcome.review.budget.walNeededFrost,
241
- say: ctx.json ? (line) => void process.stderr.write(`${line}\n`) : say,
242
- trustServerAddress: options.trustServerTipAddress === true,
243
- ...(options.tip ?? {}),
244
- });
238
+ // ⛔ NOT WHEN A KEY FILE PAID: the gift would leave a wallet the person did not name for it.
239
+ if (ctx.payer === undefined)
240
+ await (await import("../standing-tip.js")).standingTipAfter({
241
+ server: ctx.server,
242
+ network: ctx.network,
243
+ code: ctx.code,
244
+ settings: ctx.settings,
245
+ wallet: ctx.wallet,
246
+ paidWalFrost: outcome.resumed ? 0n : outcome.review.budget.walNeededFrost,
247
+ say: ctx.json ? (line) => void process.stderr.write(`${line}\n`) : say,
248
+ trustServerAddress: options.trustServerTipAddress === true,
249
+ ...(options.tip ?? {}),
250
+ });
245
251
  return { itemId: outcome.itemId, savedAs: outcome.savedAs, replaced: outcome.replaced, seq: outcome.fileListVersion, resumed: outcome.resumed, facts };
246
252
  }
247
253
  /**
@@ -261,31 +267,6 @@ export async function readNetworkCopy(server, apiKey) {
261
267
  return null;
262
268
  }
263
269
  }
264
- /** The review as `--json` prints it: base units as strings, with the coin amounts beside them. */
265
- function factsOf(review) {
266
- const { budget, storage } = review;
267
- return {
268
- bytes: review.bytes,
269
- sealedBytes: review.sealedBytes,
270
- parts: review.parts,
271
- epochs: review.epochs,
272
- days: review.days,
273
- endEpoch: review.endEpoch,
274
- paidFrom: "wallet",
275
- priceFrost: budget.walNeededFrost.toString(),
276
- priceWal: coinAmount(budget.walNeededFrost),
277
- tipMist: review.tipMist.toString(),
278
- tipSui: coinAmount(review.tipMist),
279
- feeMist: budget.feeMist === null ? null : budget.feeMist.toString(),
280
- feeSui: budget.feeMist === null ? null : coinAmount(budget.feeMist),
281
- wallet: budget.address,
282
- walletWal: budget.walFrost === null ? null : coinAmount(budget.walFrost),
283
- walletSui: budget.suiMist === null ? null : coinAmount(budget.suiMist),
284
- storage: storage.kind === "buy"
285
- ? { kind: "buy" }
286
- : { kind: "reuse", objectId: storage.objectId, cutToBytes: storage.cutToBytes, leftoverBytes: storage.leftoverBytes },
287
- };
288
- }
289
270
  /** Each step, for a person watching. The signatures are named as what they are. */
290
271
  function tell(ctx, size, step) {
291
272
  if (ctx.json || step.step === "planning")
@@ -39,6 +39,11 @@ export interface PutOptions extends HeavyFlags {
39
39
  from?: string | undefined;
40
40
  /** `--pay wallet`: which of this key's wallets pays, this run only. Absent = the account's own. */
41
41
  wallet?: string | undefined;
42
+ /**
43
+ * `--pay wallet --sui-key-file <file>`: a wallet this NMTS key does not derive pays, signed with
44
+ * the key in that file (`payer-key-file.ts` · L338). Not with `--wallet`: one payer per run.
45
+ */
46
+ suiKeyFile?: string | undefined;
42
47
  /** `--trust-server-tip-address`: let THIS SERVER name where the standing gift goes. Off unless
43
48
  * typed, and only for a server the caller runs (`standing-tip.ts`). */
44
49
  trustServerTipAddress?: boolean;
@@ -147,7 +147,8 @@ export function optionLines() {
147
147
  // file path; the account number is inside what is signed, so another number is another
148
148
  // signature; without `--app` one wallet opens the same account in every product that asks.
149
149
  ` --wallet The NMTS key comes from a wallet's signature (login, create)`,
150
- ` --sui-key-file <p> File holding the wallet's \`suiprivkey1…\` line. Never the key itself`,
150
+ ` --sui-key-file <p> File holding the wallet's \`suiprivkey1…\` line. Never the key itself.`,
151
+ ` With put --pay wallet, that wallet pays for the upload`,
151
152
  ` --account <n> Which of that wallet's accounts. Default 1; it is inside what is signed`,
152
153
  ` --app <name> Scope the signature to one product. Without it, one account everywhere`,
153
154
  ` --version Print the version and exit`,
package/dist/main.js CHANGED
@@ -186,12 +186,14 @@ export async function run(argv) {
186
186
  onCollision: args.onCollision,
187
187
  deposit: args.deposit, pay: args.pay, epochs: args.epochs,
188
188
  storage: args.storage, from: args.from,
189
- json: args.json, wallet: args.wallet, trustServerTipAddress: args.trustServerTipAddress,
189
+ json: args.json, wallet: args.wallet, trustServerTipAddress: args.trustServerTipAddress, suiKeyFile: args.suiKeyFile,
190
190
  tier: args.tier, copies: args.copies, providers: args.providers, evmWallet: args.evmWallet, days: args.days,
191
191
  thumbnail: args.thumbnail, thumbnailFile: args.thumbnailFile,
192
192
  });
193
193
  }
194
194
  case "push": {
195
+ if (args.suiKeyFile !== undefined)
196
+ (await import("./payer-key-file.js")).refuseKeyFileForPush();
195
197
  const { push } = await import("./commands/push.js");
196
198
  return await push(args.operands[0], {
197
199
  server: args.server,
@@ -1,3 +1,4 @@
1
+ import { type Signer } from "@mysten/sui/cryptography";
1
2
  import type { SignWallet } from "./openers.ts";
2
3
  /** A wallet this run can ask for signatures: which address it is, and how to ask. */
3
4
  export interface KeyFileWallet {
@@ -12,3 +13,8 @@ export interface KeyFileWallet {
12
13
  * to a file with `echo` appends one and refusing it would be a puzzle with no clue.
13
14
  */
14
15
  export declare function walletFromKeyFile(path: string): KeyFileWallet;
16
+ /**
17
+ * The keypair held in `path`, for a caller that signs more than a message — `put --pay wallet
18
+ * --sui-key-file` signs the upload's transactions with it (`payer-key-file.ts`).
19
+ */
20
+ export declare function signerFromKeyFile(path: string): Signer;
@@ -17,11 +17,12 @@
17
17
  //
18
18
  // ⚠ NODE ONLY, WHICH IS WHY IT IS NOT IN `openers/`. That folder is bundled into a page by the
19
19
  // SDK's browser entry; a page's wallet is an extension, and this one is a file on a disk.
20
- import { readFileSync } from "node:fs";
20
+ import { readFileSync, statSync } from "node:fs";
21
21
  import { Ed25519Keypair } from "@mysten/sui/keypairs/ed25519";
22
22
  import { Secp256k1Keypair } from "@mysten/sui/keypairs/secp256k1";
23
23
  import { Secp256r1Keypair } from "@mysten/sui/keypairs/secp256r1";
24
24
  import { decodeSuiPrivateKey } from "@mysten/sui/cryptography";
25
+ import { modesAreEnforced } from "./credentials.js";
25
26
  import { NmtsError } from "./errors.js";
26
27
  /**
27
28
  * The wallet held in `path`, ready to sign the opener message.
@@ -31,7 +32,7 @@ import { NmtsError } from "./errors.js";
31
32
  * to a file with `echo` appends one and refusing it would be a puzzle with no clue.
32
33
  */
33
34
  export function walletFromKeyFile(path) {
34
- const keypair = keypairFrom(readOneLine(path), path);
35
+ const keypair = signerFromKeyFile(path);
35
36
  return {
36
37
  address: keypair.toSuiAddress(),
37
38
  // ⛔ THE CLOSURE HOLDS THE KEYPAIR AND NOTHING HOLDS THE CLOSURE PAST THE RUN. What it answers
@@ -40,6 +41,31 @@ export function walletFromKeyFile(path) {
40
41
  sign: async (message) => keypair.signPersonalMessage(message),
41
42
  };
42
43
  }
44
+ /**
45
+ * The keypair held in `path`, for a caller that signs more than a message — `put --pay wallet
46
+ * --sui-key-file` signs the upload's transactions with it (`payer-key-file.ts`).
47
+ */
48
+ export function signerFromKeyFile(path) {
49
+ return keypairFrom(readOneLine(path), path);
50
+ }
51
+ /**
52
+ * A key file other users of this machine can read is refused, as the credentials file is
53
+ * (`credentials.ts` `readCredentialsFile`).
54
+ *
55
+ * ⛔ CHECKED ONLY ONCE THE FILE IS KNOWN TO HOLD A KEY. A file that holds no key leaks nothing, and
56
+ * telling somebody to tighten the permissions of the wrong file sends them the wrong way.
57
+ */
58
+ function refuseOpenKeyFile(path) {
59
+ if (!modesAreEnforced())
60
+ return;
61
+ const mode = statSync(path).mode & 0o777;
62
+ if ((mode & 0o077) === 0)
63
+ return;
64
+ throw new NmtsError(`${path} can be read by other users of this machine (mode ${mode.toString(8)}).`, {
65
+ exitCode: 2,
66
+ nextStep: `Nothing was signed. Make it yours alone with \`chmod 600 ${path}\`, then run this again.`,
67
+ });
68
+ }
43
69
  /** The first line with anything on it, or this tool's own refusal. */
44
70
  function readOneLine(path) {
45
71
  let raw;
@@ -63,6 +89,7 @@ function readOneLine(path) {
63
89
  nextStep: "Nothing was signed. The file holds one line beginning `suiprivkey1`.",
64
90
  });
65
91
  }
92
+ refuseOpenKeyFile(path);
66
93
  return line;
67
94
  }
68
95
  /** The keypair that line names, for the three schemes an opener may use. */
@@ -0,0 +1,13 @@
1
+ import type { ExternalPayer } from "./wallet-sign-external.ts";
2
+ /**
3
+ * `--sui-key-file` for one put, judged before the account is opened: a file that cannot pay is a
4
+ * command line to fix (`openers-key-file.ts` says which).
5
+ *
6
+ * ⛔ ONE PAYER PER RUN (the SDK's TWO_PAYERS rule, `put-wallet.ts` there): `--wallet` names one of
7
+ * this key's wallets and the key file names another.
8
+ */
9
+ export declare function keyFilePayer(path: string, wallet: string | undefined): ExternalPayer;
10
+ /** ⛔ REFUSED, NOT IGNORED: ignored, a push would pay from this key's own wallet instead. */
11
+ export declare function refuseKeyFileForPush(): never;
12
+ /** The wallet in `path` as the payer of an upload. */
13
+ export declare function payerFromKeyFile(path: string): ExternalPayer;
@@ -0,0 +1,47 @@
1
+ // A wallet that pays for one upload from a key file (`put --pay wallet --sui-key-file <file>` · L338).
2
+ //
3
+ // ⛔ THE SAME ROAD AS EVERY OUTSIDE WALLET. The key file becomes an `ExternalPayer`, and the upload is
4
+ // priced, signed and judged by `wallet-sign-external.ts` exactly as an extension's or the SDK's
5
+ // `pay: { signer }` is: the payer's address goes in before anything is priced, so the review, both
6
+ // balances and the measured fee name the wallet that will sign. Nothing here builds a transaction.
7
+ //
8
+ // ⛔ THE KEY IS READ THROUGH THE ONE READER (`openers-key-file.ts`), which refuses a file other users
9
+ // can read and never quotes its contents.
10
+ import { fromBase64 } from "@mysten/sui/utils";
11
+ import { NmtsError } from "./errors.js";
12
+ import { signerFromKeyFile } from "./openers-key-file.js";
13
+ import { BINARY_NAME } from "./product.js";
14
+ /**
15
+ * `--sui-key-file` for one put, judged before the account is opened: a file that cannot pay is a
16
+ * command line to fix (`openers-key-file.ts` says which).
17
+ *
18
+ * ⛔ ONE PAYER PER RUN (the SDK's TWO_PAYERS rule, `put-wallet.ts` there): `--wallet` names one of
19
+ * this key's wallets and the key file names another.
20
+ */
21
+ export function keyFilePayer(path, wallet) {
22
+ if (wallet !== undefined) {
23
+ throw new NmtsError("--wallet names one of this key's wallets, and --sui-key-file names another.", {
24
+ exitCode: 2,
25
+ nextStep: "Nothing was sent and nothing was signed. Keep one of the two: one run, one payer.",
26
+ });
27
+ }
28
+ return payerFromKeyFile(path);
29
+ }
30
+ /** ⛔ REFUSED, NOT IGNORED: ignored, a push would pay from this key's own wallet instead. */
31
+ export function refuseKeyFileForPush() {
32
+ throw new NmtsError("--sui-key-file pays for one put, not for a push.", {
33
+ exitCode: 2,
34
+ nextStep: `Nothing was sent. Put each file with \`${BINARY_NAME} put <file> --pay wallet --sui-key-file <file>\`.`,
35
+ });
36
+ }
37
+ /** The wallet in `path` as the payer of an upload. */
38
+ export function payerFromKeyFile(path) {
39
+ const signer = signerFromKeyFile(path);
40
+ return {
41
+ address: signer.toSuiAddress(),
42
+ signTransaction: async ({ bytes }) => {
43
+ const signed = await signer.signTransaction(bytes);
44
+ return { bytes: fromBase64(signed.bytes), signature: signed.signature };
45
+ },
46
+ };
47
+ }
package/dist/product.d.ts CHANGED
@@ -9,7 +9,7 @@ export declare const BINARY_NAME = "nmts";
9
9
  * beside it. Here rather than in `main.ts` because the MCP server has to say it too, and a
10
10
  * command importing the entry point is a cycle waiting to bite.
11
11
  */
12
- export declare const VERSION = "0.53.0";
12
+ export declare const VERSION = "0.54.0";
13
13
  /** Where the product lives, for messages that need to send somebody somewhere real. */
14
14
  export declare const HOME_URL = "https://nmts.me";
15
15
  /** The source, so a person holding only the built program can find what it was built from. */
package/dist/product.js CHANGED
@@ -18,7 +18,7 @@ export const BINARY_NAME = "nmts";
18
18
  * beside it. Here rather than in `main.ts` because the MCP server has to say it too, and a
19
19
  * command importing the entry point is a cycle waiting to bite.
20
20
  */
21
- export const VERSION = "0.53.0";
21
+ export const VERSION = "0.54.0";
22
22
  /** Where the product lives, for messages that need to send somebody somewhere real. */
23
23
  export const HOME_URL = "https://nmts.me";
24
24
  /** The source, so a person holding only the built program can find what it was built from. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@needmoretruth/nmts-cli",
3
- "version": "0.53.0",
3
+ "version": "0.54.0",
4
4
  "description": "Command-line and MCP access to NMTS (NeedMoreTruthStorage, https://nmts.me): open-source, end-to-end encrypted storage on the Walrus network. No fee to NMTS; you pay the network from your own wallet. For people and for their agents.",
5
5
  "license": "Apache-2.0",
6
6
  "publishConfig": {
package/server.json CHANGED
@@ -6,13 +6,13 @@
6
6
  "url": "https://github.com/needmoretruth/nmts-cli",
7
7
  "source": "github"
8
8
  },
9
- "version": "0.53.0",
9
+ "version": "0.54.0",
10
10
  "packages": [
11
11
  {
12
12
  "registryType": "npm",
13
13
  "registryBaseUrl": "https://registry.npmjs.org",
14
14
  "identifier": "@needmoretruth/nmts-cli",
15
- "version": "0.53.0",
15
+ "version": "0.54.0",
16
16
  "transport": {
17
17
  "type": "stdio"
18
18
  },