@certen.io/cli 0.5.0 → 0.7.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/CHANGELOG.md +431 -0
- package/README.md +232 -160
- package/dist/chains.d.ts +67 -0
- package/dist/chains.js +242 -0
- package/dist/chains.js.map +1 -0
- package/dist/commands/admin.js +49 -4
- package/dist/commands/admin.js.map +1 -1
- package/dist/commands/auth.js +145 -12
- package/dist/commands/auth.js.map +1 -1
- package/dist/commands/billing.js +648 -40
- package/dist/commands/billing.js.map +1 -1
- package/dist/commands/call.d.ts +2 -0
- package/dist/commands/call.js +168 -0
- package/dist/commands/call.js.map +1 -0
- package/dist/commands/chains.d.ts +2 -0
- package/dist/commands/chains.js +123 -0
- package/dist/commands/chains.js.map +1 -0
- package/dist/commands/doctor.d.ts +2 -0
- package/dist/commands/doctor.js +171 -0
- package/dist/commands/doctor.js.map +1 -0
- package/dist/commands/errors-catalogue.d.ts +2 -0
- package/dist/commands/errors-catalogue.js +83 -0
- package/dist/commands/errors-catalogue.js.map +1 -0
- package/dist/commands/identity.js +269 -19
- package/dist/commands/identity.js.map +1 -1
- package/dist/commands/init.d.ts +2 -0
- package/dist/commands/init.js +307 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/keys.js +2 -0
- package/dist/commands/keys.js.map +1 -1
- package/dist/commands/oauth-clients.d.ts +2 -0
- package/dist/commands/oauth-clients.js +131 -0
- package/dist/commands/oauth-clients.js.map +1 -0
- package/dist/commands/orgs.d.ts +2 -0
- package/dist/commands/orgs.js +117 -0
- package/dist/commands/orgs.js.map +1 -0
- package/dist/commands/pending.d.ts +19 -0
- package/dist/commands/pending.js +117 -15
- package/dist/commands/pending.js.map +1 -1
- package/dist/commands/portfolio.js +34 -1
- package/dist/commands/portfolio.js.map +1 -1
- package/dist/commands/proof.d.ts +2 -0
- package/dist/commands/proof.js +400 -0
- package/dist/commands/proof.js.map +1 -0
- package/dist/commands/signup.d.ts +14 -0
- package/dist/commands/signup.js +271 -0
- package/dist/commands/signup.js.map +1 -0
- package/dist/commands/transaction.js +139 -21
- package/dist/commands/transaction.js.map +1 -1
- package/dist/commands/webhooks.d.ts +2 -0
- package/dist/commands/webhooks.js +200 -0
- package/dist/commands/webhooks.js.map +1 -0
- package/dist/commands/whoami.d.ts +16 -0
- package/dist/commands/whoami.js +98 -0
- package/dist/commands/whoami.js.map +1 -0
- package/dist/config.d.ts +56 -0
- package/dist/config.js +51 -0
- package/dist/config.js.map +1 -1
- package/dist/errors.d.ts +14 -1
- package/dist/errors.js +15 -1
- package/dist/errors.js.map +1 -1
- package/dist/funding-guard.d.ts +40 -0
- package/dist/funding-guard.js +120 -0
- package/dist/funding-guard.js.map +1 -0
- package/dist/help-root.d.ts +2 -0
- package/dist/help-root.js +94 -0
- package/dist/help-root.js.map +1 -0
- package/dist/index.js +27 -0
- package/dist/index.js.map +1 -1
- package/dist/output.d.ts +23 -0
- package/dist/output.js +46 -0
- package/dist/output.js.map +1 -1
- package/dist/passphrase.d.ts +18 -0
- package/dist/passphrase.js +35 -3
- package/dist/passphrase.js.map +1 -1
- package/dist/payment-uri.d.ts +76 -0
- package/dist/payment-uri.js +135 -0
- package/dist/payment-uri.js.map +1 -0
- package/dist/signer.js +6 -3
- package/dist/signer.js.map +1 -1
- package/dist/solidity-args.d.ts +31 -0
- package/dist/solidity-args.js +111 -0
- package/dist/solidity-args.js.map +1 -0
- package/dist/wait.d.ts +79 -0
- package/dist/wait.js +168 -0
- package/dist/wait.js.map +1 -0
- package/package.json +5 -4
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"proof.js","sourceRoot":"","sources":["../../src/commands/proof.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,gBAAgB,EAAqB,MAAM,gBAAgB,CAAC;AAChG,OAAO,EAAE,SAAS,EAAE,SA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2E;QAC3E,EAAE;QACF,2FAA2F;QAC3F,2FAA2F;QAC3F,0EAA0E;QAC1E,IAAI,UAAU,EAAE,EAAE,CAAC;YACjB,WAAW,CAAC,OAAO,CAAC,CAAC;YACrB,iBAAiB,CAAC,SAAS,CAAC,CAAC;YAC7B,OAAO;QACT,CAAC;QAED,KAAK,CAAC,EAAE,CAAC,CAAC;QACV,KAAK,CAAC,kEAAkE,CAAC,CAAC;QAC1E,KAAK,CAAC,EAAE,CAAC,CAAC;QACV,KAAK,CAAC,uBAAuB,SAAS,CAAC,CAAC,CAAC,iDAAiD,CAAC,CAAC,CAAC,6DAA6D,EAAE,CAAC,CAAC;QAC9J,KAAK,CAAC,mFAAmF,CAAC,CAAC;QAC3F,KAAK,CAAC,4EAA4E,CAAC,CAAC;QACpF,KAAK,CAAC,6EAA6E,CAAC,CAAC;QACrF,KAAK,CAAC,gFAAgF,CAAC,CAAC;QACxF,KAAK,CAAC,EAAE,CAAC,CAAC;QACV,wFAAwF;QACxF,+DAA+D;QAC/D,KAAK,CAAC,yEAAyE,CAAC,CAAC;QACjF,KAAK,CAAC,sCAAsC,CAAC,CAAC;QAC9C,KAAK,CAAC,wFAAwF,CAAC,CAAC;QAChG,KAAK,CAAC,mEAAmE,CAAC,CAAC;QAC3E,KAAK,CAAC,EAAE,CAAC,CAAC;QAEV,iBAAiB,CAAC,SAAS,CAAC,CAAC;IAC/B,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
/**
|
|
3
|
+
* The device flow, exported so `certen init` can run it as its credential step rather than
|
|
4
|
+
* telling the user to go and run another command first. One flow, two entry points.
|
|
5
|
+
*/
|
|
6
|
+
export declare function runDeviceFlow(opts: {
|
|
7
|
+
browser: boolean;
|
|
8
|
+
keyring: boolean;
|
|
9
|
+
timeoutMs?: number;
|
|
10
|
+
}): Promise<{
|
|
11
|
+
prefix: string;
|
|
12
|
+
orgId?: string;
|
|
13
|
+
}>;
|
|
14
|
+
export declare function registerSignupCommands(program: Command): void;
|
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
import { spawn } from 'node:child_process';
|
|
2
|
+
import { hostname, userInfo } from 'node:os';
|
|
3
|
+
import { CertenClient, CertenError, redeemRegistrationToken, selfSignup } from '@certen.io/sdk';
|
|
4
|
+
import { resolveSigner } from '../signer.js';
|
|
5
|
+
import { getApiUrl, getPortalUrl, setApiKey, readConfig } from '../config.js';
|
|
6
|
+
import { printOutput, hint, human, isJsonMode } from '../output.js';
|
|
7
|
+
import { CliError, UsageError, EXIT } from '../errors.js';
|
|
8
|
+
/**
|
|
9
|
+
* `certen signup` / `certen login` — obtain an API key without copying a secret.
|
|
10
|
+
*
|
|
11
|
+
* This closes the last step of onboarding that required leaving the terminal. Before it, the
|
|
12
|
+
* first credential could only be minted in a browser and carried back by hand: sign in, click
|
|
13
|
+
* create, select the key, copy it, paste it into `certen auth login`. Four steps in another
|
|
14
|
+
* application, and a long-lived secret through the clipboard and usually into shell history.
|
|
15
|
+
*
|
|
16
|
+
* This is the OAuth 2.0 device authorization grant (RFC 8628). The CLI asks the gateway for a
|
|
17
|
+
* code, the human approves it in a portal session they already trust, and the CLI collects the
|
|
18
|
+
* key over its own channel. **The key is never displayed and never pasted.**
|
|
19
|
+
*
|
|
20
|
+
* Approval and denial are not driven from here. They need a Firebase portal session, and the
|
|
21
|
+
* gateway refuses an approval carrying `X-API-Key` — so a machine key cannot escalate itself into
|
|
22
|
+
* minting more keys, and this command must not imply that it could.
|
|
23
|
+
*/
|
|
24
|
+
const sleep = (ms) => new Promise((r) => { setTimeout(r, ms); });
|
|
25
|
+
/** A name the approver will recognise on the portal screen. */
|
|
26
|
+
function deviceName() {
|
|
27
|
+
try {
|
|
28
|
+
return `certen-cli@${userInfo().username}-${hostname()}`.slice(0, 120);
|
|
29
|
+
}
|
|
30
|
+
catch {
|
|
31
|
+
return 'certen-cli';
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Translate an SDK error into a CLI failure that names the cause.
|
|
36
|
+
*
|
|
37
|
+
* The two statuses worth distinguishing are the ones a user could otherwise misdiagnose: a 404
|
|
38
|
+
* means this gateway predates the feature, not that the code was mistyped, and a 403 means
|
|
39
|
+
* self-service is switched off rather than that anything was refused.
|
|
40
|
+
*/
|
|
41
|
+
function translate(err, url) {
|
|
42
|
+
if (err instanceof CertenError) {
|
|
43
|
+
if (err.status === 0) {
|
|
44
|
+
// Nothing was submitted, so exit 3 and a retry is safe.
|
|
45
|
+
throw new CliError(`Could not reach ${url}: ${err.message}`, 'NETWORK_ERROR', EXIT.UNREACHABLE, true);
|
|
46
|
+
}
|
|
47
|
+
if (err.status === 403) {
|
|
48
|
+
throw new CliError('This gateway does not have self-service onboarding enabled, so it cannot authorize a '
|
|
49
|
+
+ `device. Mint a key in the portal instead: ${getPortalUrl()}`, 'SELF_SERVICE_DISABLED', EXIT.FAILED);
|
|
50
|
+
}
|
|
51
|
+
if (err.status === 404) {
|
|
52
|
+
throw new CliError('This gateway does not support device authorization. It is probably running a build from '
|
|
53
|
+
+ `before the feature shipped. Mint a key at ${getPortalUrl()}`, 'DEVICE_FLOW_UNSUPPORTED', EXIT.FAILED);
|
|
54
|
+
}
|
|
55
|
+
throw new CliError(`${url} returned ${err.status}: ${err.message}`, 'DEVICE_FLOW_FAILED', EXIT.FAILED, err.isRetryable);
|
|
56
|
+
}
|
|
57
|
+
throw err;
|
|
58
|
+
}
|
|
59
|
+
/** Best effort. A browser that will not open is an inconvenience, never a failure. */
|
|
60
|
+
function openBrowser(url) {
|
|
61
|
+
const command = process.platform === 'win32' ? 'cmd'
|
|
62
|
+
: process.platform === 'darwin' ? 'open' : 'xdg-open';
|
|
63
|
+
const args = process.platform === 'win32' ? ['/c', 'start', '', url] : [url];
|
|
64
|
+
try {
|
|
65
|
+
spawn(command, args, { detached: true, stdio: 'ignore' }).unref();
|
|
66
|
+
}
|
|
67
|
+
catch {
|
|
68
|
+
// Ignored: the URL is printed either way, and it is the printed one people actually use.
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* The device flow, exported so `certen init` can run it as its credential step rather than
|
|
73
|
+
* telling the user to go and run another command first. One flow, two entry points.
|
|
74
|
+
*/
|
|
75
|
+
export async function runDeviceFlow(opts) {
|
|
76
|
+
const apiUrl = getApiUrl().replace(/\/+$/, '');
|
|
77
|
+
// These two calls are public; the key field is required by the constructor and unused by them.
|
|
78
|
+
const client = new CertenClient({ apiKey: 'device-flow', baseUrl: apiUrl });
|
|
79
|
+
const start = await client.device
|
|
80
|
+
.start({ deviceName: deviceName() })
|
|
81
|
+
.catch((err) => translate(err, `${apiUrl}/v1/portal/device`));
|
|
82
|
+
// RFC 8628 defines `verification_uri_complete` precisely so the code never has to be typed, and
|
|
83
|
+
// the gateway sends one. It was being handed to the browser and withheld from the terminal — so
|
|
84
|
+
// anyone the browser could not serve, which is every SSH session, container, WSL shell and CI
|
|
85
|
+
// job, got the bare URL and a code to retype. Those are the users with the most friction and the
|
|
86
|
+
// least patience for it, and `openBrowser` says as much three lines up: "it is the printed one
|
|
87
|
+
// people actually use."
|
|
88
|
+
const approvalUrl = start.verification_uri_complete ?? start.verification_uri;
|
|
89
|
+
const carriesCode = Boolean(start.verification_uri_complete);
|
|
90
|
+
if (!isJsonMode()) {
|
|
91
|
+
human('');
|
|
92
|
+
human(` Your code: ${start.user_code}`);
|
|
93
|
+
human('');
|
|
94
|
+
if (carriesCode) {
|
|
95
|
+
// The code is still shown above: it is what appears on the approval screen, and checking that
|
|
96
|
+
// the two match is how someone confirms they are approving THIS terminal and not another.
|
|
97
|
+
human(' Approve it here — the link carries the code:');
|
|
98
|
+
human(` ${approvalUrl}`);
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
human(` Open ${start.verification_uri} and enter it.`);
|
|
102
|
+
}
|
|
103
|
+
human('');
|
|
104
|
+
if (opts.browser)
|
|
105
|
+
human(' Opening your browser. If nothing happens, use the link above.');
|
|
106
|
+
human(' Nothing is granted until you approve it there. Ctrl-C is safe.');
|
|
107
|
+
human('');
|
|
108
|
+
}
|
|
109
|
+
if (opts.browser)
|
|
110
|
+
openBrowser(approvalUrl);
|
|
111
|
+
const intervalMs = Math.max(1, start.interval || 5) * 1000;
|
|
112
|
+
const deadline = Date.now() + (opts.timeoutMs ?? (start.expires_in || 600) * 1000);
|
|
113
|
+
let announced = false;
|
|
114
|
+
for (;;) {
|
|
115
|
+
if (Date.now() >= deadline) {
|
|
116
|
+
throw new CliError(`The code ${start.user_code} expired before it was approved. Nothing was created. `
|
|
117
|
+
+ 'Run the command again for a fresh one.', 'DEVICE_CODE_EXPIRED', EXIT.FAILED);
|
|
118
|
+
}
|
|
119
|
+
await sleep(intervalMs);
|
|
120
|
+
const poll = await client.device
|
|
121
|
+
.poll(start.device_code)
|
|
122
|
+
.catch((err) => translate(err, `${apiUrl}/v1/portal/device`));
|
|
123
|
+
if (poll.status === 'pending') {
|
|
124
|
+
if (!announced && !isJsonMode()) {
|
|
125
|
+
human(' Waiting for approval...');
|
|
126
|
+
announced = true;
|
|
127
|
+
}
|
|
128
|
+
continue;
|
|
129
|
+
}
|
|
130
|
+
if (poll.status === 'denied') {
|
|
131
|
+
throw new CliError('That request was denied in the portal. No key was created.', 'DEVICE_CODE_DENIED', EXIT.FAILED);
|
|
132
|
+
}
|
|
133
|
+
if (poll.status === 'expired') {
|
|
134
|
+
throw new CliError(`The code ${start.user_code} expired. Nothing was created. Run the command again.`, 'DEVICE_CODE_EXPIRED', EXIT.FAILED);
|
|
135
|
+
}
|
|
136
|
+
if (poll.status === 'claimed') {
|
|
137
|
+
// Someone else collected the key with this code. Alarming rather than reassuring, and worth
|
|
138
|
+
// saying so plainly.
|
|
139
|
+
throw new CliError('This code has already been used to collect a key — but not by this command. '
|
|
140
|
+
+ `If that was not you, revoke it now: ${getPortalUrl()}`, 'DEVICE_CODE_ALREADY_CLAIMED', EXIT.FAILED);
|
|
141
|
+
}
|
|
142
|
+
if (poll.status === 'approved' && poll.api_key) {
|
|
143
|
+
await setApiKey(poll.api_key, opts.keyring);
|
|
144
|
+
return { prefix: poll.key_prefix ?? poll.api_key.substring(0, 12), orgId: poll.org_id };
|
|
145
|
+
}
|
|
146
|
+
// Approved with no key is not a state the gateway should produce; treating it as success
|
|
147
|
+
// would store `undefined` as a credential.
|
|
148
|
+
throw new CliError('The gateway approved the device but returned no key.', 'DEVICE_FLOW_FAILED', EXIT.FAILED);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
export function registerSignupCommands(program) {
|
|
152
|
+
const attach = (name, description) => {
|
|
153
|
+
program
|
|
154
|
+
.command(name)
|
|
155
|
+
.description(description)
|
|
156
|
+
.option('--with-key <name>', 'Sign up by proving you hold a local signing key — no browser, no waiting')
|
|
157
|
+
.option('--org-name <name>', 'Name for the organization (with --with-key)')
|
|
158
|
+
.option('--token <token>', 'Redeem a registration token instead of waiting for a human to approve a browser')
|
|
159
|
+
.option('--no-browser', 'Do not try to open a browser; just print the URL')
|
|
160
|
+
.option('--no-keyring', 'Store the key in ~/.certen/config.json instead of the OS keyring')
|
|
161
|
+
.option('--timeout <minutes>', 'How long to wait for approval')
|
|
162
|
+
.action(async (opts) => {
|
|
163
|
+
const existing = readConfig();
|
|
164
|
+
if (process.env.CERTEN_API_KEY) {
|
|
165
|
+
// The env var wins over stored config everywhere else, so a key obtained here would be
|
|
166
|
+
// written and then ignored — a confusing no-op rather than an error.
|
|
167
|
+
throw new UsageError('CERTEN_API_KEY is set, and it takes precedence over any key saved here. '
|
|
168
|
+
+ 'Unset it first if you want to replace it.', 'API_KEY_ENV_SET');
|
|
169
|
+
}
|
|
170
|
+
// Self-service, with nobody in the loop at all — not a human at a browser, and not one at
|
|
171
|
+
// CERTEN handing out a token. CERTEN is non-custodial, so the anchor is a key the caller
|
|
172
|
+
// already holds and we never see: `certen keys` made it, the private half stays here, and
|
|
173
|
+
// the only thing that crosses the wire is a signature over a nonce.
|
|
174
|
+
if (opts.withKey) {
|
|
175
|
+
const signer = await resolveSigner(opts.withKey);
|
|
176
|
+
const redeemed = await selfSignup({
|
|
177
|
+
publicKey: signer.publicKey,
|
|
178
|
+
// The nonce arrives as hex and must be signed as BYTES. `signHash` does exactly that,
|
|
179
|
+
// which is why the key format lines up with no conversion here.
|
|
180
|
+
sign: (nonceHex) => signer.sign(nonceHex),
|
|
181
|
+
orgName: opts.orgName,
|
|
182
|
+
}, { baseUrl: getApiUrl() });
|
|
183
|
+
await setApiKey(redeemed.api_key, opts.keyring !== false && existing.storage === 'keyring');
|
|
184
|
+
printOutput({
|
|
185
|
+
org_id: redeemed.org.id,
|
|
186
|
+
org_name: redeemed.org.name,
|
|
187
|
+
plan: redeemed.org.plan,
|
|
188
|
+
key_prefix: redeemed.key_prefix,
|
|
189
|
+
permissions: redeemed.permissions,
|
|
190
|
+
signed_with: opts.withKey,
|
|
191
|
+
api_url: getApiUrl(),
|
|
192
|
+
});
|
|
193
|
+
if (!isJsonMode()) {
|
|
194
|
+
human('');
|
|
195
|
+
human(` Organization ${redeemed.org.name} created, and this machine is signed in.`);
|
|
196
|
+
human(` ${redeemed.org.id}`);
|
|
197
|
+
human('');
|
|
198
|
+
human(` Proved with your local key "${opts.withKey}". CERTEN never saw the private half,`);
|
|
199
|
+
human(' and that key is the only thing that could have created this organization.');
|
|
200
|
+
human('');
|
|
201
|
+
human(' The API key is stored here and was returned once.');
|
|
202
|
+
hint(`certen init --key ${opts.withKey} # identity, chains, and a check that it works`);
|
|
203
|
+
}
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
206
|
+
// The unattended path. The device flow is correct for a person at a terminal and is a wall
|
|
207
|
+
// for everything else: it prints a code and waits, indefinitely, for somebody to open a
|
|
208
|
+
// browser. A registration token carries the same authority, granted in advance by a human
|
|
209
|
+
// who already decided this organization should exist — so CI, a platform provisioning its
|
|
210
|
+
// customers, and an agent starting up can all get their first credential with nobody
|
|
211
|
+
// present.
|
|
212
|
+
if (opts.token) {
|
|
213
|
+
const redeemed = await redeemRegistrationToken(opts.token, { baseUrl: getApiUrl() });
|
|
214
|
+
await setApiKey(redeemed.api_key, opts.keyring !== false && existing.storage === 'keyring');
|
|
215
|
+
printOutput({
|
|
216
|
+
org_id: redeemed.org.id,
|
|
217
|
+
org_name: redeemed.org.name,
|
|
218
|
+
plan: redeemed.org.plan,
|
|
219
|
+
key_prefix: redeemed.key_prefix,
|
|
220
|
+
permissions: redeemed.permissions,
|
|
221
|
+
api_url: getApiUrl(),
|
|
222
|
+
});
|
|
223
|
+
if (!isJsonMode()) {
|
|
224
|
+
human('');
|
|
225
|
+
human(` Organization ${redeemed.org.name} created, and this machine is signed in.`);
|
|
226
|
+
human(` ${redeemed.org.id}`);
|
|
227
|
+
human('');
|
|
228
|
+
// Said explicitly because the token is single-use: there is no second redemption to
|
|
229
|
+
// fall back on if the key is lost between here and the next command.
|
|
230
|
+
human(' The key is stored on this machine. It was returned once, and the token that');
|
|
231
|
+
human(' produced it is now spent.');
|
|
232
|
+
hint('certen init # signing key, identity, and a check that it all works');
|
|
233
|
+
}
|
|
234
|
+
return;
|
|
235
|
+
}
|
|
236
|
+
let timeoutMs;
|
|
237
|
+
if (opts.timeout !== undefined) {
|
|
238
|
+
const minutes = Number(opts.timeout);
|
|
239
|
+
if (!Number.isFinite(minutes) || minutes <= 0) {
|
|
240
|
+
throw new UsageError('--timeout must be a positive number of minutes', 'INVALID_TIMEOUT');
|
|
241
|
+
}
|
|
242
|
+
timeoutMs = minutes * 60_000;
|
|
243
|
+
}
|
|
244
|
+
const result = await runDeviceFlow({
|
|
245
|
+
browser: opts.browser !== false,
|
|
246
|
+
// Match however this machine already stores credentials, rather than silently moving
|
|
247
|
+
// them between the keyring and a file.
|
|
248
|
+
keyring: opts.keyring !== false && existing.storage === 'keyring',
|
|
249
|
+
timeoutMs,
|
|
250
|
+
});
|
|
251
|
+
printOutput({
|
|
252
|
+
key_prefix: `${result.prefix}...`,
|
|
253
|
+
org_id: result.orgId ?? null,
|
|
254
|
+
api_url: getApiUrl(),
|
|
255
|
+
storage: readConfig().storage ?? 'file',
|
|
256
|
+
});
|
|
257
|
+
if (isJsonMode())
|
|
258
|
+
return;
|
|
259
|
+
human('');
|
|
260
|
+
human(' Authorized. The key was written straight to this machine — it was never displayed.');
|
|
261
|
+
human('');
|
|
262
|
+
hint('Next: certen init');
|
|
263
|
+
});
|
|
264
|
+
};
|
|
265
|
+
// Two names for one flow. "Sign up" and "log in" are the same act to the gateway — a Firebase
|
|
266
|
+
// session either exists or gets created — and making the user pick correctly before they know
|
|
267
|
+
// which they are would be a decision with no consequence.
|
|
268
|
+
attach('login', 'Get an API key for this machine by approving it in the portal');
|
|
269
|
+
attach('signup', 'Create an account and get an API key for this machine (same as login)');
|
|
270
|
+
}
|
|
271
|
+
//# sourceMappingURL=signup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signup.js","sourceRoot":"","sources":["../../src/commands/signup.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,uBAAuB,EAAE,UAAU,EAA4D,MAAM,gBAAgB,CAAC;AAC1J,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC9E,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AACpE,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAE1D;;;;;;;;;;;;;;;GAeG;AAEH,MAAM,KAAK,GAAG,CAAC,EAAU,EAAiB,EAAE,CAAC,IAAI,OAAO,C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M,CAAC,QAAQ,EAAE,uEAAuE,CAAC,CAAC;AAC5F,CAAC"}
|
|
@@ -2,8 +2,12 @@ import { Option } from 'commander';
|
|
|
2
2
|
import { readFileSync } from 'node:fs';
|
|
3
3
|
import { CertenClient } from '@certen.io/sdk';
|
|
4
4
|
import { getApiKey, getApiUrl } from '../config.js';
|
|
5
|
-
import { printOutput } from '../output.js';
|
|
5
|
+
import { printOutput, hint, human, isJsonMode } from '../output.js';
|
|
6
6
|
import { resolveSigner } from '../signer.js';
|
|
7
|
+
import { assertChain } from '../chains.js';
|
|
8
|
+
import { CliError, UsageError, EXIT } from '../errors.js';
|
|
9
|
+
import { resolveWait, parseWaitBudget, waitForTransaction, TX_WAIT } from '../wait.js';
|
|
10
|
+
import { assertFundedForValue } from '../funding-guard.js';
|
|
7
11
|
async function getClient() {
|
|
8
12
|
return new CertenClient({ apiKey: await getApiKey(), baseUrl: getApiUrl() });
|
|
9
13
|
}
|
|
@@ -11,10 +15,13 @@ async function getClient() {
|
|
|
11
15
|
* Pull the hash to sign out of an intent response.
|
|
12
16
|
*
|
|
13
17
|
* The gateway returns snake_case on the wire (`signing_data.hash_to_sign`), which is what the
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
+
* spec documents, what `execute.ts` reads, and — since the SDK's `CreateTransactionResponse` was
|
|
19
|
+
* corrected — what the declared type says too. The camelCase branch below is retained only as a
|
|
20
|
+
* tolerance for an older gateway build, NOT because the SDK type disagrees; it no longer does.
|
|
21
|
+
*
|
|
22
|
+
* (This comment previously claimed the SDK declared `signingData.dataToSign`. That was true once
|
|
23
|
+
* and is not now. A comment describing a bug that has been fixed is worse than no comment: it
|
|
24
|
+
* argues for defensive code nobody can justify from the current source.)
|
|
18
25
|
*/
|
|
19
26
|
function hashToSign(result) {
|
|
20
27
|
const r = result;
|
|
@@ -24,6 +31,32 @@ function intentIdOf(result) {
|
|
|
24
31
|
const r = result;
|
|
25
32
|
return r.intent_id ?? r.intentId;
|
|
26
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* Name the next command once an intent has settled.
|
|
36
|
+
*
|
|
37
|
+
* The proof is what the intent was FOR — it is the artifact handed to a counterparty — and until
|
|
38
|
+
* now nothing in the CLI ever mentioned it. `certen proof` arrives in Phase 3; the hint points at
|
|
39
|
+
* it either way, because the sequence is the thing worth teaching and the command is imminent.
|
|
40
|
+
*/
|
|
41
|
+
function emitTerminalHints(result, intentId) {
|
|
42
|
+
if (isJsonMode())
|
|
43
|
+
return;
|
|
44
|
+
const status = String(result.status ?? '');
|
|
45
|
+
const proofId = result.proof_id;
|
|
46
|
+
if (['completed', 'delivered', 'proven'].includes(status)) {
|
|
47
|
+
human('');
|
|
48
|
+
human(` Intent ${intentId} is ${status}.`);
|
|
49
|
+
hint('');
|
|
50
|
+
hint(proofId
|
|
51
|
+
? `Next: certen proof get ${proofId}`
|
|
52
|
+
: `Next: certen proof get ${intentId}`);
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
if (status && status !== 'failed' && status !== 'error') {
|
|
56
|
+
hint('');
|
|
57
|
+
hint(`Still ${status}. Follow it with: certen tx status ${intentId} --wait`);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
27
60
|
export function registerTransactionCommands(program) {
|
|
28
61
|
const tx = program.command('tx').description('Transaction lifecycle');
|
|
29
62
|
tx
|
|
@@ -38,7 +71,11 @@ export function registerTransactionCommands(program) {
|
|
|
38
71
|
.option('--to-chain <chain>', 'Destination chain, e.g. ethereum-sepolia')
|
|
39
72
|
.option('--from <address>', 'Source address (the identity ADI or its abstract account)')
|
|
40
73
|
.option('--to <address>', 'Destination address')
|
|
41
|
-
|
|
74
|
+
// WHOLE units, not base units. "1" is one ETH. This said "base units (wei)"
|
|
75
|
+
// until 2026-08-11 — the inverse, and inverted in the dangerous direction:
|
|
76
|
+
// someone passing "1" to mean one wei moves a whole ETH, which on a funded
|
|
77
|
+
// account succeeds silently.
|
|
78
|
+
.option('--amount <amount>', 'Amount in whole units — "1" = 1 ETH, "0.5" = half. Pass as a string')
|
|
42
79
|
.option('--token <symbol>', 'Token symbol')
|
|
43
80
|
.option('--contract-address <addr...>', 'Contract addresses this intent touches')
|
|
44
81
|
.option('--signer-key-page <url>', 'Which key page signs, e.g. acc://org.acme/book/2')
|
|
@@ -48,22 +85,56 @@ export function registerTransactionCommands(program) {
|
|
|
48
85
|
.addOption(new Option('--proof-class <class>', 'When the proof runs: on_demand starts now (~60-110s); on_cadence batches it (cheaper, slower)').choices(['on_demand', 'on_cadence']))
|
|
49
86
|
.option('--idempotency-key <key>', 'Idempotency key (one is generated if omitted)')
|
|
50
87
|
.option('--sign-with <key>', 'Local key: sign the returned hash and submit it in one step')
|
|
88
|
+
.option('--wait', 'Wait for the proof cycle to reach a terminal state (default off with --json)')
|
|
89
|
+
.option('--no-wait', 'Return as soon as the signature is submitted')
|
|
90
|
+
.option('--timeout <minutes>', `How long to wait (default ${TX_WAIT.timeoutMin})`)
|
|
91
|
+
.option('--poll-interval <seconds>', `How often to check (default ${TX_WAIT.intervalSec})`)
|
|
92
|
+
.option('--force', 'Submit even if the abstract account has no gas to execute with')
|
|
51
93
|
.action(async (opts) => {
|
|
52
94
|
const client = await getClient();
|
|
53
95
|
// Resolve (and unlock) the signer BEFORE opening the intent. Prompting for a passphrase
|
|
54
96
|
// after the intent exists would leave an unsigned intent behind every time someone
|
|
55
97
|
// mistypes it or hits Ctrl-C at the prompt.
|
|
98
|
+
// Chains are checked before the signer is unlocked, so a typo costs a message rather than a
|
|
99
|
+
// passphrase prompt followed by a gateway rejection.
|
|
100
|
+
if (opts.toChain)
|
|
101
|
+
assertChain(opts.toChain, '--to-chain');
|
|
102
|
+
// `--from-chain` defaults to `accumulate`, which is not an EVM chain and is not in the
|
|
103
|
+
// supported set; only validate it when the caller named an EVM chain explicitly.
|
|
104
|
+
if (opts.fromChain && opts.fromChain !== 'accumulate')
|
|
105
|
+
assertChain(opts.fromChain, '--from-chain');
|
|
106
|
+
const wait = resolveWait();
|
|
107
|
+
const budget = parseWaitBudget(opts.timeout, opts.pollInterval, TX_WAIT);
|
|
56
108
|
const signer = opts.signWith ? await resolveSigner(opts.signWith) : null;
|
|
57
109
|
let intent;
|
|
58
110
|
if (opts.intent) {
|
|
59
111
|
const raw = opts.intent.startsWith('@')
|
|
60
112
|
? readFileSync(opts.intent.slice(1), 'utf8')
|
|
61
113
|
: opts.intent;
|
|
62
|
-
|
|
114
|
+
try {
|
|
115
|
+
intent = JSON.parse(raw);
|
|
116
|
+
}
|
|
117
|
+
catch (err) {
|
|
118
|
+
const where = opts.intent.startsWith('@') ? opts.intent.slice(1) : '--intent';
|
|
119
|
+
throw new UsageError(`${where} is not valid JSON: ${err instanceof Error ? err.message : String(err)}`, 'INVALID_INTENT_JSON');
|
|
120
|
+
}
|
|
63
121
|
}
|
|
64
122
|
else {
|
|
65
|
-
|
|
66
|
-
|
|
123
|
+
// `--from` belongs in this list. The gateway rejects a native transfer without
|
|
124
|
+
// `fromAddress` ("Native transfer intent is missing required field(s): fromAddress"), so
|
|
125
|
+
// omitting it was always a failure — just one that cost a round trip and arrived phrased
|
|
126
|
+
// in the API's field names rather than the flags the user typed.
|
|
127
|
+
const missing = [
|
|
128
|
+
!opts.toChain && '--to-chain',
|
|
129
|
+
!opts.from && '--from',
|
|
130
|
+
!opts.to && '--to',
|
|
131
|
+
!opts.amount && '--amount',
|
|
132
|
+
].filter(Boolean);
|
|
133
|
+
if (missing.length > 0) {
|
|
134
|
+
throw new UsageError(`A simple transfer needs ${missing.join(', ')}. `
|
|
135
|
+
+ 'Give all of --to-chain, --from, --to and --amount, or pass --intent for a '
|
|
136
|
+
+ 'multi-leg or contract-call intent. '
|
|
137
|
+
+ '--from is the identity\'s abstract account on the source chain (certen portfolio shows it).', 'INCOMPLETE_INTENT');
|
|
67
138
|
}
|
|
68
139
|
intent = {
|
|
69
140
|
fromChain: opts.fromChain,
|
|
@@ -74,6 +145,11 @@ export function registerTransactionCommands(program) {
|
|
|
74
145
|
tokenSymbol: opts.token,
|
|
75
146
|
};
|
|
76
147
|
}
|
|
148
|
+
// Checked after the intent is assembled and BEFORE it is opened: an intent that cannot
|
|
149
|
+
// execute should never exist. See funding-guard.ts for why this only ever refuses on a
|
|
150
|
+
// positively observed zero.
|
|
151
|
+
const executionChain = (intent.toChain ?? intent.to_chain ?? opts.toChain);
|
|
152
|
+
await assertFundedForValue(client, opts.identity, executionChain, intent, Boolean(opts.force));
|
|
77
153
|
const result = await client.transaction.create({
|
|
78
154
|
identityId: opts.identity,
|
|
79
155
|
intent,
|
|
@@ -93,14 +169,25 @@ export function registerTransactionCommands(program) {
|
|
|
93
169
|
// Provider mode (the gateway holds a key) returns no signing data. Printing the intent and
|
|
94
170
|
// stopping is honest; pretending we signed something we never saw is not.
|
|
95
171
|
printOutput(result);
|
|
96
|
-
|
|
97
|
-
|
|
172
|
+
// Not a usage error: the invocation was well-formed and the gateway accepted it. The
|
|
173
|
+
// intent exists. This is an operation that could not be completed the way it was asked
|
|
174
|
+
// for, which is exactly what exit 1 means.
|
|
175
|
+
throw new CliError('Intent opened but returned no hash to sign — this gateway is in provider mode for that '
|
|
176
|
+
+ 'identity, so --sign-with does not apply. The intent above was created.', 'NO_SIGNING_DATA', EXIT.FAILED);
|
|
98
177
|
}
|
|
99
178
|
const signed = await client.transaction.submitSignature(intentId, {
|
|
100
179
|
signature: signer.sign(hash),
|
|
101
180
|
publicKey: signer.publicKey,
|
|
102
181
|
});
|
|
103
|
-
|
|
182
|
+
if (!wait) {
|
|
183
|
+
printOutput(signed);
|
|
184
|
+
hint('');
|
|
185
|
+
hint(`The proof cycle runs now (60-110s). Check with: certen tx status ${intentId}`);
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
const final = await waitForTransaction(client, intentId, budget);
|
|
189
|
+
printOutput(final);
|
|
190
|
+
emitTerminalHints(final, intentId);
|
|
104
191
|
});
|
|
105
192
|
tx
|
|
106
193
|
.command('sign <id>')
|
|
@@ -116,11 +203,12 @@ export function registerTransactionCommands(program) {
|
|
|
116
203
|
let signature;
|
|
117
204
|
let publicKey;
|
|
118
205
|
if (opts.signWith) {
|
|
119
|
-
if (opts.signature)
|
|
120
|
-
throw new
|
|
206
|
+
if (opts.signature) {
|
|
207
|
+
throw new UsageError('Pass either --sign-with or --signature, not both.', 'CONFLICTING_SIGNING_FLAGS');
|
|
208
|
+
}
|
|
121
209
|
if (!opts.hash) {
|
|
122
|
-
throw new
|
|
123
|
-
+ 'Or use `tx create --sign-with` to do both in one step.');
|
|
210
|
+
throw new UsageError('--sign-with needs --hash <hex> (the signing_data.hash_to_sign from `tx create`). '
|
|
211
|
+
+ 'Or use `tx create --sign-with` to do both in one step.', 'MISSING_HASH');
|
|
124
212
|
}
|
|
125
213
|
const signer = await resolveSigner(opts.signWith);
|
|
126
214
|
signature = signer.sign(opts.hash);
|
|
@@ -128,7 +216,7 @@ export function registerTransactionCommands(program) {
|
|
|
128
216
|
}
|
|
129
217
|
else {
|
|
130
218
|
if (!opts.signature || !opts.publicKey) {
|
|
131
|
-
throw new
|
|
219
|
+
throw new UsageError('Provide --sign-with <key> --hash <hex>, or both --signature and --public-key.', 'MISSING_SIGNATURE');
|
|
132
220
|
}
|
|
133
221
|
signature = opts.signature;
|
|
134
222
|
publicKey = opts.publicKey;
|
|
@@ -139,19 +227,49 @@ export function registerTransactionCommands(program) {
|
|
|
139
227
|
});
|
|
140
228
|
tx
|
|
141
229
|
.command('status <id>')
|
|
142
|
-
.description('Get transaction status')
|
|
143
|
-
|
|
230
|
+
.description('Get transaction status, optionally waiting for it to settle')
|
|
231
|
+
// `status` defaults to a single read in BOTH modes — unlike `create`. Asking "what is it now"
|
|
232
|
+
// and asking "tell me when it is done" are different questions, and a status command that
|
|
233
|
+
// silently blocked for seven minutes would be the wrong answer to the first one.
|
|
234
|
+
.option('--wait', 'Poll until the intent reaches a terminal state')
|
|
235
|
+
.option('--timeout <minutes>', `How long to wait with --wait (default ${TX_WAIT.timeoutMin})`)
|
|
236
|
+
.option('--poll-interval <seconds>', `How often to check (default ${TX_WAIT.intervalSec})`)
|
|
237
|
+
.action(async (id, opts) => {
|
|
238
|
+
const budget = parseWaitBudget(opts.timeout, opts.pollInterval, TX_WAIT);
|
|
144
239
|
const client = await getClient();
|
|
145
|
-
|
|
146
|
-
|
|
240
|
+
if (!opts.wait) {
|
|
241
|
+
const result = await client.transaction.get(id);
|
|
242
|
+
printOutput(result);
|
|
243
|
+
emitTerminalHints(result, id);
|
|
244
|
+
return;
|
|
245
|
+
}
|
|
246
|
+
const final = await waitForTransaction(client, id, budget);
|
|
247
|
+
printOutput(final);
|
|
248
|
+
emitTerminalHints(final, id);
|
|
147
249
|
});
|
|
148
250
|
tx
|
|
149
251
|
.command('list')
|
|
150
252
|
.description('List transactions')
|
|
151
253
|
.option('--limit <n>', 'Max results', parseInt)
|
|
152
254
|
.option('--offset <n>', 'Offset', parseInt)
|
|
255
|
+
// Paging by hand is the kind of arithmetic a CLI should absorb. Without this, answering "how
|
|
256
|
+
// many intents failed this month" from the terminal meant a loop incrementing --offset and
|
|
257
|
+
// knowing when to stop — and getting that wrong reads as "there were none".
|
|
258
|
+
.option('--all', 'Fetch every page, not just the first')
|
|
153
259
|
.action(async (opts) => {
|
|
154
260
|
const client = await getClient();
|
|
261
|
+
if (opts.all) {
|
|
262
|
+
if (opts.offset !== undefined) {
|
|
263
|
+
throw new UsageError('--all starts from the beginning, so --offset has no meaning with it. Use one or the other.', 'CONFLICTING_PAGING_FLAGS');
|
|
264
|
+
}
|
|
265
|
+
const transactions = [];
|
|
266
|
+
// --limit is the PAGE size here, not a cap: the whole point of --all is that the caller
|
|
267
|
+
// stops thinking about page boundaries.
|
|
268
|
+
for await (const tx of client.transaction.listAll(opts.limit ?? 100))
|
|
269
|
+
transactions.push(tx);
|
|
270
|
+
printOutput({ transactions });
|
|
271
|
+
return;
|
|
272
|
+
}
|
|
155
273
|
const result = await client.transaction.list({
|
|
156
274
|
limit: opts.limit,
|
|
157
275
|
offset: opts.offset,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transaction.js","sourceRoot":"","sources":["../../src/commands/transaction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,MAAM,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"transaction.js","sourceRoot":"","sources":["../../src/commands/transaction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,MAAM,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,kBAAkB,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACvF,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAE3D,KAAK,UAAU,SAAS;IACtB,OAAO,IAAI,YAAY,CAAC,EAAE,MAAM,EAAE,MAAM,SAAS,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE,EAAE,CAAC,CAAC;AAC/E,CAAC;AAED;;;;;;;;;;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