@needmoretruth/nmts-cli 0.59.1 → 0.61.1
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/AGENTS.md +49 -49
- package/CHANGELOG.md +128 -99
- package/LICENSING.md +8 -8
- package/README.ko.md +156 -156
- package/README.md +111 -111
- package/dist/api-advice.js +34 -34
- package/dist/api-key.js +2 -2
- package/dist/artifact-about.d.ts +1 -1
- package/dist/autonomy.js +12 -12
- package/dist/code-access.js +3 -3
- package/dist/code-vault.js +1 -1
- package/dist/commands/accept-terms.js +4 -4
- package/dist/commands/ai-account.js +10 -10
- package/dist/commands/balance.js +7 -7
- package/dist/commands/create-code-file.js +3 -3
- package/dist/commands/create-link.js +36 -41
- package/dist/commands/create-pass.js +3 -3
- package/dist/commands/create.js +4 -4
- package/dist/commands/credits.js +2 -2
- package/dist/commands/delete-account.js +3 -3
- package/dist/commands/deposit.js +3 -3
- package/dist/commands/devices.js +3 -3
- package/dist/commands/documents.js +1 -1
- package/dist/commands/env.js +13 -13
- package/dist/commands/erase.js +5 -5
- package/dist/commands/expiring.js +4 -4
- package/dist/commands/extend.js +8 -8
- package/dist/commands/get.js +2 -2
- package/dist/commands/handover.js +2 -2
- package/dist/commands/key-manage.js +2 -2
- package/dist/commands/key.js +5 -5
- package/dist/commands/link.js +2 -2
- package/dist/commands/links.js +1 -1
- package/dist/commands/listfile.js +3 -3
- package/dist/commands/login-passphrase.js +4 -4
- package/dist/commands/login.js +9 -9
- package/dist/commands/logout.js +1 -1
- package/dist/commands/losses.js +7 -7
- package/dist/commands/ls.js +7 -7
- package/dist/commands/marks.js +1 -1
- package/dist/commands/mcp.js +4 -4
- package/dist/commands/mode.js +8 -8
- package/dist/commands/on-collision.js +4 -4
- package/dist/commands/openers-attach.js +1 -1
- package/dist/commands/organise.js +1 -1
- package/dist/commands/padding.js +3 -3
- package/dist/commands/platform.js +2 -2
- package/dist/commands/public-code-manage.js +4 -4
- package/dist/commands/public-code.js +4 -4
- package/dist/commands/pull.js +1 -1
- package/dist/commands/push-heavy.js +1 -1
- package/dist/commands/push-wallet.js +1 -1
- package/dist/commands/push.js +2 -2
- package/dist/commands/put-heavy.js +2 -2
- package/dist/commands/put-payer.js +1 -1
- package/dist/commands/put-wallet.js +5 -5
- package/dist/commands/put.js +3 -3
- package/dist/commands/rebuild.js +13 -13
- package/dist/commands/receive.js +2 -2
- package/dist/commands/recovery-list.js +1 -1
- package/dist/commands/recovery.js +7 -7
- package/dist/commands/rollback.js +2 -2
- package/dist/commands/s3.js +3 -3
- package/dist/commands/share.js +7 -7
- package/dist/commands/shares-sent.js +2 -2
- package/dist/commands/support.js +1 -1
- package/dist/commands/sweep.js +3 -3
- package/dist/commands/tip.js +2 -2
- package/dist/commands/trial.js +8 -8
- package/dist/commands/unlock.js +6 -6
- package/dist/commands/update.js +3 -3
- package/dist/commands/usage.js +4 -4
- package/dist/commands/verify.js +1 -1
- package/dist/commands/wallet-activity.js +3 -3
- package/dist/commands/wallet-donate.js +4 -4
- package/dist/commands/wallet-hall.js +5 -5
- package/dist/commands/wallet-list.js +2 -2
- package/dist/commands/wallet-send.js +5 -5
- package/dist/commands/wallet-storage-buy.js +1 -1
- package/dist/commands/wallet-storage-extend.js +1 -1
- package/dist/commands/wallet-storage-ops.js +5 -5
- package/dist/commands/wallet-storage.js +1 -1
- package/dist/commands/wallet-swap.js +14 -14
- package/dist/commands/wallet-use.js +2 -2
- package/dist/commands/wallet.js +6 -6
- package/dist/consent.js +7 -7
- package/dist/credentials.js +1 -1
- package/dist/deposit.js +1 -1
- package/dist/download-part.js +1 -1
- package/dist/download-sink-node.js +3 -3
- package/dist/download.js +1 -1
- package/dist/drive-edit/errors.js +1 -1
- package/dist/drive-edit/folders.js +1 -1
- package/dist/drive-edit/trash.js +2 -2
- package/dist/drive-erase.js +1 -1
- package/dist/environment.js +5 -5
- package/dist/errors.js +1 -1
- package/dist/extend-budget.js +5 -5
- package/dist/extend-chain.js +1 -1
- package/dist/extend-plan.js +4 -4
- package/dist/gate.js +1 -1
- package/dist/handover.js +2 -2
- package/dist/heavy-copy.d.ts +1 -1
- package/dist/heavy-copy.js +7 -7
- package/dist/help-options.js +13 -13
- package/dist/help.js +54 -40
- package/dist/human-check.js +2 -2
- package/dist/kit-file.js +6 -6
- package/dist/list-file.js +1 -1
- package/dist/manifest-chunk-flow.js +1 -1
- package/dist/manifest-create.js +2 -2
- package/dist/manifest-write.js +1 -1
- package/dist/manifest.js +6 -3
- package/dist/mcp-args.js +1 -1
- package/dist/mcp-tools/credits.js +5 -5
- package/dist/mcp-tools/files.js +6 -6
- package/dist/mcp-tools/organise.js +7 -7
- package/dist/mcp-tools/reads.js +17 -17
- package/dist/mcp-tools/share.js +6 -6
- package/dist/mcp-tools/support.js +3 -3
- package/dist/mcp-tools/tiers.js +4 -4
- package/dist/notice.js +1 -1
- package/dist/openers/wallet.js +1 -1
- package/dist/platform-sign.js +2 -2
- package/dist/product.d.ts +1 -1
- package/dist/product.js +1 -1
- package/dist/public-codes.js +2 -2
- package/dist/recovery-assemble.js +1 -1
- package/dist/recovery-map-file.js +1 -1
- package/dist/recovery-map.js +1 -1
- package/dist/recovery-source.js +1 -1
- package/dist/recovery.js +1 -1
- package/dist/risk.d.ts +4 -4
- package/dist/risk.js +4 -4
- package/dist/s3/call.js +1 -1
- package/dist/s3/same-file.js +1 -1
- package/dist/setup-questions.js +1 -1
- package/dist/shared/lib/drive/manifest-index.d.ts +9 -0
- package/dist/shared/lib/drive/manifest-index.js +11 -0
- package/dist/shared/lib/heavy/order-plan.js +4 -4
- package/dist/shared/lib/heavy/sp-upload.js +1 -1
- package/dist/shared/lib/upload/relay-limit.d.ts +30 -0
- package/dist/shared/lib/upload/relay-limit.js +74 -0
- package/dist/shared/lib/vendor/nmt-pow.d.ts +21 -0
- package/dist/shared/lib/vendor/nmt-pow.js +56 -0
- package/dist/shared/lib/walrus/node-certificate.js +1 -1
- package/dist/shared/lib/walrus/node-quorum.js +1 -1
- package/dist/sharing-inbox.js +1 -1
- package/dist/sharing.js +4 -4
- package/dist/standing-tip.js +1 -1
- package/dist/storage-control/extend.js +2 -2
- package/dist/storage-control/reshape.js +3 -3
- package/dist/support-copy.js +4 -4
- package/dist/support-wire.js +4 -4
- package/dist/update-source.js +1 -1
- package/dist/upload-price.d.ts +10 -0
- package/dist/upload-price.js +21 -0
- package/dist/upload-quote.js +2 -2
- package/dist/upload-run.js +1 -1
- package/dist/upload-steps.js +1 -1
- package/dist/upload-store.js +1 -1
- package/dist/upload-wallet-chain.js +1 -1
- package/dist/upload-wallet-plan.js +12 -12
- package/dist/upload-wallet-put.js +1 -1
- package/dist/upload-wallet.js +2 -2
- package/dist/upload.js +2 -2
- package/dist/wallet-grant.js +3 -3
- package/dist/wallet-pay-index.js +1 -1
- package/dist/wallet-sign-external.js +5 -5
- package/dist/wallet-sign.js +6 -6
- package/dist/wallet-swap-words.js +3 -3
- package/dist/walrus.js +2 -2
- package/docs/commands/accept-terms.md +3 -3
- package/docs/commands/ai-account.md +4 -4
- package/docs/commands/create.md +8 -8
- package/docs/commands/credits.md +9 -9
- package/docs/commands/delete-account.md +4 -4
- package/docs/commands/deposit.md +7 -7
- package/docs/commands/devices.md +4 -4
- package/docs/commands/documents.md +5 -5
- package/docs/commands/env.md +10 -10
- package/docs/commands/extend.md +4 -4
- package/docs/commands/folders.md +3 -3
- package/docs/commands/get.md +4 -4
- package/docs/commands/handover.md +12 -12
- package/docs/commands/heavy.md +4 -4
- package/docs/commands/key.md +8 -8
- package/docs/commands/link.md +9 -9
- package/docs/commands/login.md +4 -4
- package/docs/commands/logout.md +2 -2
- package/docs/commands/losses.md +3 -3
- package/docs/commands/ls.md +5 -5
- package/docs/commands/marks.md +5 -5
- package/docs/commands/mcp.md +9 -9
- package/docs/commands/mode.md +6 -6
- package/docs/commands/on-collision.md +4 -4
- package/docs/commands/openers.md +5 -5
- package/docs/commands/padding.md +7 -7
- package/docs/commands/platform.md +2 -2
- package/docs/commands/public-code.md +8 -8
- package/docs/commands/pull.md +2 -2
- package/docs/commands/push.md +3 -3
- package/docs/commands/put.md +11 -11
- package/docs/commands/rebuild.md +5 -5
- package/docs/commands/recovery.md +4 -4
- package/docs/commands/s3.md +6 -6
- package/docs/commands/share.md +8 -8
- package/docs/commands/support.md +7 -7
- package/docs/commands/tip.md +7 -7
- package/docs/commands/trash.md +8 -8
- package/docs/commands/trial.md +5 -5
- package/docs/commands/unlock.md +4 -4
- package/docs/commands/update.md +3 -3
- package/docs/commands/usage.md +4 -4
- package/docs/commands/verify.md +5 -5
- package/docs/commands/wallet.md +25 -25
- package/docs/commands/whoami.md +5 -5
- package/examples/podman.sh +3 -3
- package/package.json +1 -1
- package/server.json +2 -2
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
// act on purpose — see the header of `create.ts`.
|
|
23
23
|
import { createHash } from "node:crypto";
|
|
24
24
|
import { request } from "../api.js";
|
|
25
|
+
import { solve as solveWork } from "../shared/lib/vendor/nmt-pow.js";
|
|
25
26
|
import { NmtsError } from "../errors.js";
|
|
26
27
|
import { isRecord } from "../guards.js";
|
|
27
28
|
import { BINARY_NAME, HOME_URL } from "../product.js";
|
|
@@ -33,8 +34,6 @@ const POLL_EVERY_MS = 3_000;
|
|
|
33
34
|
const WAIT_FOR_MS = 30 * 60 * 1000;
|
|
34
35
|
/** Say "this is working" only if the work actually takes a moment. */
|
|
35
36
|
const QUIET_FOR_MS = 1_000;
|
|
36
|
-
/** Hashes between clock reads while solving. Small enough to notice a second; large enough to cost nothing. */
|
|
37
|
-
const CHECK_EVERY = 4_096;
|
|
38
37
|
export async function createThroughLink(options) {
|
|
39
38
|
const say = options.write ?? ((line) => process.stdout.write(`${line}\n`));
|
|
40
39
|
const { server, network } = options;
|
|
@@ -49,15 +48,17 @@ export async function createThroughLink(options) {
|
|
|
49
48
|
const { refuseIfWalletIsTaken } = await import("./openers-attach.js");
|
|
50
49
|
await refuseIfWalletIsTaken(server, options.wallet);
|
|
51
50
|
}
|
|
52
|
-
const puzzle = await askForWork(server);
|
|
53
51
|
const code = await newAccountCode();
|
|
54
52
|
const proof = await registrationProofOf(code);
|
|
55
53
|
if (codeFile !== null)
|
|
56
54
|
writeCodeFile(codeFile, code);
|
|
57
|
-
|
|
55
|
+
// ⚠ THE CHALLENGE IS ASKED FOR THIS ACCOUNT ID, so it comes after the code: the server signs it for
|
|
56
|
+
// the id, and one piece of work buys an address for that id and nothing else.
|
|
57
|
+
const puzzle = await askForWork(server, proof.accountId);
|
|
58
|
+
const work = await solve(puzzle, say);
|
|
58
59
|
const answer = await request(server, "/v1/accounts/registration-links", {
|
|
59
60
|
method: "POST",
|
|
60
|
-
body: { account_id: proof.accountId, challenge: puzzle.challenge,
|
|
61
|
+
body: { account_id: proof.accountId, challenge: puzzle.challenge, answer: work },
|
|
61
62
|
});
|
|
62
63
|
const url = stringField(answer, "url");
|
|
63
64
|
const expiresAt = stringField(answer, "expires_at");
|
|
@@ -119,51 +120,45 @@ export async function createThroughLink(options) {
|
|
|
119
120
|
sayWhatIsNext(say);
|
|
120
121
|
return 0;
|
|
121
122
|
}
|
|
122
|
-
async function askForWork(server) {
|
|
123
|
-
const answer = await request(server,
|
|
123
|
+
async function askForWork(server, accountId) {
|
|
124
|
+
const answer = await request(server, `/v1/accounts/registration-challenge?account_id=${encodeURIComponent(accountId)}`);
|
|
124
125
|
const challenge = stringField(answer, "challenge");
|
|
125
126
|
const bits = isRecord(answer) ? answer["difficulty_bits"] : null;
|
|
126
|
-
|
|
127
|
+
const k = isRecord(answer) ? answer["k"] : null;
|
|
128
|
+
if (challenge === null || !isCount(bits) || !isCount(k) || k < 1) {
|
|
127
129
|
throw unexpected("a challenge");
|
|
128
130
|
}
|
|
129
|
-
return { challenge, bits };
|
|
131
|
+
return { challenge, bits, k };
|
|
132
|
+
}
|
|
133
|
+
function isCount(value) {
|
|
134
|
+
return typeof value === "number" && Number.isInteger(value) && value >= 0;
|
|
130
135
|
}
|
|
131
136
|
/**
|
|
132
|
-
*
|
|
137
|
+
* The k numbers that do this challenge's work, space-separated.
|
|
133
138
|
*
|
|
134
|
-
* ⛔ THE RULE IS
|
|
135
|
-
*
|
|
136
|
-
*
|
|
137
|
-
* down is how two implementations of one rule stop agreeing. The account id is in it so that
|
|
138
|
-
* one piece of work buys an address for one id and nothing else.
|
|
139
|
+
* ⛔ THE RULE IS THE NMT KIT'S (`../shared/lib/vendor/nmt-pow.ts`, a byte-identical copy of `~/nmt/kit/ts/nmt-pow.ts`),
|
|
140
|
+
* the same one the server checks with the kit's crate and the NMT Account asks at sign-up. It is not written out
|
|
141
|
+
* here again: a second copy of a rule is how two programs stop agreeing.
|
|
139
142
|
*
|
|
140
|
-
* ⚠
|
|
141
|
-
*
|
|
142
|
-
*
|
|
143
|
+
* ⚠ At the difficulty this service sets it is about a million digests and a second or two; there is nothing else for
|
|
144
|
+
* this command to be doing meanwhile, and a progress bar over a number nobody can act on is noise. One line, and
|
|
145
|
+
* only if it is slow.
|
|
143
146
|
*/
|
|
144
|
-
function solve(
|
|
147
|
+
async function solve(puzzle, say) {
|
|
145
148
|
const started = Date.now();
|
|
146
149
|
let said = false;
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
function leadingZeroBits(digest) {
|
|
160
|
-
let seen = 0;
|
|
161
|
-
for (const byte of digest) {
|
|
162
|
-
seen += Math.clz32(byte) - 24;
|
|
163
|
-
if (byte !== 0)
|
|
164
|
-
break;
|
|
165
|
-
}
|
|
166
|
-
return seen;
|
|
150
|
+
const answer = await solveWork(puzzle, (data) => createHash("sha256").update(data).digest(), {
|
|
151
|
+
progress: () => {
|
|
152
|
+
if (!said && Date.now() - started > QUIET_FOR_MS) {
|
|
153
|
+
say(`Preparing…`);
|
|
154
|
+
said = true;
|
|
155
|
+
}
|
|
156
|
+
},
|
|
157
|
+
});
|
|
158
|
+
// Without a deadline the kit's solver always finishes; null would mean it was given one.
|
|
159
|
+
if (answer === null)
|
|
160
|
+
throw unexpected("a challenge that can be answered");
|
|
161
|
+
return answer;
|
|
167
162
|
}
|
|
168
163
|
/**
|
|
169
164
|
* Ask the server, every few seconds, whether somebody has used the address.
|
|
@@ -219,7 +214,7 @@ function sayWhereTheCodeIs(say, codeFile, code) {
|
|
|
219
214
|
say(``);
|
|
220
215
|
say(`⛔ THIS IS THE ONLY COPY OF THE NMTS KEY THAT WILL EVER EXIST.`);
|
|
221
216
|
say(` NMTS keeps a verifier and never the NMTS key. It cannot be reset, resent or replaced.`);
|
|
222
|
-
say(` Lose it and the account and every file in it are gone
|
|
217
|
+
say(` Lose it and the account and every file in it are gone, for you and for NMTS.`);
|
|
223
218
|
say(``);
|
|
224
219
|
say(` ${codeFile ?? code}`);
|
|
225
220
|
say(``);
|
|
@@ -243,7 +238,7 @@ function nobodyCame(statusUrl) {
|
|
|
243
238
|
exitCode: 5,
|
|
244
239
|
nextStep: [
|
|
245
240
|
`No account was created, and the NMTS key that was made for it is now good for nothing.`,
|
|
246
|
-
`Running \`${BINARY_NAME} create\` again makes a NEW NMTS key and a NEW address
|
|
241
|
+
`Running \`${BINARY_NAME} create\` again makes a NEW NMTS key and a NEW address. It does not`,
|
|
247
242
|
`resume this one.`,
|
|
248
243
|
``,
|
|
249
244
|
`If somebody is finishing it right now, this says so: ${statusUrl}`,
|
|
@@ -134,12 +134,12 @@ export async function createWithPass(options) {
|
|
|
134
134
|
say(` ${credentialsPath()}`);
|
|
135
135
|
say(passphrase === ""
|
|
136
136
|
? ` In the clear, readable by this user alone (mode 600).`
|
|
137
|
-
: ` Sealed under the passphrase in ${PASSPHRASE_ENV_VAR}
|
|
137
|
+
: ` Sealed under the passphrase in ${PASSPHRASE_ENV_VAR}. Opening it needs that passphrase.`);
|
|
138
138
|
say(` NMTS keeps a verifier and never the NMTS key. It cannot be reset, resent or replaced.`);
|
|
139
139
|
say(` A person should keep a copy somewhere else.`);
|
|
140
140
|
say(``);
|
|
141
141
|
if (issued !== null) {
|
|
142
|
-
say(`API key ${issued.keyId} made and stored in the same file (read, write, spend
|
|
142
|
+
say(`API key ${issued.keyId} made and stored in the same file (read, write, spend. Stops ${issued.expiresAt}).`);
|
|
143
143
|
}
|
|
144
144
|
else {
|
|
145
145
|
say(`⚠ No API key was made: ${keyError ?? "unknown"}.`);
|
|
@@ -181,7 +181,7 @@ function explain(error) {
|
|
|
181
181
|
// 5 — waiting on a person's agreement, as everywhere else in `create`.
|
|
182
182
|
exitCode: 5,
|
|
183
183
|
nextStep: `Nothing was created and the pass was not spent. The person who takes a pass on ${HOME_URL}/ai ` +
|
|
184
|
-
`accepts the Terms and the Privacy Policy for the account it makes
|
|
184
|
+
`accepts the Terms and the Privacy Policy for the account it makes. This pass carries no ` +
|
|
185
185
|
`acceptance, or the documents changed since it was taken. Ask the person for a new pass.`,
|
|
186
186
|
});
|
|
187
187
|
}
|
package/dist/commands/create.js
CHANGED
|
@@ -270,7 +270,7 @@ function explain(error, inForce) {
|
|
|
270
270
|
exitCode: 4,
|
|
271
271
|
nextStep: `An account that creates accounts may make two a day and five a week, counted by the ` +
|
|
272
272
|
`server across restarts. Nothing was created and nothing was spent. Waiting is the only ` +
|
|
273
|
-
`thing that lifts it
|
|
273
|
+
`thing that lifts it. A second key on the same account shares the same allowance.`,
|
|
274
274
|
});
|
|
275
275
|
}
|
|
276
276
|
return error;
|
|
@@ -290,7 +290,7 @@ function uncertain(path, cause) {
|
|
|
290
290
|
``,
|
|
291
291
|
`Keep it until you know. Nothing on this machine can tell the two cases apart, and the`,
|
|
292
292
|
`cost of being wrong is one small file against an account nobody could ever open.`,
|
|
293
|
-
`Running this again makes a DIFFERENT account
|
|
293
|
+
`Running this again makes a DIFFERENT account. It does not retry this one.`,
|
|
294
294
|
``,
|
|
295
295
|
`Cause: ${cause instanceof Error ? cause.message : String(cause)}`,
|
|
296
296
|
].join("\n"),
|
|
@@ -310,7 +310,7 @@ function sayCreated(say, accountId, server, network) {
|
|
|
310
310
|
say(` account id ${accountId}`);
|
|
311
311
|
say(``);
|
|
312
312
|
say(`Nothing on this machine changed. The NMTS key you were signed in as is still the one`);
|
|
313
|
-
say(`this tool uses
|
|
313
|
+
say(`this tool uses. This new account is not stored, and not switched to.`);
|
|
314
314
|
say(``);
|
|
315
315
|
}
|
|
316
316
|
/**
|
|
@@ -322,7 +322,7 @@ function sayCreated(say, accountId, server, network) {
|
|
|
322
322
|
function sayTheCode(say, code) {
|
|
323
323
|
say(`⛔ THIS IS THE ONLY COPY OF THE NMTS KEY THAT WILL EVER EXIST.`);
|
|
324
324
|
say(` NMTS keeps a verifier and never the NMTS key. It cannot be reset, resent or replaced.`);
|
|
325
|
-
say(` Lose it and the account and every file in it are gone
|
|
325
|
+
say(` Lose it and the account and every file in it are gone, for you and for NMTS.`);
|
|
326
326
|
say(``);
|
|
327
327
|
say(` ${code}`);
|
|
328
328
|
say(``);
|
package/dist/commands/credits.js
CHANGED
|
@@ -90,7 +90,7 @@ function parseAmount(raw) {
|
|
|
90
90
|
function needsTo() {
|
|
91
91
|
return new NmtsError(`\`--to\` is required: it names the account that receives.`, {
|
|
92
92
|
exitCode: 2,
|
|
93
|
-
nextStep: `It takes an account identifier
|
|
93
|
+
nextStep: `It takes an account identifier: what \`${BINARY_NAME} whoami\` prints for that account, ` +
|
|
94
94
|
`and what the account screen lists for an AI account. It has to be an account of your own ` +
|
|
95
95
|
`family: your account, or one made under it.`,
|
|
96
96
|
});
|
|
@@ -102,7 +102,7 @@ function read(answer) {
|
|
|
102
102
|
if (typeof credits !== "number" || typeof from !== "number" || typeof to !== "number") {
|
|
103
103
|
throw new NmtsError("The server moved the credits and described it in a shape this version cannot read.", {
|
|
104
104
|
exitCode: 1,
|
|
105
|
-
nextStep: `The move happened whatever this printed
|
|
105
|
+
nextStep: `The move happened whatever this printed; \`${BINARY_NAME} balance\` reads the ledger. ` +
|
|
106
106
|
`Update this tool.`,
|
|
107
107
|
});
|
|
108
108
|
}
|
|
@@ -44,8 +44,8 @@ export async function deleteAccount(options = {}) {
|
|
|
44
44
|
const server = resolveServer(options.server ?? stored?.server);
|
|
45
45
|
say(`This erases the account's server record. It cannot be undone.`);
|
|
46
46
|
say(` Erased: the account, the file list, every file's record and share, sessions and keys.`);
|
|
47
|
-
say(` Not erased: the bytes on the storage network (paid through their term
|
|
48
|
-
say(` the records), and the NMTS key on this machine
|
|
47
|
+
say(` Not erased: the bytes on the storage network (paid through their term. Unreadable without`);
|
|
48
|
+
say(` the records), and the NMTS key on this machine (\`${BINARY_NAME} logout\` removes it).`);
|
|
49
49
|
say(` Not refunded: storage already paid for. The funds went to the network, never to NMTS.`);
|
|
50
50
|
say(``);
|
|
51
51
|
const typed = typedFor ? CONFIRM_SENTENCE : (await ask(`Type exactly: ${CONFIRM_SENTENCE}\n> `)).trim();
|
|
@@ -58,6 +58,6 @@ export async function deleteAccount(options = {}) {
|
|
|
58
58
|
await request(server, "/v1/account", { method: "DELETE", token: apiKey, accountProof });
|
|
59
59
|
say(`Erased. The server holds nothing about this account now.`);
|
|
60
60
|
say(`The stored NMTS key and API key on this machine are still here; \`${BINARY_NAME} logout\` removes them.`);
|
|
61
|
-
say(`A new account can be made at any time
|
|
61
|
+
say(`A new account can be made at any time: \`${BINARY_NAME} create\` or ${HOME_URL}.`);
|
|
62
62
|
return 0;
|
|
63
63
|
}
|
package/dist/commands/deposit.js
CHANGED
|
@@ -42,7 +42,7 @@ export async function deposit(wanted, options = {}) {
|
|
|
42
42
|
? `Uploads paid for with credits set no deposit aside. ${WHAT_ZERO_COSTS}`
|
|
43
43
|
: `Uploads paid for with credits set ${credits} credit${credits === 1 ? "" : "s"} aside on ` +
|
|
44
44
|
`each file, back when that file's storage period ends. Anything from 0 to ` +
|
|
45
|
-
`${DEPOSIT_CREDITS_MAX}
|
|
45
|
+
`${DEPOSIT_CREDITS_MAX}: \`${BINARY_NAME} deposit <n>\`, or --deposit for one upload.`);
|
|
46
46
|
return 0;
|
|
47
47
|
}
|
|
48
48
|
// ⛔ NO LIST, NO SETTING — the same refusal `padding` makes, for the same reason: the default
|
|
@@ -50,7 +50,7 @@ export async function deposit(wanted, options = {}) {
|
|
|
50
50
|
// first `ls` say "a list exists" about an account nothing was ever put in.
|
|
51
51
|
const before = await readFileList(session.server, session.apiKey, session.code, session.accountId);
|
|
52
52
|
if (before.manifest === null) {
|
|
53
|
-
throw new NmtsError(`This account has no file list yet
|
|
53
|
+
throw new NmtsError(`This account has no file list yet. The setting lives in the list, and there is nothing to write it into.`, { exitCode: 4, nextStep: `Upload once (\`${BINARY_NAME} put\`) and set it after.` });
|
|
54
54
|
}
|
|
55
55
|
const result = await applyManyToList(session, () => [], { depositDefault: asked });
|
|
56
56
|
if (options.json === true) {
|
|
@@ -65,7 +65,7 @@ export async function deposit(wanted, options = {}) {
|
|
|
65
65
|
say(`Uploads from now on set no deposit aside. ${WHAT_ZERO_COSTS}`);
|
|
66
66
|
return 0;
|
|
67
67
|
}
|
|
68
|
-
say(`Set to ${asked}. It applies to what is uploaded next, from every device
|
|
68
|
+
say(`Set to ${asked}. It applies to what is uploaded next, from every device. Deposits already ` +
|
|
69
69
|
`set aside on stored files are not moved.`);
|
|
70
70
|
return 0;
|
|
71
71
|
}
|
package/dist/commands/devices.js
CHANGED
|
@@ -37,7 +37,7 @@ function asDevices(value) {
|
|
|
37
37
|
throw new NmtsError("The server's answer was not an object.");
|
|
38
38
|
const rows = value["sessions"];
|
|
39
39
|
if (!Array.isArray(rows)) {
|
|
40
|
-
throw new NmtsError("The server listed the signed-in devices in a shape this version cannot read.", { nextStep: `Update this tool
|
|
40
|
+
throw new NmtsError("The server listed the signed-in devices in a shape this version cannot read.", { nextStep: `Update this tool (\`npm install -g ${BINARY_NAME}\`) or read it in a browser.` });
|
|
41
41
|
}
|
|
42
42
|
const out = [];
|
|
43
43
|
for (const row of rows) {
|
|
@@ -99,8 +99,8 @@ export async function devices(options = {}) {
|
|
|
99
99
|
say(``);
|
|
100
100
|
// ⛔ IT SAYS WHAT THIS CANNOT DO, rather than leaving a reader to find out by trying. A refusal
|
|
101
101
|
// discovered by running something is a refusal an agent retries.
|
|
102
|
-
say(` \`${BINARY_NAME} devices --sign-out <id>\` (or \`all\`) ends one
|
|
103
|
-
say(` NMTS key on this machine
|
|
102
|
+
say(` \`${BINARY_NAME} devices --sign-out <id>\` (or \`all\`) ends one. A person's act that needs the`);
|
|
103
|
+
say(` NMTS key on this machine. A key alone cannot, so a stolen key cannot end the browser's.`);
|
|
104
104
|
return 0;
|
|
105
105
|
}
|
|
106
106
|
/** `--sign-out <id|all>`: the refusals first, then one question, then the proof and the request. */
|
|
@@ -98,7 +98,7 @@ function noticeRows(answer) {
|
|
|
98
98
|
if (!Array.isArray(list)) {
|
|
99
99
|
throw new NmtsError("The server's answer did not carry a list of notices.", {
|
|
100
100
|
exitCode: 1,
|
|
101
|
-
nextStep: "Report it
|
|
101
|
+
nextStep: "Report it instead of retrying: the shape of the answer is wrong, and the network is fine.",
|
|
102
102
|
});
|
|
103
103
|
}
|
|
104
104
|
const rows = [];
|
package/dist/commands/env.js
CHANGED
|
@@ -19,7 +19,7 @@ import { isNewer } from "../update-source.js";
|
|
|
19
19
|
function sourceWords(source) {
|
|
20
20
|
switch (source) {
|
|
21
21
|
case "env":
|
|
22
|
-
return "environment variable
|
|
22
|
+
return "environment variable, readable by anything running as you";
|
|
23
23
|
case "secret-file":
|
|
24
24
|
return "a file named by an environment variable";
|
|
25
25
|
case "file":
|
|
@@ -38,17 +38,17 @@ function sourceWords(source) {
|
|
|
38
38
|
*/
|
|
39
39
|
function updateCheckWords(running) {
|
|
40
40
|
if (checkingIsOff())
|
|
41
|
-
return `off
|
|
41
|
+
return `off (${NO_CHECK_ENV_VAR} is set)`;
|
|
42
42
|
const record = readCheck();
|
|
43
43
|
if (record === null)
|
|
44
44
|
return `has not run yet`;
|
|
45
45
|
const when = record.checkedAt.slice(0, 16).replace("T", " ");
|
|
46
46
|
if (record.failed !== undefined)
|
|
47
|
-
return `⛔ last try ${when} UTC did not answer
|
|
47
|
+
return `⛔ last try ${when} UTC did not answer: ${record.failed}`;
|
|
48
48
|
if (record.latest === undefined)
|
|
49
49
|
return `last ran ${when} UTC and found nothing to compare`;
|
|
50
50
|
return isNewer(record.latest, running)
|
|
51
|
-
? `${record.latest} is published (this is ${running})
|
|
51
|
+
? `${record.latest} is published (this is ${running}); \`${BINARY_NAME} update\` installs it`
|
|
52
52
|
: `${record.latest} is newest, looked up ${when} UTC`;
|
|
53
53
|
}
|
|
54
54
|
export function env(options = {}) {
|
|
@@ -96,26 +96,26 @@ export function env(options = {}) {
|
|
|
96
96
|
}));
|
|
97
97
|
return 0;
|
|
98
98
|
}
|
|
99
|
-
say(` system ${environment.os} ${environment.osRelease}
|
|
99
|
+
say(` system ${environment.os} ${environment.osRelease}, node ${environment.node}`);
|
|
100
100
|
const mapping = environment.rootMapped === null
|
|
101
101
|
? ""
|
|
102
102
|
: environment.rootMapped
|
|
103
|
-
? "
|
|
104
|
-
: "
|
|
103
|
+
? ", rootless (root here is an ordinary user on the host)"
|
|
104
|
+
: ", root here is root on the host";
|
|
105
105
|
say(` containment ${environment.containment}${mapping}`);
|
|
106
106
|
say(` running as uid ${environment.uid ?? "n/a"}`);
|
|
107
|
-
say(` private files ${environment.privateStorage ? "yes" : "NO
|
|
107
|
+
say(` private files ${environment.privateStorage ? "yes" : "NO: this filesystem does not keep a file mode"}`);
|
|
108
108
|
say(` config ${environment.configDir}`);
|
|
109
|
-
say(` terminal ${environment.interactive ? "yes" : "no
|
|
109
|
+
say(` terminal ${environment.interactive ? "yes" : "no: nothing here can be typed"}`);
|
|
110
110
|
say(` browser ${environment.browserReachable ? "reachable" : "not reachable"}`);
|
|
111
111
|
// ⛔ "none found" IS NOT "no agent". Three of the five hosts this tool knows clear the
|
|
112
112
|
// environment before starting an MCP server, so an empty line here is exactly what running
|
|
113
113
|
// inside one of them looks like. The wording has to leave room for that or it reports a
|
|
114
114
|
// measurement as a conclusion.
|
|
115
115
|
say(` agent host ${environment.agentHosts.length === 0
|
|
116
|
-
? "no marker in this environment
|
|
116
|
+
? "no marker in this environment (some agents clear it, so this is not proof there is none)"
|
|
117
117
|
: environment.agentHosts.map(describeSighting).join("; ")}`);
|
|
118
|
-
const found = (got, problem) => (got !== null ? `found
|
|
118
|
+
const found = (got, problem) => (got !== null ? `found: ${sourceWords(got.source)}` : problem !== null ? `⛔ REFUSED: ${problem}` : "not found");
|
|
119
119
|
say(` NMTS key ${found(code, codeProblem)}`);
|
|
120
120
|
if (code?.source === "file-locked") {
|
|
121
121
|
// ⛔ THE ANSWER AN AGENT NEEDS BEFORE IT RUNS ANYTHING ELSE. A sealed code with no way to
|
|
@@ -126,7 +126,7 @@ export function env(options = {}) {
|
|
|
126
126
|
? `${PASSPHRASE_ENV_VAR} is set`
|
|
127
127
|
: environment.interactive
|
|
128
128
|
? `it will be asked for on the terminal`
|
|
129
|
-
: `⛔ NOT AVAILABLE
|
|
129
|
+
: `⛔ NOT AVAILABLE: no ${PASSPHRASE_ENV_VAR} and no terminal`;
|
|
130
130
|
say(` passphrase ${how}`);
|
|
131
131
|
}
|
|
132
132
|
say(` api key ${found(key, keyProblem)}`);
|
|
@@ -134,7 +134,7 @@ export function env(options = {}) {
|
|
|
134
134
|
if (advice.length > 0) {
|
|
135
135
|
say(``);
|
|
136
136
|
for (const item of advice) {
|
|
137
|
-
say(` ${item.level === "warn" ? "⛔" : "
|
|
137
|
+
say(` ${item.level === "warn" ? "⛔" : "-"} ${item.text}`);
|
|
138
138
|
}
|
|
139
139
|
}
|
|
140
140
|
say(``);
|
package/dist/commands/erase.js
CHANGED
|
@@ -50,7 +50,7 @@ export async function erase(paths, options = {}) {
|
|
|
50
50
|
say(` Erased: the server's record of each file and this account's key to it, and its shares.`);
|
|
51
51
|
if (options.releaseStorage === true) {
|
|
52
52
|
say(` Destroyed: the storage bought with credits under each file, on the chain, before the erase.`);
|
|
53
|
-
say(` Storage bought by the wallet is not touched
|
|
53
|
+
say(` Storage bought by the wallet is not touched. It stays until its term ends.`);
|
|
54
54
|
}
|
|
55
55
|
else {
|
|
56
56
|
say(` Not erased: the bytes on the storage network. They stay, unreadable, until their term ends;`);
|
|
@@ -77,9 +77,9 @@ export async function erase(paths, options = {}) {
|
|
|
77
77
|
say(`Erased ${erased} file${erased === 1 ? "" : "s"}. Their entries are out of the file list.`);
|
|
78
78
|
for (const r of releases) {
|
|
79
79
|
if (r.refused !== null)
|
|
80
|
-
say(` ${r.path}: storage not released
|
|
80
|
+
say(` ${r.path}: storage not released: ${r.refused}`);
|
|
81
81
|
else if (r.failed > 0)
|
|
82
|
-
say(` ${r.path}: ${r.released} released, ${r.failed} could not be
|
|
82
|
+
say(` ${r.path}: ${r.released} released, ${r.failed} could not be. Those bytes are still being served.`);
|
|
83
83
|
else
|
|
84
84
|
say(` ${r.path}: storage released (${r.released} destroyed${r.alreadyReleased > 0 ? `, ${r.alreadyReleased} already gone` : ""}).`);
|
|
85
85
|
// ⛔ ONLY WHEN THE SERVER NAMED A NUMBER. Every release the new ledger charges costs at least
|
|
@@ -94,6 +94,6 @@ export async function erase(paths, options = {}) {
|
|
|
94
94
|
function feeLine(r) {
|
|
95
95
|
const credits = `${r.feeCredits} credit${r.feeCredits === 1 ? "" : "s"}`;
|
|
96
96
|
return r.fromDeposit
|
|
97
|
-
? `${credits} taken from that file's deposit
|
|
98
|
-
: `${credits} taken from the balance
|
|
97
|
+
? `${credits} taken from that file's deposit. Nothing came out of the balance`
|
|
98
|
+
: `${credits} taken from the balance. That file had no deposit, so the fee is doubled`;
|
|
99
99
|
}
|
|
@@ -104,13 +104,13 @@ export async function expiring(options = {}) {
|
|
|
104
104
|
say(``);
|
|
105
105
|
say(`${unrecorded.length} file${unrecorded.length === 1 ? " has" : "s have"} no storage period ` +
|
|
106
106
|
`recorded. That is not a short one: whatever uploaded them could not read the network's ` +
|
|
107
|
-
`epoch clock, so nothing was written down. The chain still knows
|
|
107
|
+
`epoch clock, so nothing was written down. The chain still knows. A browser can show it.`);
|
|
108
108
|
}
|
|
109
109
|
if (rows.some((r) => r.path === null)) {
|
|
110
110
|
say(``);
|
|
111
111
|
say(` Rows marked "(not in the file list)" are files the server is holding that this account's`);
|
|
112
112
|
say(` list does not name. An upload can commit and then fail before the list was written.`);
|
|
113
|
-
say(` Nothing here can repair that
|
|
113
|
+
say(` Nothing here can repair that. Opening the account in a browser can.`);
|
|
114
114
|
}
|
|
115
115
|
if (answer.truncated) {
|
|
116
116
|
say(``);
|
|
@@ -131,8 +131,8 @@ function nameOf(row) {
|
|
|
131
131
|
}
|
|
132
132
|
/** The two stages that need a word beside them. `soon` is the warning itself and needs none. */
|
|
133
133
|
const MARK = {
|
|
134
|
-
lapsed: "
|
|
135
|
-
urgent: "
|
|
134
|
+
lapsed: " ⚠ TERM ENDED",
|
|
135
|
+
urgent: " ⚠ EXTEND NOW",
|
|
136
136
|
soon: "",
|
|
137
137
|
later: "",
|
|
138
138
|
unrecorded: "",
|
package/dist/commands/extend.js
CHANGED
|
@@ -38,7 +38,7 @@ export async function extend(target, options = {}) {
|
|
|
38
38
|
if (target === undefined || target === "") {
|
|
39
39
|
throw new NmtsError("Say which file to extend.", {
|
|
40
40
|
exitCode: 2,
|
|
41
|
-
nextStep: `\`${BINARY_NAME} extend <path
|
|
41
|
+
nextStep: `\`${BINARY_NAME} extend <path>\`, with the path as \`${BINARY_NAME} ls\` prints it.`,
|
|
42
42
|
});
|
|
43
43
|
}
|
|
44
44
|
const session = await openSession(options);
|
|
@@ -53,7 +53,7 @@ export async function extend(target, options = {}) {
|
|
|
53
53
|
readChain: options.readChain,
|
|
54
54
|
// ⚠ THE LAST SENTENCE IS THIS FILE'S: `nmts get` is a command at a prompt.
|
|
55
55
|
hints: {
|
|
56
|
-
lapsed: `Nothing was signed and nothing was charged. A lease is extended before it ends
|
|
56
|
+
lapsed: `Nothing was signed and nothing was charged. A lease is extended before it ends. Once it ` +
|
|
57
57
|
`is over there is no storage object left to extend, and the bytes may already be gone. ` +
|
|
58
58
|
`\`${BINARY_NAME} get\` says whether they can still be read.`,
|
|
59
59
|
},
|
|
@@ -87,8 +87,8 @@ export async function extend(target, options = {}) {
|
|
|
87
87
|
if (plan.stage === "later" && options.yes !== true) {
|
|
88
88
|
throw new NmtsError(`"${plan.path}" is not near the end of its storage term.`, {
|
|
89
89
|
exitCode: 4,
|
|
90
|
-
nextStep: `Nothing was signed and nothing was charged. Extending early loses nothing
|
|
91
|
-
`are added to what is left
|
|
90
|
+
nextStep: `Nothing was signed and nothing was charged. Extending early loses nothing (the epochs ` +
|
|
91
|
+
`are added to what is left), but it spends now for time this file does not need yet. ` +
|
|
92
92
|
`Add --yes to buy it anyway. \`${BINARY_NAME} expiring\` lists what is actually running out.`,
|
|
93
93
|
});
|
|
94
94
|
}
|
|
@@ -114,7 +114,7 @@ export async function extend(target, options = {}) {
|
|
|
114
114
|
}
|
|
115
115
|
else {
|
|
116
116
|
say(``);
|
|
117
|
-
say(` The storage IS extended and the payment has been made
|
|
117
|
+
say(` The storage IS extended and the payment has been made: transaction ${outcome.digest}.`);
|
|
118
118
|
say(` What failed is telling the NMTS server about it, so the drive will go on showing the`);
|
|
119
119
|
say(` old date until something tells it. ⛔ Do not run this command again for this file:`);
|
|
120
120
|
say(` that would buy the same epochs a second time. Opening the account in a browser reads`);
|
|
@@ -128,7 +128,7 @@ export async function extend(target, options = {}) {
|
|
|
128
128
|
}
|
|
129
129
|
else {
|
|
130
130
|
say(``);
|
|
131
|
-
say(` Extended. The storage now ends at epoch ${facts.newEndEpoch}
|
|
131
|
+
say(` Extended. The storage now ends at epoch ${facts.newEndEpoch}, ${daysLeftInWords(facts.daysLeftAfter)}.`);
|
|
132
132
|
say(` Transaction ${outcome.digest}`);
|
|
133
133
|
if (outcome.replay)
|
|
134
134
|
say(` The server had already recorded this transaction, so nothing was written twice.`);
|
|
@@ -150,14 +150,14 @@ export async function extend(target, options = {}) {
|
|
|
150
150
|
}
|
|
151
151
|
/** What the numbers say, for a person, in the order somebody deciding needs them. */
|
|
152
152
|
function describe(say, facts) {
|
|
153
|
-
const when = (epoch, left) => `epoch ${epoch}
|
|
153
|
+
const when = (epoch, left) => `epoch ${epoch}, ${daysLeftInWords(left)}`;
|
|
154
154
|
const cohort = facts.filesOnTheSameBlobs;
|
|
155
155
|
const unreachable = facts.partsThatCannotBeExtended;
|
|
156
156
|
say(`${facts.file}`);
|
|
157
157
|
say(` Storage ends at ${when(facts.endEpoch, facts.daysLeft)}.`);
|
|
158
158
|
say(` Extending by ${facts.epochs} epoch${facts.epochs === 1 ? "" : "s"} moves that to ` +
|
|
159
159
|
`${when(facts.newEndEpoch, facts.daysLeftAfter)}.`);
|
|
160
|
-
say(` Price ${facts.priceWal} WAL for ${facts.blobs} stored blob${facts.blobs === 1 ? "" : "s"}
|
|
160
|
+
say(` Price ${facts.priceWal} WAL for ${facts.blobs} stored blob${facts.blobs === 1 ? "" : "s"}: ` +
|
|
161
161
|
`storage only, because the writing was paid for when the file was uploaded.`);
|
|
162
162
|
if (cohort > 1) {
|
|
163
163
|
say(` ${cohort} of this account's files sit on the storage this pays for, so the same payment ` +
|
package/dist/commands/get.js
CHANGED
|
@@ -46,7 +46,7 @@ export async function get(target, options = {}) {
|
|
|
46
46
|
if (target === undefined || target === "") {
|
|
47
47
|
throw new NmtsError("Say which file to get.", {
|
|
48
48
|
exitCode: 2,
|
|
49
|
-
nextStep: `\`${BINARY_NAME} get <path
|
|
49
|
+
nextStep: `\`${BINARY_NAME} get <path>\`, with the path as \`${BINARY_NAME} ls\` prints it.`,
|
|
50
50
|
});
|
|
51
51
|
}
|
|
52
52
|
// ⛔ ONE PLACE RESOLVES THE CREDENTIALS, so the "no API key" refusal — the sentence a new user is
|
|
@@ -72,7 +72,7 @@ export async function get(target, options = {}) {
|
|
|
72
72
|
if (entry.kind !== KIND_FILE) {
|
|
73
73
|
throw new NmtsError(`No file at "${fullPathOf(index, entry)}".`, {
|
|
74
74
|
exitCode: 4,
|
|
75
|
-
nextStep: "That is a folder. Nothing was written
|
|
75
|
+
nextStep: "That is a folder. Nothing was written. This version gets one file at a time.",
|
|
76
76
|
});
|
|
77
77
|
}
|
|
78
78
|
if (entry.dekWrapped === undefined) {
|
|
@@ -134,13 +134,13 @@ async function make(target, options) {
|
|
|
134
134
|
if (entry.kind !== KIND_FILE) {
|
|
135
135
|
throw new NmtsError(`No file at "${fullPathOf(index, entry)}".`, {
|
|
136
136
|
exitCode: 4,
|
|
137
|
-
nextStep: "That is a folder. Nothing was written
|
|
137
|
+
nextStep: "That is a folder. Nothing was written. A handover carries one file.",
|
|
138
138
|
});
|
|
139
139
|
}
|
|
140
140
|
if (entry.dekWrapped === undefined || entry.contentHashCt === undefined) {
|
|
141
141
|
throw new NmtsError(`The file list holds no ${entry.dekWrapped === undefined ? "key" : "hash"} for "${entry.name}".`, {
|
|
142
142
|
exitCode: 4,
|
|
143
|
-
nextStep: "A handover carries both
|
|
143
|
+
nextStep: "A handover carries both: the key that opens the file and the hash the recipient checks. Nothing was written.",
|
|
144
144
|
});
|
|
145
145
|
}
|
|
146
146
|
checkHandoverName(entry.name, entry.size, network);
|
|
@@ -25,7 +25,7 @@ import { scopeNames } from "./key.js";
|
|
|
25
25
|
function asKeys(value) {
|
|
26
26
|
if (!isRecord(value) || !Array.isArray(value["keys"])) {
|
|
27
27
|
throw new NmtsError("The server listed the keys in a shape this version cannot read.", {
|
|
28
|
-
nextStep: `Update this tool
|
|
28
|
+
nextStep: `Update this tool (\`npm install -g ${BINARY_NAME}\`) or read them in a browser.`,
|
|
29
29
|
});
|
|
30
30
|
}
|
|
31
31
|
const out = [];
|
|
@@ -106,7 +106,7 @@ export async function keyList(options = {}) {
|
|
|
106
106
|
}
|
|
107
107
|
say(``);
|
|
108
108
|
say(` ${live.length} live of ${keys.length}. The key strings are not here: NMTS keeps no copy of them.`);
|
|
109
|
-
say(` \`${BINARY_NAME} key revoke <id>\` (or \`all\`) cuts one
|
|
109
|
+
say(` \`${BINARY_NAME} key revoke <id>\` (or \`all\`) cuts one. Whatever uses it stops at once.`);
|
|
110
110
|
return 0;
|
|
111
111
|
}
|
|
112
112
|
/** `nmts key revoke <id|all>`: the refusals, the tier gate's question, then the proof and the cut. */
|
package/dist/commands/key.js
CHANGED
|
@@ -161,7 +161,7 @@ function asIssued(value) {
|
|
|
161
161
|
// ⛔ IT NAMES NO PART OF THE ANSWER. Whatever came back may contain the key.
|
|
162
162
|
nextStep: `A key may have been made even though this could not read the reply. Check the account ` +
|
|
163
163
|
`screen at ${HOME_URL} and revoke anything you did not mean to keep, then update this ` +
|
|
164
|
-
`tool
|
|
164
|
+
`tool: \`npm install -g ${BINARY_NAME}\`.`,
|
|
165
165
|
});
|
|
166
166
|
}
|
|
167
167
|
return { key, keyId, scopes, expiresAt };
|
|
@@ -223,12 +223,12 @@ export async function keyNew(options = {}) {
|
|
|
223
223
|
say(``);
|
|
224
224
|
if (canStore) {
|
|
225
225
|
say(` Stored in ${credentialsPath()}, so every command on this machine now uses it.`);
|
|
226
|
-
say(` Whatever key was there before is no longer used
|
|
226
|
+
say(` Whatever key was there before is no longer used. Revoke it at ${HOME_URL} if it is`);
|
|
227
227
|
say(` running somewhere else.`);
|
|
228
228
|
}
|
|
229
229
|
else {
|
|
230
|
-
say(` ⛔ NOTHING WAS STORED. This machine keeps no NMTS key file
|
|
231
|
-
say(` the environment
|
|
230
|
+
say(` ⛔ NOTHING WAS STORED. This machine keeps no NMTS key file (it came from`);
|
|
231
|
+
say(` the environment), so there is nowhere to put the key. It is printed below because`);
|
|
232
232
|
say(` this is the only time it exists outside the server's memory.`);
|
|
233
233
|
}
|
|
234
234
|
if (options.print === true || !canStore) {
|
|
@@ -241,7 +241,7 @@ export async function keyNew(options = {}) {
|
|
|
241
241
|
// on it is one a person can select without dragging a label into their clipboard.
|
|
242
242
|
say(issued.key);
|
|
243
243
|
say(``);
|
|
244
|
-
say(` Put it in ${API_KEY_ENV_VAR}, or in a file named by ${API_KEY_ENV_VAR}_FILE
|
|
244
|
+
say(` Put it in ${API_KEY_ENV_VAR}, or in a file named by ${API_KEY_ENV_VAR}_FILE. The`);
|
|
245
245
|
say(` shape a container cannot leak. NMTS keeps no copy: lose it and the way back is to`);
|
|
246
246
|
say(` revoke it and make another.`);
|
|
247
247
|
}
|
package/dist/commands/link.js
CHANGED
|
@@ -20,8 +20,8 @@ import { destinationFor } from "../safe-path.js";
|
|
|
20
20
|
import { resolveServer } from "../server.js";
|
|
21
21
|
import { openSession } from "../session.js";
|
|
22
22
|
import { linkExpiryDays } from "../shared/lib/share/public-link.js";
|
|
23
|
-
const USAGE = `\`${BINARY_NAME} link make <path> [--hide-name] [--expires <n>d]
|
|
24
|
-
`\`${BINARY_NAME} link revoke <id
|
|
23
|
+
const USAGE = `\`${BINARY_NAME} link make <path> [--hide-name] [--expires <n>d]\`, \`${BINARY_NAME} link list <path>\`, ` +
|
|
24
|
+
`\`${BINARY_NAME} link revoke <id>\`, \`${BINARY_NAME} link open <link> [--out <path>]\``;
|
|
25
25
|
export async function link(sub, operand, options = {}) {
|
|
26
26
|
const say = options.write ?? ((line) => process.stdout.write(`${line}\n`));
|
|
27
27
|
if (sub !== "make" && sub !== "list" && sub !== "revoke" && sub !== "open") {
|
package/dist/commands/links.js
CHANGED
|
@@ -13,7 +13,7 @@ import { listLiveLinks, revokeAllLinks, revokeLink } from "../links.js";
|
|
|
13
13
|
import { readFileList } from "../manifest.js";
|
|
14
14
|
import { BINARY_NAME } from "../product.js";
|
|
15
15
|
import { openSession } from "../session.js";
|
|
16
|
-
const USAGE = `\`${BINARY_NAME} links
|
|
16
|
+
const USAGE = `\`${BINARY_NAME} links\`, \`${BINARY_NAME} links revoke <id>\`, \`${BINARY_NAME} links revoke-all\``;
|
|
17
17
|
export async function links(sub, operand, options = {}) {
|
|
18
18
|
const say = options.write ?? ((line) => process.stdout.write(`${line}\n`));
|
|
19
19
|
if (sub !== undefined && sub !== "revoke" && sub !== "revoke-all") {
|