@hsuite/smart-engines-cli 1.1.1 → 1.2.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/dist/_lib/cluster.d.ts +11 -8
- package/dist/_lib/cluster.d.ts.map +1 -1
- package/dist/_lib/cluster.js +8 -35
- package/dist/_lib/cluster.js.map +1 -1
- package/dist/_lib/subscription-client.d.ts +152 -0
- package/dist/_lib/subscription-client.d.ts.map +1 -0
- package/dist/_lib/subscription-client.js +84 -0
- package/dist/_lib/subscription-client.js.map +1 -0
- package/dist/_lib/subscription-env.d.ts +20 -0
- package/dist/_lib/subscription-env.d.ts.map +1 -0
- package/dist/_lib/subscription-env.js +28 -0
- package/dist/_lib/subscription-env.js.map +1 -0
- package/dist/commands/billing.d.ts +17 -0
- package/dist/commands/billing.d.ts.map +1 -0
- package/dist/commands/billing.js +59 -0
- package/dist/commands/billing.js.map +1 -0
- package/dist/commands/deploy.d.ts.map +1 -1
- package/dist/commands/deploy.js +26 -16
- package/dist/commands/deploy.js.map +1 -1
- package/dist/commands/downgrade.d.ts +22 -0
- package/dist/commands/downgrade.d.ts.map +1 -0
- package/dist/commands/downgrade.js +55 -0
- package/dist/commands/downgrade.js.map +1 -0
- package/dist/commands/init.js +3 -6
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/renew.d.ts +19 -0
- package/dist/commands/renew.d.ts.map +1 -0
- package/dist/commands/renew.js +58 -0
- package/dist/commands/renew.js.map +1 -0
- package/dist/commands/subscribe.d.ts +40 -4
- package/dist/commands/subscribe.d.ts.map +1 -1
- package/dist/commands/subscribe.js +156 -94
- package/dist/commands/subscribe.js.map +1 -1
- package/dist/commands/upgrade.d.ts +41 -0
- package/dist/commands/upgrade.d.ts.map +1 -0
- package/dist/commands/upgrade.js +128 -0
- package/dist/commands/upgrade.js.map +1 -0
- package/dist/commands/usage.d.ts +22 -0
- package/dist/commands/usage.d.ts.map +1 -0
- package/dist/commands/usage.js +81 -0
- package/dist/commands/usage.js.map +1 -0
- package/dist/commands/verify.d.ts +19 -6
- package/dist/commands/verify.d.ts.map +1 -1
- package/dist/commands/verify.js +75 -15
- package/dist/commands/verify.js.map +1 -1
- package/dist/index.d.ts +8 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +19 -2
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.tierChangeCommand = exports.upgradeCommand = void 0;
|
|
7
|
+
exports.runUpgrade = runUpgrade;
|
|
8
|
+
exports.runCancelTierChange = runCancelTierChange;
|
|
9
|
+
/**
|
|
10
|
+
* `hsuite upgrade --to-tier <T>` — POST /api/v3/subscription/upgrade.
|
|
11
|
+
*
|
|
12
|
+
* If the server returns depositInstructions (top-up), display them and
|
|
13
|
+
* poll /status until PENDING_MINT, then POST /mint — same paid-tier
|
|
14
|
+
* loop as `hsuite subscribe`.
|
|
15
|
+
*
|
|
16
|
+
* Also exposes `hsuite tier-change cancel` as a sibling subcommand so
|
|
17
|
+
* pending upgrades/downgrades can be aborted.
|
|
18
|
+
*/
|
|
19
|
+
const commander_1 = require("commander");
|
|
20
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
21
|
+
const ora_1 = __importDefault(require("ora"));
|
|
22
|
+
const env_1 = require("../_lib/env");
|
|
23
|
+
const subscription_client_1 = require("../_lib/subscription-client");
|
|
24
|
+
const subscription_env_1 = require("../_lib/subscription-env");
|
|
25
|
+
const defaultSleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
26
|
+
async function runUpgrade(opts) {
|
|
27
|
+
if (!opts.toTier)
|
|
28
|
+
throw new Error('--to-tier is required');
|
|
29
|
+
const env = (0, env_1.readEnv)(opts.env);
|
|
30
|
+
const baseUrl = (0, subscription_env_1.requireValidatorUrl)(env, { gateway: opts.gateway });
|
|
31
|
+
const appId = (0, subscription_env_1.requireAppId)(env, { appId: opts.appId });
|
|
32
|
+
const client = (opts.clientFactory ?? ((b) => new subscription_client_1.SubscriptionClient({ baseUrl: b })))(baseUrl);
|
|
33
|
+
const sleep = opts.sleep ?? defaultSleep;
|
|
34
|
+
const res = await client.upgrade(appId, opts.toTier);
|
|
35
|
+
if (!res.success) {
|
|
36
|
+
throw new Error(`upgrade failed: ${res.message ?? 'unknown error'}`);
|
|
37
|
+
}
|
|
38
|
+
if (res.depositInstructions) {
|
|
39
|
+
renderDepositInstructions(res.depositInstructions, opts.toTier);
|
|
40
|
+
const deadline = Date.now() + (opts.pollTimeoutMs ?? 5 * 60 * 1000);
|
|
41
|
+
const interval = opts.pollIntervalMs ?? 5000;
|
|
42
|
+
while (true) {
|
|
43
|
+
const status = await client.status(appId);
|
|
44
|
+
const s = (status.status ?? '').toLowerCase();
|
|
45
|
+
if (s === 'pending_mint' || s === 'active' || s === 'minting')
|
|
46
|
+
break;
|
|
47
|
+
if (Date.now() > deadline) {
|
|
48
|
+
throw new Error('timed out waiting for deposit confirmation');
|
|
49
|
+
}
|
|
50
|
+
await sleep(interval);
|
|
51
|
+
}
|
|
52
|
+
const mint = await client.mint(appId);
|
|
53
|
+
if (!mint.success) {
|
|
54
|
+
throw new Error('mint after upgrade failed');
|
|
55
|
+
}
|
|
56
|
+
return { appId, toTier: opts.toTier, topUpRequired: true, effectiveAt: mint.expiresAt };
|
|
57
|
+
}
|
|
58
|
+
return {
|
|
59
|
+
appId,
|
|
60
|
+
toTier: opts.toTier,
|
|
61
|
+
topUpRequired: false,
|
|
62
|
+
effectiveAt: res.effectiveAt,
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
function renderDepositInstructions(d, toTier) {
|
|
66
|
+
console.log(chalk_1.default.bold.yellow(`\n Top-up required to upgrade to "${toTier}":`));
|
|
67
|
+
console.log(chalk_1.default.gray(` chain: ${d.chain}`));
|
|
68
|
+
console.log(chalk_1.default.gray(` amount: ${d.amount} (token ${d.tokenId})`));
|
|
69
|
+
console.log(chalk_1.default.gray(` to: ${d.walletAddress}\n`));
|
|
70
|
+
if (d.chain === 'xrpl') {
|
|
71
|
+
console.log(chalk_1.default.cyan(` XUMM deeplink: xumm://xrpl/send?to=${encodeURIComponent(d.walletAddress)}&amount=${encodeURIComponent(d.amount)}&token=${encodeURIComponent(d.tokenId)}\n`));
|
|
72
|
+
}
|
|
73
|
+
console.log(chalk_1.default.gray(' Waiting for deposit confirmation...\n'));
|
|
74
|
+
}
|
|
75
|
+
exports.upgradeCommand = new commander_1.Command('upgrade')
|
|
76
|
+
.description('Upgrade the subscription tier (may require a top-up deposit)')
|
|
77
|
+
.option('--env <file>', 'Env file with subscription appId', '.env.local')
|
|
78
|
+
.option('--gateway <url>', 'Validator/gateway URL (defaults to VALIDATOR_URL in env)')
|
|
79
|
+
.option('--app-id <id>', 'Override SUBSCRIPTION_APP_ID from env')
|
|
80
|
+
.requiredOption('--to-tier <tier>', 'Target tier (starter|professional|enterprise)')
|
|
81
|
+
.action(async (opts) => {
|
|
82
|
+
console.log(chalk_1.default.bold.cyan('\n hsuite upgrade\n'));
|
|
83
|
+
const spinner = (0, ora_1.default)(`upgrading to ${opts.toTier}...`).start();
|
|
84
|
+
try {
|
|
85
|
+
const result = await runUpgrade(opts);
|
|
86
|
+
spinner.succeed(`upgraded to ${result.toTier}${result.topUpRequired ? ' (top-up paid + NFT re-minted)' : ''}`);
|
|
87
|
+
if (result.effectiveAt !== undefined) {
|
|
88
|
+
console.log(chalk_1.default.gray(` effective: ${result.effectiveAt}`));
|
|
89
|
+
}
|
|
90
|
+
console.log(chalk_1.default.bold.green('\n ✓ upgraded\n'));
|
|
91
|
+
}
|
|
92
|
+
catch (err) {
|
|
93
|
+
spinner.fail(err.message);
|
|
94
|
+
process.exit(1);
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
async function runCancelTierChange(opts) {
|
|
98
|
+
const env = (0, env_1.readEnv)(opts.env);
|
|
99
|
+
const baseUrl = (0, subscription_env_1.requireValidatorUrl)(env, { gateway: opts.gateway });
|
|
100
|
+
const appId = (0, subscription_env_1.requireAppId)(env, { appId: opts.appId });
|
|
101
|
+
const client = (opts.clientFactory ?? ((b) => new subscription_client_1.SubscriptionClient({ baseUrl: b })))(baseUrl);
|
|
102
|
+
const res = await client.cancelTierChange(appId);
|
|
103
|
+
if (!res.success)
|
|
104
|
+
throw new Error(`tier-change cancel failed: ${res.message ?? 'unknown error'}`);
|
|
105
|
+
return { appId };
|
|
106
|
+
}
|
|
107
|
+
const cancelSubcommand = new commander_1.Command('cancel')
|
|
108
|
+
.description('Cancel a pending tier change')
|
|
109
|
+
.option('--env <file>', 'Env file with subscription appId', '.env.local')
|
|
110
|
+
.option('--gateway <url>', 'Validator/gateway URL (defaults to VALIDATOR_URL in env)')
|
|
111
|
+
.option('--app-id <id>', 'Override SUBSCRIPTION_APP_ID from env')
|
|
112
|
+
.action(async (opts) => {
|
|
113
|
+
console.log(chalk_1.default.bold.cyan('\n hsuite tier-change cancel\n'));
|
|
114
|
+
const spinner = (0, ora_1.default)('cancelling pending tier change...').start();
|
|
115
|
+
try {
|
|
116
|
+
const r = await runCancelTierChange(opts);
|
|
117
|
+
spinner.succeed(`cancelled (appId=${r.appId})`);
|
|
118
|
+
console.log(chalk_1.default.bold.green('\n ✓ cancelled\n'));
|
|
119
|
+
}
|
|
120
|
+
catch (err) {
|
|
121
|
+
spinner.fail(err.message);
|
|
122
|
+
process.exit(1);
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
exports.tierChangeCommand = new commander_1.Command('tier-change')
|
|
126
|
+
.description('Manage pending tier changes (cancel)')
|
|
127
|
+
.addCommand(cancelSubcommand);
|
|
128
|
+
//# sourceMappingURL=upgrade.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upgrade.js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CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC,CAAC,CAAC;AAEQ,QAAA,iBAAiB,GAAG,IAAI,mBAAO,CAAC,aAAa,CAAC;KACxD,WAAW,CAAC,sCAAsC,CAAC;KACnD,UAAU,CAAC,gBAAgB,CAAC,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `hsuite usage` — pretty-print today's usage + overage / grace info.
|
|
3
|
+
*
|
|
4
|
+
* Calls both GET /api/v3/subscription/usage/:appId (category breakdown)
|
|
5
|
+
* and GET /api/v3/subscription/usage/status/:appId (overage + grace +
|
|
6
|
+
* projection) when available.
|
|
7
|
+
*/
|
|
8
|
+
import { Command } from 'commander';
|
|
9
|
+
import { SubscriptionClient, UsageStatusResponse, UsageSummaryResponse } from '../_lib/subscription-client';
|
|
10
|
+
type UsageOpts = {
|
|
11
|
+
env: string;
|
|
12
|
+
gateway?: string;
|
|
13
|
+
appId?: string;
|
|
14
|
+
clientFactory?: (baseUrl: string) => SubscriptionClient;
|
|
15
|
+
};
|
|
16
|
+
export declare function runUsage(opts: UsageOpts): Promise<{
|
|
17
|
+
summary: UsageSummaryResponse;
|
|
18
|
+
status: UsageStatusResponse | null;
|
|
19
|
+
}>;
|
|
20
|
+
export declare const usageCommand: Command;
|
|
21
|
+
export {};
|
|
22
|
+
//# sourceMappingURL=usage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usage.d.ts","sourceRoot":"","sources":["../../src/commands/usage.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,EACrB,MAAM,6BAA6B,CAAC;AAGrC,KAAK,SAAS,GAAG;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,aAAa,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,kBAAkB,CAAC;CACzD,CAAC;AAEF,wBAAsB,QAAQ,CAAC,IAAI,EAAE,SAAS,GAAG,OAAO,CAAC;IACvD,OAAO,EAAE,oBAAoB,CAAC;IAC9B,MAAM,EAAE,mBAAmB,GAAG,IAAI,CAAC;CACpC,CAAC,CAeD;AAED,eAAO,MAAM,YAAY,SAgDrB,CAAC"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.usageCommand = void 0;
|
|
7
|
+
exports.runUsage = runUsage;
|
|
8
|
+
/**
|
|
9
|
+
* `hsuite usage` — pretty-print today's usage + overage / grace info.
|
|
10
|
+
*
|
|
11
|
+
* Calls both GET /api/v3/subscription/usage/:appId (category breakdown)
|
|
12
|
+
* and GET /api/v3/subscription/usage/status/:appId (overage + grace +
|
|
13
|
+
* projection) when available.
|
|
14
|
+
*/
|
|
15
|
+
const commander_1 = require("commander");
|
|
16
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
17
|
+
const env_1 = require("../_lib/env");
|
|
18
|
+
const subscription_client_1 = require("../_lib/subscription-client");
|
|
19
|
+
const subscription_env_1 = require("../_lib/subscription-env");
|
|
20
|
+
async function runUsage(opts) {
|
|
21
|
+
const env = (0, env_1.readEnv)(opts.env);
|
|
22
|
+
const baseUrl = (0, subscription_env_1.requireValidatorUrl)(env, { gateway: opts.gateway });
|
|
23
|
+
const appId = (0, subscription_env_1.requireAppId)(env, { appId: opts.appId });
|
|
24
|
+
const client = (opts.clientFactory ?? ((b) => new subscription_client_1.SubscriptionClient({ baseUrl: b })))(baseUrl);
|
|
25
|
+
const summary = await client.usage(appId);
|
|
26
|
+
// Status is optional — older clusters may 400 without ConsumptionTracker.
|
|
27
|
+
let status = null;
|
|
28
|
+
try {
|
|
29
|
+
status = await client.usageStatus(appId);
|
|
30
|
+
}
|
|
31
|
+
catch {
|
|
32
|
+
status = null;
|
|
33
|
+
}
|
|
34
|
+
return { summary, status };
|
|
35
|
+
}
|
|
36
|
+
exports.usageCommand = new commander_1.Command('usage')
|
|
37
|
+
.description("Pretty-print today's usage + overage info")
|
|
38
|
+
.option('--env <file>', 'Env file with subscription appId', '.env.local')
|
|
39
|
+
.option('--gateway <url>', 'Validator/gateway URL (defaults to VALIDATOR_URL in env)')
|
|
40
|
+
.option('--app-id <id>', 'Override SUBSCRIPTION_APP_ID from env')
|
|
41
|
+
.action(async (opts) => {
|
|
42
|
+
console.log(chalk_1.default.bold.cyan('\n hsuite usage\n'));
|
|
43
|
+
try {
|
|
44
|
+
const { summary, status } = await runUsage(opts);
|
|
45
|
+
console.log(chalk_1.default.gray(` app: ${summary.appId}`));
|
|
46
|
+
console.log(chalk_1.default.gray(` total today: ${summary.total} calls`));
|
|
47
|
+
console.log(chalk_1.default.gray(` records: ${summary.recordCount}`));
|
|
48
|
+
if (summary.lastUpdated) {
|
|
49
|
+
console.log(chalk_1.default.gray(` updated: ${summary.lastUpdated}`));
|
|
50
|
+
}
|
|
51
|
+
const byCat = Object.entries(summary.byCategory ?? {});
|
|
52
|
+
if (byCat.length > 0) {
|
|
53
|
+
console.log(chalk_1.default.bold.white('\n by category:'));
|
|
54
|
+
for (const [cat, n] of byCat) {
|
|
55
|
+
console.log(chalk_1.default.gray(` ${cat.padEnd(12)} ${n}`));
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
if (status) {
|
|
59
|
+
console.log(chalk_1.default.bold.white('\n status:'));
|
|
60
|
+
console.log(chalk_1.default.gray(` usage: ${status.usagePercent}% (${status.currentUsage}/${status.dailyLimit})`));
|
|
61
|
+
console.log(chalk_1.default.gray(` overage: ${status.overagePercent}%`));
|
|
62
|
+
console.log(chalk_1.default.gray(` blocked: ${status.blocked}`));
|
|
63
|
+
console.log(chalk_1.default.gray(` inGrace: ${status.inGracePeriod}`));
|
|
64
|
+
if (status.graceExpiresAt) {
|
|
65
|
+
console.log(chalk_1.default.gray(` graceUntil: ${status.graceExpiresAt}`));
|
|
66
|
+
}
|
|
67
|
+
if (status.projectedDaysUntilLimit !== null) {
|
|
68
|
+
console.log(chalk_1.default.gray(` projected: ${status.projectedDaysUntilLimit} day(s) until limit`));
|
|
69
|
+
}
|
|
70
|
+
if (status.suggestUpgrade && status.nextTier) {
|
|
71
|
+
console.log(chalk_1.default.yellow(`\n suggested upgrade: ${status.nextTier.tier} (${status.nextTier.apiCallsPerDay}/day, ${status.nextTier.monthlyPriceHsuite} HSUITE/mo)`));
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
console.log('');
|
|
75
|
+
}
|
|
76
|
+
catch (err) {
|
|
77
|
+
console.error(chalk_1.default.red(` ${err.message}\n`));
|
|
78
|
+
process.exit(1);
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
//# sourceMappingURL=usage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usage.js","sourceRoot":"","sources":["../../src/commands/usage.ts"],"names":[],"mappings":";;;;;;AAwBA,4BAkBC;AA1CD;;;;;;GAMG;AACH,yCAAoC;AACpC,kDAA0B;AAC1B,qCAAsC;AACtC,qEAIqC;AACrC,+DAA6E;AAStE,KAAK,UAAU,QAAQ,CAAC,IAAe;IAI5C,MAAM,GAAG,GAAG,IAAA,aAAO,EAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC9B,MAAM,OAAO,GAAG,IAAA,sCAAmB,EAAC,GAAG,EAAE,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC;IACpE,MAAM,KAAK,GAAG,IAAA,+BAAY,EAAC,GAAG,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC;IACv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AAC,IAAI,CAAC,oBAAoB,MAAM,CAAC,aAAa,EAAE,CAAC,CAAC,CAAC;YACpE,IAAI,MAAM,CAAC,cAAc,EAAE,CAAC;gBAC1B,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,IAAI,CAAC,oBAAoB,MAAM,CAAC,cAAc,EAAE,CAAC,CAAC,CAAC;YACvE,CAAC;YACD,IAAI,MAAM,CAAC,uBAAuB,KAAK,IAAI,EAAE,CAAC;gBAC5C,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,IAAI,CAAC,oBAAoB,MAAM,CAAC,uBAAuB,qBAAqB,CAAC,CAAC,CAAC;YACnG,CAAC;YACD,IAAI,MAAM,CAAC,cAAc,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;gBAC7C,OAAO,CAAC,GAAG,CACT,eAAK,CAAC,MAAM,CACV,0BAA0B,MAAM,CAAC,QAAQ,CAAC,IAAI,KAAK,MAAM,CAAC,QAAQ,CAAC,cAAc,SAAS,MAAM,CAAC,QAAQ,CAAC,kBAAkB,aAAa,CAC1I,CACF,CAAC;YACJ,CAAC;QACH,CAAC;QACD,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAClB,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,CAAC,KAAK,CAAC,eAAK,CAAC,GAAG,CAAC,KAAM,GAAa,CAAC,OAAO,IAAI,CAAC,CAAC,CAAC;QAC1D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC,CAAC,CAAC"}
|
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `hsuite verify` — verify a PQC attestation cert
|
|
2
|
+
* `hsuite verify` — verify a PQC attestation cert (Sig program) OR a Kyber
|
|
3
|
+
* hybrid envelope (Kyber Arc 11).
|
|
3
4
|
*
|
|
4
5
|
* PR 11.1 — Arc 11 (external-verifier surface). Thin Commander wrapper
|
|
5
6
|
* around `verifyPqcAttestation` from `@hsuite/smart-engines-sdk/pqc-verify`
|
|
6
|
-
* (PR 11.0)
|
|
7
|
+
* (PR 11.0) AND `verifyPqcEnvelope` from
|
|
8
|
+
* `@hsuite/smart-engines-sdk/pqc-verify-envelope` (Kyber Arc 11).
|
|
7
9
|
*
|
|
8
|
-
*
|
|
10
|
+
* Four invocation modes:
|
|
11
|
+
*
|
|
12
|
+
* - Direct cert verify (Sig):
|
|
9
13
|
* hsuite verify --cert <cert.json> --payload <payload.json>
|
|
10
14
|
*
|
|
11
|
-
* - Fetch-then-verify via smart-host proxy (PR #820):
|
|
15
|
+
* - Fetch-then-verify cert via smart-host proxy (Sig, PR #820):
|
|
12
16
|
* hsuite verify --topic-msg <consumer>/<contentHash> --payload <p.json>
|
|
13
17
|
*
|
|
14
18
|
* The proxy endpoint is `GET /api/pqc-attestation/<consumer>/<contentHash>`
|
|
@@ -18,14 +22,23 @@
|
|
|
18
22
|
* parity; the value is the consumer/contentHash slug the proxy actually
|
|
19
23
|
* accepts.
|
|
20
24
|
*
|
|
25
|
+
* - Envelope verify (Kyber):
|
|
26
|
+
* hsuite verify --envelope <envelope.json>
|
|
27
|
+
* [--expected-label <label>]
|
|
28
|
+
* [--expected-fingerprint <hex>]
|
|
29
|
+
*
|
|
30
|
+
* Observation-only — schema + base64 + timestamp + optional claim
|
|
31
|
+
* checks. No decryption, no key access.
|
|
32
|
+
*
|
|
21
33
|
* - Help: hsuite verify --help
|
|
22
34
|
*
|
|
23
35
|
* Exit codes:
|
|
24
|
-
* 0 cert valid
|
|
25
|
-
* 1 cert invalid (specific reason printed to stderr) OR usage error
|
|
36
|
+
* 0 cert/envelope valid
|
|
37
|
+
* 1 cert/envelope invalid (specific reason printed to stderr) OR usage error
|
|
26
38
|
* 2 network / fetch error (only possible in --topic-msg mode)
|
|
27
39
|
*
|
|
28
40
|
* @see docs/superpowers/specs/2026-05-27-pqc-arc11-external-verifier-design.md §4.2
|
|
41
|
+
* @see docs/superpowers/specs/2026-05-29-kyber-mlkem-production-readiness.md §5 Arc 11
|
|
29
42
|
* @see docs/superpowers/plans/2026-05-27-pqc-arc11-external-verifier-plan.md PR 11.1
|
|
30
43
|
*/
|
|
31
44
|
import { Command } from 'commander';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verify.d.ts","sourceRoot":"","sources":["../../src/commands/verify.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"verify.d.ts","sourceRoot":"","sources":["../../src/commands/verify.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAgGpC;;;;GAIG;AACH,wBAAgB,kBAAkB,IAAI,OAAO,CAwM5C;AAED;;;GAGG;AACH,eAAO,MAAM,aAAa,SAAuB,CAAC"}
|
package/dist/commands/verify.js
CHANGED
|
@@ -6,16 +6,20 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.verifyCommand = void 0;
|
|
7
7
|
exports.buildVerifyCommand = buildVerifyCommand;
|
|
8
8
|
/**
|
|
9
|
-
* `hsuite verify` — verify a PQC attestation cert
|
|
9
|
+
* `hsuite verify` — verify a PQC attestation cert (Sig program) OR a Kyber
|
|
10
|
+
* hybrid envelope (Kyber Arc 11).
|
|
10
11
|
*
|
|
11
12
|
* PR 11.1 — Arc 11 (external-verifier surface). Thin Commander wrapper
|
|
12
13
|
* around `verifyPqcAttestation` from `@hsuite/smart-engines-sdk/pqc-verify`
|
|
13
|
-
* (PR 11.0)
|
|
14
|
+
* (PR 11.0) AND `verifyPqcEnvelope` from
|
|
15
|
+
* `@hsuite/smart-engines-sdk/pqc-verify-envelope` (Kyber Arc 11).
|
|
14
16
|
*
|
|
15
|
-
*
|
|
17
|
+
* Four invocation modes:
|
|
18
|
+
*
|
|
19
|
+
* - Direct cert verify (Sig):
|
|
16
20
|
* hsuite verify --cert <cert.json> --payload <payload.json>
|
|
17
21
|
*
|
|
18
|
-
* - Fetch-then-verify via smart-host proxy (PR #820):
|
|
22
|
+
* - Fetch-then-verify cert via smart-host proxy (Sig, PR #820):
|
|
19
23
|
* hsuite verify --topic-msg <consumer>/<contentHash> --payload <p.json>
|
|
20
24
|
*
|
|
21
25
|
* The proxy endpoint is `GET /api/pqc-attestation/<consumer>/<contentHash>`
|
|
@@ -25,21 +29,36 @@ exports.buildVerifyCommand = buildVerifyCommand;
|
|
|
25
29
|
* parity; the value is the consumer/contentHash slug the proxy actually
|
|
26
30
|
* accepts.
|
|
27
31
|
*
|
|
32
|
+
* - Envelope verify (Kyber):
|
|
33
|
+
* hsuite verify --envelope <envelope.json>
|
|
34
|
+
* [--expected-label <label>]
|
|
35
|
+
* [--expected-fingerprint <hex>]
|
|
36
|
+
*
|
|
37
|
+
* Observation-only — schema + base64 + timestamp + optional claim
|
|
38
|
+
* checks. No decryption, no key access.
|
|
39
|
+
*
|
|
28
40
|
* - Help: hsuite verify --help
|
|
29
41
|
*
|
|
30
42
|
* Exit codes:
|
|
31
|
-
* 0 cert valid
|
|
32
|
-
* 1 cert invalid (specific reason printed to stderr) OR usage error
|
|
43
|
+
* 0 cert/envelope valid
|
|
44
|
+
* 1 cert/envelope invalid (specific reason printed to stderr) OR usage error
|
|
33
45
|
* 2 network / fetch error (only possible in --topic-msg mode)
|
|
34
46
|
*
|
|
35
47
|
* @see docs/superpowers/specs/2026-05-27-pqc-arc11-external-verifier-design.md §4.2
|
|
48
|
+
* @see docs/superpowers/specs/2026-05-29-kyber-mlkem-production-readiness.md §5 Arc 11
|
|
36
49
|
* @see docs/superpowers/plans/2026-05-27-pqc-arc11-external-verifier-plan.md PR 11.1
|
|
37
50
|
*/
|
|
38
51
|
const commander_1 = require("commander");
|
|
39
52
|
const chalk_1 = __importDefault(require("chalk"));
|
|
40
53
|
const fs_1 = require("fs");
|
|
41
54
|
const path_1 = require("path");
|
|
42
|
-
|
|
55
|
+
// NOTE: imported from the SDK root barrel (not the `pqc-verify` /
|
|
56
|
+
// `pqc-verify-envelope` subpath exports) because the CLI's tsconfig.build.json
|
|
57
|
+
// uses classic `moduleResolution: "node"`, which doesn't honor package.json
|
|
58
|
+
// `exports` subpaths (TS2307 — added in TS 4.7 via `node16`/`nodenext`).
|
|
59
|
+
// The SDK re-exports both helpers from `libs/smartengine-sdk/src/index.ts`,
|
|
60
|
+
// so root-barrel imports resolve cleanly under classic resolution.
|
|
61
|
+
const smart_engines_sdk_1 = require("@hsuite/smart-engines-sdk");
|
|
43
62
|
const cluster_1 = require("../_lib/cluster");
|
|
44
63
|
/**
|
|
45
64
|
* Slug shape for `--topic-msg`. Matches the proxy controller's two
|
|
@@ -121,23 +140,64 @@ async function fetchCertFromProxy(args) {
|
|
|
121
140
|
*/
|
|
122
141
|
function buildVerifyCommand() {
|
|
123
142
|
const cmd = new commander_1.Command('verify')
|
|
124
|
-
.description('Verify a PQC attestation cert
|
|
125
|
-
.option('--cert <path>', 'Path to the PQC cert JSON file (direct-verify mode)')
|
|
143
|
+
.description('Verify a PQC attestation cert (Sig) or a Kyber hybrid envelope (Arc 11)')
|
|
144
|
+
.option('--cert <path>', 'Path to the PQC cert JSON file (direct-verify cert mode)')
|
|
126
145
|
.option('--topic-msg <consumer/contentHash>', 'Fetch the cert via smart-host proxy at /api/pqc-attestation/<consumer>/<contentHash> then verify')
|
|
127
|
-
.option('--
|
|
146
|
+
.option('--envelope <path>', 'Path to a Kyber hybrid envelope JSON file (observation-only verify; no decryption)')
|
|
147
|
+
.option('--payload <path>', 'Path to the JSON payload to verify against (cert modes only)')
|
|
148
|
+
.option('--expected-label <label>', 'Kyber envelope: REQUIRE the envelope.kdfLabel to equal this value (envelope mode only)')
|
|
149
|
+
.option('--expected-fingerprint <hex>', 'Kyber envelope: REQUIRE the envelope.recipientPkFingerprint to equal this hex value (envelope mode only)')
|
|
128
150
|
.option('--server <url>', 'Smart-host base URL for --topic-msg mode (default: $SMART_HOST_URL / $VALIDATOR_URL / public testnet)')
|
|
129
151
|
.addHelpText('after', `
|
|
130
152
|
Examples:
|
|
131
153
|
hsuite verify --cert ./cert.json --payload ./payload.json
|
|
132
154
|
hsuite verify --topic-msg license-envelope/abc...def --payload ./payload.json
|
|
155
|
+
hsuite verify --envelope ./envelope.json
|
|
156
|
+
hsuite verify --envelope ./envelope.json --expected-label smart-app-secret-envelope-v1
|
|
133
157
|
|
|
134
158
|
Exit codes:
|
|
135
|
-
0 cert valid
|
|
136
|
-
1 cert invalid (with reason on stderr) OR usage error
|
|
159
|
+
0 cert/envelope valid
|
|
160
|
+
1 cert/envelope invalid (with reason on stderr) OR usage error
|
|
137
161
|
2 network / fetch error (only in --topic-msg mode)
|
|
138
162
|
`)
|
|
139
163
|
.action(async (opts) => {
|
|
140
|
-
// ──
|
|
164
|
+
// ── Envelope mode (Kyber Arc 11) — short-circuits before cert flow ────
|
|
165
|
+
// Mode is mutually exclusive with --cert/--topic-msg/--payload.
|
|
166
|
+
const haveEnvelope = !!opts.envelope;
|
|
167
|
+
if (haveEnvelope) {
|
|
168
|
+
if (opts.cert || opts.topicMsg || opts.payload) {
|
|
169
|
+
console.error(chalk_1.default.red(' --envelope is mutually exclusive with --cert/--topic-msg/--payload\n'));
|
|
170
|
+
cmd.outputHelp();
|
|
171
|
+
process.exit(1);
|
|
172
|
+
}
|
|
173
|
+
let envelopeJson;
|
|
174
|
+
try {
|
|
175
|
+
envelopeJson = readJsonFile('envelope', opts.envelope);
|
|
176
|
+
}
|
|
177
|
+
catch (err) {
|
|
178
|
+
console.error(chalk_1.default.red(` ${err.message}\n`));
|
|
179
|
+
process.exit(1);
|
|
180
|
+
}
|
|
181
|
+
const result = await (0, smart_engines_sdk_1.verifyPqcEnvelope)(envelopeJson, {
|
|
182
|
+
expectedLabel: opts.expectedLabel,
|
|
183
|
+
expectedRecipientPkFingerprint: opts.expectedFingerprint,
|
|
184
|
+
});
|
|
185
|
+
if (result.valid) {
|
|
186
|
+
console.log(chalk_1.default.green(` Envelope valid — version=${result.version}` +
|
|
187
|
+
(result.details.kemAlgorithm
|
|
188
|
+
? `, kem=${result.details.kemAlgorithm}`
|
|
189
|
+
: '') +
|
|
190
|
+
(result.details.kdfLabel
|
|
191
|
+
? `, label='${result.details.kdfLabel}'`
|
|
192
|
+
: '')));
|
|
193
|
+
process.exit(0);
|
|
194
|
+
}
|
|
195
|
+
else {
|
|
196
|
+
console.error(chalk_1.default.red(` Envelope invalid — ${result.reason}`));
|
|
197
|
+
process.exit(1);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
// ── Cert-mode flag validation ─────────────────────────────────────────
|
|
141
201
|
if (!opts.payload) {
|
|
142
202
|
console.error(chalk_1.default.red(' --payload is required\n'));
|
|
143
203
|
cmd.outputHelp();
|
|
@@ -146,7 +206,7 @@ Exit codes:
|
|
|
146
206
|
const haveCert = !!opts.cert;
|
|
147
207
|
const haveTopicMsg = !!opts.topicMsg;
|
|
148
208
|
if (!haveCert && !haveTopicMsg) {
|
|
149
|
-
console.error(chalk_1.default.red(' one of --cert
|
|
209
|
+
console.error(chalk_1.default.red(' one of --cert, --topic-msg, or --envelope is required\n'));
|
|
150
210
|
cmd.outputHelp();
|
|
151
211
|
process.exit(1);
|
|
152
212
|
}
|
|
@@ -204,7 +264,7 @@ Exit codes:
|
|
|
204
264
|
}
|
|
205
265
|
}
|
|
206
266
|
// ── Verify ────────────────────────────────────────────────────────────
|
|
207
|
-
const result = await (0,
|
|
267
|
+
const result = await (0, smart_engines_sdk_1.verifyPqcAttestation)(cert, payload);
|
|
208
268
|
if (result.valid) {
|
|
209
269
|
const n = result.verifiedSignerCount ?? 0;
|
|
210
270
|
// `signers.length` is on the cert (already schema-validated by
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verify.js","sourceRoot":"","sources":["../../src/commands/verify.ts"],"names":[],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"verify.js","sourceRoot":"","sources":["../../src/commands/verify.ts"],"names":[],"mappings":";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,CAAC,GAAG,KAAK,CAAC,OAAO,CAAE,IAA8B,CAAC,OAAO,CAAC;gBAC9D,CAAC,CAAC,CAAE,IAA+B,CAAC,OAAO,CAAC,MAAM,CAAC;gBACnD,CAAC,CAAC,CAAC,CAAC;YACN,OAAO,CAAC,GAAG,CACT,eAAK,CAAC,KAAK,CACT,kBAAkB,CAAC,OAAO,CAAC,kCAAkC,CAC9D,CACF,CAAC;YACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,KAAK,CACX,eAAK,CAAC,GAAG,CAAC,oBAAoB,cAAc,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAC/D,CAAC;YACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC,CAAC,CAAC;IAEL,OAAO,GAAG,CAAC;AACb,CAAC;AAED;;;GAGG;AACU,QAAA,aAAa,GAAG,kBAAkB,EAAE,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -4,8 +4,14 @@
|
|
|
4
4
|
*
|
|
5
5
|
* hsuite init Generate XRPL testnet wallet, fund via
|
|
6
6
|
* faucet, write .env.local.
|
|
7
|
-
* hsuite subscribe --
|
|
8
|
-
*
|
|
7
|
+
* hsuite subscribe [--tier T] Mint a subscription NFT via the cluster's
|
|
8
|
+
* /api/v3/subscription/* surface.
|
|
9
|
+
* hsuite renew Extend the subscription lock period.
|
|
10
|
+
* hsuite upgrade --to-tier T Upgrade tier (may require a top-up).
|
|
11
|
+
* hsuite downgrade --to-tier T Schedule a downgrade for next renewal.
|
|
12
|
+
* hsuite tier-change cancel Cancel a pending tier change.
|
|
13
|
+
* hsuite usage Print today's usage + overage info.
|
|
14
|
+
* hsuite billing Print the billing-ledger entries.
|
|
9
15
|
* hsuite deploy --manifest <f> Deploy a smart-app from a JSON manifest.
|
|
10
16
|
*
|
|
11
17
|
* Smart Engines V3 is XRPL-only for smart-app authentication and
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA;;;;;;;;;;;;;;;;;;GAkBG"}
|
package/dist/index.js
CHANGED
|
@@ -5,8 +5,14 @@
|
|
|
5
5
|
*
|
|
6
6
|
* hsuite init Generate XRPL testnet wallet, fund via
|
|
7
7
|
* faucet, write .env.local.
|
|
8
|
-
* hsuite subscribe --
|
|
9
|
-
*
|
|
8
|
+
* hsuite subscribe [--tier T] Mint a subscription NFT via the cluster's
|
|
9
|
+
* /api/v3/subscription/* surface.
|
|
10
|
+
* hsuite renew Extend the subscription lock period.
|
|
11
|
+
* hsuite upgrade --to-tier T Upgrade tier (may require a top-up).
|
|
12
|
+
* hsuite downgrade --to-tier T Schedule a downgrade for next renewal.
|
|
13
|
+
* hsuite tier-change cancel Cancel a pending tier change.
|
|
14
|
+
* hsuite usage Print today's usage + overage info.
|
|
15
|
+
* hsuite billing Print the billing-ledger entries.
|
|
10
16
|
* hsuite deploy --manifest <f> Deploy a smart-app from a JSON manifest.
|
|
11
17
|
*
|
|
12
18
|
* Smart Engines V3 is XRPL-only for smart-app authentication and
|
|
@@ -54,6 +60,11 @@ const path = __importStar(require("path"));
|
|
|
54
60
|
const init_1 = require("./commands/init");
|
|
55
61
|
const subscribe_1 = require("./commands/subscribe");
|
|
56
62
|
const deploy_1 = require("./commands/deploy");
|
|
63
|
+
const renew_1 = require("./commands/renew");
|
|
64
|
+
const upgrade_1 = require("./commands/upgrade");
|
|
65
|
+
const downgrade_1 = require("./commands/downgrade");
|
|
66
|
+
const usage_1 = require("./commands/usage");
|
|
67
|
+
const billing_1 = require("./commands/billing");
|
|
57
68
|
const governance_1 = require("./commands/governance");
|
|
58
69
|
const hist_balance_1 = require("./commands/hist-balance");
|
|
59
70
|
const personhood_1 = require("./commands/personhood");
|
|
@@ -76,6 +87,12 @@ program
|
|
|
76
87
|
.version(getVersion());
|
|
77
88
|
program.addCommand(init_1.initCommand);
|
|
78
89
|
program.addCommand(subscribe_1.subscribeCommand);
|
|
90
|
+
program.addCommand(renew_1.renewCommand);
|
|
91
|
+
program.addCommand(upgrade_1.upgradeCommand);
|
|
92
|
+
program.addCommand(downgrade_1.downgradeCommand);
|
|
93
|
+
program.addCommand(upgrade_1.tierChangeCommand);
|
|
94
|
+
program.addCommand(usage_1.usageCommand);
|
|
95
|
+
program.addCommand(billing_1.billingCommand);
|
|
79
96
|
program.addCommand(deploy_1.deployCommand);
|
|
80
97
|
program.addCommand(governance_1.governanceCommand);
|
|
81
98
|
program.addCommand(hist_balance_1.histBalanceCommand);
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AAEA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AAEA;;;;;;;;;;;;;;;;;;GAkBG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,yCAAoC;AACpC,+CAAiC;AACjC,uCAAyB;AACzB,2CAA6B;AAC7B,0CAA8C;AAC9C,oDAAwD;AACxD,8CAAkD;AAClD,4CAAgD;AAChD,gDAAuE;AACvE,oDAAwD;AACxD,4CAAgD;AAChD,gDAAoD;AACpD,sDAA0D;AAC1D,0DAA6D;AAC7D,sDAA0D;AAC1D,8CAAkD;AAElD,MAAM,CAAC,MAAM,EAAE,CAAC;AAEhB,SAAS,UAAU;IACjB,IAAI,CAAC;QACH,MAAM,eAAe,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,cAAc,CAAC,CAAC;QACnE,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC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
{
|
|
2
2
|
"name": "@hsuite/smart-engines-cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "HSuite CLI for smart-app deployment and management",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"prepublishOnly": "npm run clean && npm run build"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@hsuite/smart-engines-sdk": "^3.
|
|
21
|
+
"@hsuite/smart-engines-sdk": "^3.4.0",
|
|
22
22
|
"chalk": "^4.1.2",
|
|
23
23
|
"commander": "^11.1.0",
|
|
24
24
|
"dotenv": "^17.2.3",
|