@needmoretruth/nmts-cli 0.57.0 → 0.58.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 +11 -0
- package/README.ko.md +1 -1
- package/README.md +1 -1
- package/dist/artifact-about.d.ts +1 -1
- package/dist/commands/wallet-storage-buy.d.ts +22 -0
- package/dist/commands/wallet-storage-buy.js +111 -0
- package/dist/commands/wallet.js +3 -1
- package/dist/help-options.js +4 -2
- package/dist/help.js +2 -0
- package/dist/portable.d.ts +6 -1
- package/dist/portable.js +6 -1
- package/dist/product.d.ts +1 -1
- package/dist/product.js +1 -1
- package/dist/sponsor-check.d.ts +56 -0
- package/dist/sponsor-check.js +270 -0
- package/dist/sponsor-facts.d.ts +10 -0
- package/dist/sponsor-facts.js +75 -0
- package/dist/storage-control/buy.d.ts +65 -0
- package/dist/storage-control/buy.js +145 -0
- package/dist/storage-control-chain.d.ts +7 -0
- package/dist/storage-control-chain.js +19 -1
- package/dist/storage-control.d.ts +2 -0
- package/dist/storage-control.js +1 -0
- package/dist/upload-quote.d.ts +93 -0
- package/dist/upload-quote.js +135 -0
- package/dist/wallet-sign.d.ts +24 -0
- package/dist/wallet-sign.js +31 -1
- package/package.json +1 -1
- package/server.json +2 -2
package/dist/wallet-sign.js
CHANGED
|
@@ -6,7 +6,9 @@
|
|
|
6
6
|
// the other on a venue (`signSwap`), and the two halves of a wallet-paid upload — registering one
|
|
7
7
|
// part's blob (`signBlobRegister`, which buys the storage or binds a held resource and pays the
|
|
8
8
|
// relay's tip) and certifying it (`signBlobCertify`, gas only). Another transaction shape is a
|
|
9
|
-
// decision made here, in the open — the test pins the export list.
|
|
9
|
+
// decision made here, in the open — the test pins the export list. `signStorageOp` signs the
|
|
10
|
+
// storage-resource changes (buy, cut, join, hand over), and `signSponsored` signs a transaction
|
|
11
|
+
// another device built, only after `sponsor-check.ts` has passed it against the operator's policy.
|
|
10
12
|
//
|
|
11
13
|
// ⛔ AND ONE THING THAT IS NOT A TRANSACTION. `signMessage` signs a short text under the
|
|
12
14
|
// personal-message intent: it moves nothing, it cannot be replayed as a transaction, and it
|
|
@@ -31,6 +33,7 @@
|
|
|
31
33
|
// surfaces is a transaction signed by a wallet the person has never funded.
|
|
32
34
|
import { Ed25519Keypair } from "@mysten/sui/keypairs/ed25519";
|
|
33
35
|
import { Transaction } from "@mysten/sui/transactions";
|
|
36
|
+
import { normalizeSuiAddress } from "@mysten/sui/utils";
|
|
34
37
|
import { assertUsableCode } from "./account.js";
|
|
35
38
|
import { DERIVED, loadCrypto } from "./crypto.js";
|
|
36
39
|
import { NmtsError } from "./errors.js";
|
|
@@ -273,3 +276,30 @@ export const signStorageOp = async ({ network, code, wallet, shape, walrusPackag
|
|
|
273
276
|
}
|
|
274
277
|
return result.digest;
|
|
275
278
|
};
|
|
279
|
+
/**
|
|
280
|
+
* Sign a transaction somebody else's device built, as the operator that pays for it — only after
|
|
281
|
+
* `sponsor-check.ts` has passed it against the operator's policy.
|
|
282
|
+
*
|
|
283
|
+
* ⛔ CHECK, THEN SIGN, IN ONE DOOR. There is no way to reach the signature without the check: the
|
|
284
|
+
* bytes are judged here, by the same function an operator can call on its own, and a refusal
|
|
285
|
+
* throws before the keypair is even built. The policy's operator must be this wallet's address.
|
|
286
|
+
* ⛔ IT DOES NOT SUBMIT. The device that built the transaction submits it with this signature, the
|
|
287
|
+
* way any wallet's `signTransaction` answers.
|
|
288
|
+
*/
|
|
289
|
+
export async function signSponsored(input) {
|
|
290
|
+
const { judgeSponsored } = await import("./sponsor-check.js");
|
|
291
|
+
const facts = input.facts ?? (await (await import("./sponsor-facts.js")).sponsorFacts(input.network, input.policy.operator));
|
|
292
|
+
const verdict = await judgeSponsored(input.bytes, { ...input.policy, network: input.network }, facts);
|
|
293
|
+
if (!verdict.ok) {
|
|
294
|
+
throw new NmtsError(`SPONSOR_REFUSED: ${verdict.code}: ${verdict.reason}.`, {
|
|
295
|
+
exitCode: 4,
|
|
296
|
+
nextStep: "Nothing was signed. The transaction asks for something the operator's policy does not pay for.",
|
|
297
|
+
});
|
|
298
|
+
}
|
|
299
|
+
const keypair = await keypairFor(input.code, input.wallet);
|
|
300
|
+
if (keypair.toSuiAddress() !== normalizeSuiAddress(input.policy.operator)) {
|
|
301
|
+
throw new NmtsError(`SPONSOR_REFUSED: SPONSOR_SENDER: the policy names ${input.policy.operator}, and this wallet is ${keypair.toSuiAddress()}.`, { exitCode: 4, nextStep: "Nothing was signed. The operator in the policy is the wallet that signs." });
|
|
302
|
+
}
|
|
303
|
+
const signed = await keypair.signTransaction(input.bytes);
|
|
304
|
+
return { bytes: signed.bytes, signature: signed.signature, spends: verdict.spends };
|
|
305
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@needmoretruth/nmts-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.58.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.
|
|
9
|
+
"version": "0.58.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.
|
|
15
|
+
"version": "0.58.0",
|
|
16
16
|
"transport": {
|
|
17
17
|
"type": "stdio"
|
|
18
18
|
},
|