@agledger/cli 2.0.0 → 2.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/README.md +77 -25
- package/SKILL.md +15 -14
- package/bin/run.js +2 -2
- package/dist/api-client.d.ts +7 -0
- package/dist/api-client.js +44 -8
- package/dist/base.d.ts +97 -12
- package/dist/base.js +90 -37
- package/dist/cli/command.d.ts +58 -0
- package/dist/cli/command.js +44 -0
- package/dist/cli/flags.d.ts +76 -0
- package/dist/cli/flags.js +12 -0
- package/dist/cli/help.d.ts +6 -0
- package/dist/cli/help.js +107 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.js +3 -0
- package/dist/cli/main.d.ts +22 -0
- package/dist/cli/main.js +223 -0
- package/dist/cli/parse.d.ts +20 -0
- package/dist/cli/parse.js +138 -0
- package/dist/commands/api.d.ts +106 -18
- package/dist/commands/api.js +103 -12
- package/dist/commands/auth.d.ts +35 -6
- package/dist/commands/auth.js +1 -1
- package/dist/commands/config.d.ts +43 -8
- package/dist/commands/config.js +9 -8
- package/dist/commands/discover.d.ts +35 -6
- package/dist/commands/docs.d.ts +41 -7
- package/dist/commands/docs.js +4 -4
- package/dist/commands/help-json.d.ts +39 -7
- package/dist/commands/help-json.js +27 -45
- package/dist/commands/list-commands.d.ts +36 -7
- package/dist/commands/list-commands.js +2 -2
- package/dist/commands/login.d.ts +66 -10
- package/dist/commands/login.js +30 -9
- package/dist/commands/logout.d.ts +41 -7
- package/dist/commands/logout.js +8 -8
- package/dist/commands/verify.d.ts +131 -11
- package/dist/commands/verify.js +214 -25
- package/dist/oidc.d.ts +47 -0
- package/dist/oidc.js +162 -3
- package/dist/util/config.d.ts +16 -1
- package/dist/util/config.js +50 -14
- package/dist/util/field-parser.d.ts +3 -1
- package/dist/util/field-parser.js +11 -5
- package/package.json +9 -21
- package/dist/hooks/command-not-found.d.ts +0 -3
- package/dist/hooks/command-not-found.js +0 -63
- package/oclif.manifest.json +0 -857
|
@@ -2,7 +2,7 @@ import { BaseCommand } from '../base.js';
|
|
|
2
2
|
/**
|
|
3
3
|
* Low-token command inventory for agent discovery.
|
|
4
4
|
*
|
|
5
|
-
* The CLI is a thin
|
|
5
|
+
* The CLI is a thin pass-through to the API; the bulk of functionality lives under
|
|
6
6
|
* `agledger api <METHOD> <path>`. This list shows CLI-local commands only;
|
|
7
7
|
* for API operations, agents should call `agledger discover` or
|
|
8
8
|
* `agledger api GET /openapi.json`.
|
|
@@ -10,12 +10,41 @@ import { BaseCommand } from '../base.js';
|
|
|
10
10
|
export default class ListCommands extends BaseCommand {
|
|
11
11
|
static description: string;
|
|
12
12
|
static flags: {
|
|
13
|
-
json:
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
json: {
|
|
14
|
+
readonly description: "Force JSON output (default when stdout is piped)";
|
|
15
|
+
readonly default: false;
|
|
16
|
+
} & {
|
|
17
|
+
readonly type: 'boolean';
|
|
18
|
+
};
|
|
19
|
+
quiet: {
|
|
20
|
+
readonly description: "Suppress output (exit code only)";
|
|
21
|
+
readonly default: false;
|
|
22
|
+
} & {
|
|
23
|
+
readonly type: 'boolean';
|
|
24
|
+
};
|
|
25
|
+
'api-key': {
|
|
26
|
+
type: 'option';
|
|
27
|
+
description: "AGLedger API key";
|
|
28
|
+
env: "AGLEDGER_API_KEY";
|
|
29
|
+
hidden: boolean;
|
|
30
|
+
};
|
|
31
|
+
'api-url': {
|
|
32
|
+
type: 'option';
|
|
33
|
+
description: "AGLedger API base URL";
|
|
34
|
+
env: "AGLEDGER_API_URL";
|
|
35
|
+
hidden: boolean;
|
|
36
|
+
};
|
|
37
|
+
profile: {
|
|
38
|
+
type: 'option';
|
|
39
|
+
description: "Stored profile to use for credentials (falls back to the active profile)";
|
|
40
|
+
hidden: boolean;
|
|
41
|
+
};
|
|
42
|
+
verbose: {
|
|
43
|
+
type: 'boolean';
|
|
44
|
+
description: "Report which credential was used, and each OIDC cert exchange, as JSON lines on stderr. Never prints a key, token or cert.";
|
|
45
|
+
default: false;
|
|
46
|
+
hidden: boolean;
|
|
47
|
+
};
|
|
19
48
|
};
|
|
20
49
|
run(): Promise<void>;
|
|
21
50
|
}
|
|
@@ -2,14 +2,14 @@ import { BaseCommand } from '../base.js';
|
|
|
2
2
|
/**
|
|
3
3
|
* Low-token command inventory for agent discovery.
|
|
4
4
|
*
|
|
5
|
-
* The CLI is a thin
|
|
5
|
+
* The CLI is a thin pass-through to the API; the bulk of functionality lives under
|
|
6
6
|
* `agledger api <METHOD> <path>`. This list shows CLI-local commands only;
|
|
7
7
|
* for API operations, agents should call `agledger discover` or
|
|
8
8
|
* `agledger api GET /openapi.json`.
|
|
9
9
|
*/
|
|
10
10
|
export default class ListCommands extends BaseCommand {
|
|
11
11
|
static description = 'List all CLI commands (for agent discovery). Most API work goes through `agledger api`.';
|
|
12
|
-
static flags = { ...BaseCommand.
|
|
12
|
+
static flags = { ...BaseCommand.offlineFlags };
|
|
13
13
|
async run() {
|
|
14
14
|
await this.parse(ListCommands);
|
|
15
15
|
const commands = [
|
package/dist/commands/login.d.ts
CHANGED
|
@@ -13,16 +13,72 @@ export default class Login extends BaseCommand {
|
|
|
13
13
|
static examples: string[];
|
|
14
14
|
protected readonly createsProfile = true;
|
|
15
15
|
static flags: {
|
|
16
|
-
json:
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
16
|
+
json: {
|
|
17
|
+
readonly description: "Force JSON output (default when stdout is piped)";
|
|
18
|
+
readonly default: false;
|
|
19
|
+
} & {
|
|
20
|
+
readonly type: 'boolean';
|
|
21
|
+
};
|
|
22
|
+
quiet: {
|
|
23
|
+
readonly description: "Suppress output (exit code only)";
|
|
24
|
+
readonly default: false;
|
|
25
|
+
} & {
|
|
26
|
+
readonly type: 'boolean';
|
|
27
|
+
};
|
|
28
|
+
'api-key': {
|
|
29
|
+
readonly description: "AGLedger API key";
|
|
30
|
+
readonly env: "AGLEDGER_API_KEY";
|
|
31
|
+
} & {
|
|
32
|
+
readonly type: 'option';
|
|
33
|
+
};
|
|
34
|
+
'api-url': {
|
|
35
|
+
readonly description: "AGLedger API base URL";
|
|
36
|
+
readonly env: "AGLEDGER_API_URL";
|
|
37
|
+
} & {
|
|
38
|
+
readonly type: 'option';
|
|
39
|
+
};
|
|
40
|
+
verbose: {
|
|
41
|
+
readonly description: "Report which credential was used, and each OIDC cert exchange, as JSON lines on stderr. Never prints a key, token or cert.";
|
|
42
|
+
readonly default: false;
|
|
43
|
+
} & {
|
|
44
|
+
readonly type: 'boolean';
|
|
45
|
+
};
|
|
46
|
+
profile: {
|
|
47
|
+
readonly description: "Profile name";
|
|
48
|
+
readonly default: "default";
|
|
49
|
+
} & {
|
|
50
|
+
readonly type: 'option';
|
|
51
|
+
};
|
|
52
|
+
oidc: {
|
|
53
|
+
readonly description: "Store an OIDC token source instead of an API key. A token command is verified by one cert exchange and a GET /v1/auth/me before it is saved. A token file is only checked to hold a JWT: the Server exchanges each token once, so exchanging it here would leave the next command a spent token until the file rotates.";
|
|
54
|
+
readonly default: false;
|
|
55
|
+
} & {
|
|
56
|
+
readonly type: 'boolean';
|
|
57
|
+
};
|
|
58
|
+
'oidc-token-cmd': {
|
|
59
|
+
readonly description: "With --oidc: a shell command whose stdout is an OIDC JWT, run on every cert exchange.";
|
|
60
|
+
readonly env: "AGLEDGER_OIDC_TOKEN_CMD";
|
|
61
|
+
} & {
|
|
62
|
+
readonly type: 'option';
|
|
63
|
+
};
|
|
64
|
+
'oidc-token-file': {
|
|
65
|
+
readonly description: "With --oidc: a file holding an OIDC JWT, read on every cert exchange (a projected token in a pod).";
|
|
66
|
+
readonly env: "AGLEDGER_OIDC_TOKEN_FILE";
|
|
67
|
+
} & {
|
|
68
|
+
readonly type: 'option';
|
|
69
|
+
};
|
|
70
|
+
'oidc-agent-id': {
|
|
71
|
+
readonly description: string;
|
|
72
|
+
readonly env: "AGLEDGER_OIDC_AGENT_ID";
|
|
73
|
+
} & {
|
|
74
|
+
readonly type: 'option';
|
|
75
|
+
};
|
|
76
|
+
'agent-keys-file': {
|
|
77
|
+
readonly description: string;
|
|
78
|
+
readonly env: "AGLEDGER_AGENT_KEYS_FILE";
|
|
79
|
+
} & {
|
|
80
|
+
readonly type: 'option';
|
|
81
|
+
};
|
|
26
82
|
};
|
|
27
83
|
run(): Promise<void>;
|
|
28
84
|
private loginOidc;
|
package/dist/commands/login.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { resolve } from 'node:path';
|
|
2
|
-
import { Flags } from '
|
|
2
|
+
import { Flags } from '../cli/index.js';
|
|
3
3
|
import { ApiClient } from '../api-client.js';
|
|
4
4
|
import { BaseCommand, ErrorCode, ExitCode, argvHasFlag } from '../base.js';
|
|
5
5
|
import { OIDC_ENV, fetchOidcToken } from '../oidc.js';
|
|
6
|
-
import { readConfig, writeConfig } from '../util/config.js';
|
|
6
|
+
import { getProfile, readConfig, writeConfig } from '../util/config.js';
|
|
7
7
|
/**
|
|
8
8
|
* Verify a credential against the API, then persist it to
|
|
9
9
|
* ~/.agledger/config.json (0600, dir 0700). Supports named profiles so one
|
|
@@ -16,9 +16,10 @@ import { readConfig, writeConfig } from '../util/config.js';
|
|
|
16
16
|
export default class Login extends BaseCommand {
|
|
17
17
|
static description = 'Verify an API key, or an OIDC token source with --oidc, and store it in ~/.agledger/config.json (0600)';
|
|
18
18
|
static examples = [
|
|
19
|
-
'
|
|
20
|
-
"
|
|
21
|
-
'
|
|
19
|
+
'agledger login --api-url https://agledger.internal --api-key agl_agt_... --profile prod',
|
|
20
|
+
"agledger login --oidc --api-url https://agledger.internal --oidc-token-cmd 'gcloud auth print-identity-token --audiences=agledger'",
|
|
21
|
+
'agledger login --oidc --api-url https://agledger.internal --oidc-token-file /var/run/secrets/tokens/agledger',
|
|
22
|
+
"agledger login --oidc --api-url https://agledger.internal --oidc-token-cmd '...' --agent-keys-file ~/.agledger/agent-keys.json",
|
|
22
23
|
];
|
|
23
24
|
// --profile names the profile this login writes, so it need not exist yet.
|
|
24
25
|
createsProfile = true;
|
|
@@ -44,6 +45,13 @@ export default class Login extends BaseCommand {
|
|
|
44
45
|
'on it (PATCH /v1/agents/{id}) or maps an agent_id claim on the trusted issuer (claimMapping.agent_id).',
|
|
45
46
|
env: OIDC_ENV.AGENT_ID,
|
|
46
47
|
}),
|
|
48
|
+
'agent-keys-file': Flags.string({
|
|
49
|
+
description: 'With --oidc: a JWK Set file every cert exchange adds its public key to, before the cert is used. Each ' +
|
|
50
|
+
'command exchanges for a cert with a key pair of its own, and an agent signature can be re-verified ' +
|
|
51
|
+
'offline only under that key: pass this file to `agledger verify --agent-keys` (or agledger-verify ' +
|
|
52
|
+
'--agent-keys). Commands running at once can share one file. Holds public keys only. Stored in the profile.',
|
|
53
|
+
env: OIDC_ENV.AGENT_KEYS_FILE,
|
|
54
|
+
}),
|
|
47
55
|
};
|
|
48
56
|
async run() {
|
|
49
57
|
const { flags } = await this.parse(Login);
|
|
@@ -60,7 +68,10 @@ export default class Login extends BaseCommand {
|
|
|
60
68
|
if (!response.ok) {
|
|
61
69
|
this.handleApiError(response);
|
|
62
70
|
}
|
|
63
|
-
|
|
71
|
+
// A new key for a stored profile keeps that profile's URL: the call above
|
|
72
|
+
// already went there, so dropping it would store a key with nowhere to use it.
|
|
73
|
+
const apiUrl = flags['api-url'] || getProfile(readConfig(), flags.profile)?.apiUrl;
|
|
74
|
+
this.save(flags.profile, { apiKey, apiUrl });
|
|
64
75
|
this.output({ authenticated: true, profile: flags.profile, account: response.body });
|
|
65
76
|
}
|
|
66
77
|
catch (err) {
|
|
@@ -85,13 +96,16 @@ export default class Login extends BaseCommand {
|
|
|
85
96
|
// The command outranks the file, as it does at call time.
|
|
86
97
|
const source = command
|
|
87
98
|
? { kind: 'command', command, origin: argvHasFlag('--oidc-token-cmd') ? '--oidc-token-cmd' : OIDC_ENV.TOKEN_CMD }
|
|
88
|
-
: { kind: 'file', path: file, origin: argvHasFlag('--oidc-token-file') ? '--oidc-token-file' : OIDC_ENV.TOKEN_FILE };
|
|
99
|
+
: { kind: 'file', path: file ?? '', origin: argvHasFlag('--oidc-token-file') ? '--oidc-token-file' : OIDC_ENV.TOKEN_FILE };
|
|
89
100
|
const agentId = flags['oidc-agent-id'] || undefined;
|
|
101
|
+
// Stored absolute, as the token file is: later commands run from other directories.
|
|
102
|
+
const agentKeysFile = flags['agent-keys-file'] ? resolve(flags['agent-keys-file']) : undefined;
|
|
90
103
|
const stored = {
|
|
91
104
|
apiUrl,
|
|
92
105
|
oidc: {
|
|
93
|
-
...(command ? { tokenCommand: command } : { tokenFile:
|
|
106
|
+
...(source.kind === 'command' ? { tokenCommand: source.command } : { tokenFile: source.path }),
|
|
94
107
|
...(agentId ? { agentId } : {}),
|
|
108
|
+
...(agentKeysFile ? { agentKeysFile } : {}),
|
|
95
109
|
},
|
|
96
110
|
};
|
|
97
111
|
if (source.kind === 'file') {
|
|
@@ -108,6 +122,7 @@ export default class Login extends BaseCommand {
|
|
|
108
122
|
credential: 'oidc-cert',
|
|
109
123
|
tokenSource: 'file',
|
|
110
124
|
oidcSub: sub,
|
|
125
|
+
...(agentKeysFile ? { agentKeysFile } : {}),
|
|
111
126
|
message: 'The file holds a JWT; it was not exchanged, so the token stays unspent. Run `agledger auth` to exchange it and see the cert.',
|
|
112
127
|
});
|
|
113
128
|
}
|
|
@@ -116,7 +131,11 @@ export default class Login extends BaseCommand {
|
|
|
116
131
|
}
|
|
117
132
|
return;
|
|
118
133
|
}
|
|
119
|
-
const credential = this.oidcCredential(flags, {
|
|
134
|
+
const credential = this.oidcCredential(flags, {
|
|
135
|
+
source,
|
|
136
|
+
...(agentId ? { agentId } : {}),
|
|
137
|
+
...(agentKeysFile ? { agentKeysFile } : {}),
|
|
138
|
+
});
|
|
120
139
|
this.verboseLog(flags, { event: 'auth', credential: 'oidc-cert', source: source.origin, apiUrl });
|
|
121
140
|
try {
|
|
122
141
|
const client = new ApiClient(apiUrl, credential, this.config.version);
|
|
@@ -131,6 +150,8 @@ export default class Login extends BaseCommand {
|
|
|
131
150
|
credential: 'oidc-cert',
|
|
132
151
|
tokenSource: 'command',
|
|
133
152
|
cert: credential.cert,
|
|
153
|
+
publicKeyJwk: credential.publicKeyJwk,
|
|
154
|
+
...(agentKeysFile ? { agentKeysFile } : {}),
|
|
134
155
|
account: response.body,
|
|
135
156
|
});
|
|
136
157
|
}
|
|
@@ -3,13 +3,47 @@ export default class Logout extends BaseCommand {
|
|
|
3
3
|
static description: string;
|
|
4
4
|
static examples: string[];
|
|
5
5
|
static flags: {
|
|
6
|
-
json:
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
json: {
|
|
7
|
+
readonly description: "Force JSON output (default when stdout is piped)";
|
|
8
|
+
readonly default: false;
|
|
9
|
+
} & {
|
|
10
|
+
readonly type: 'boolean';
|
|
11
|
+
};
|
|
12
|
+
quiet: {
|
|
13
|
+
readonly description: "Suppress output (exit code only)";
|
|
14
|
+
readonly default: false;
|
|
15
|
+
} & {
|
|
16
|
+
readonly type: 'boolean';
|
|
17
|
+
};
|
|
18
|
+
'api-key': {
|
|
19
|
+
type: 'option';
|
|
20
|
+
description: "AGLedger API key";
|
|
21
|
+
env: "AGLEDGER_API_KEY";
|
|
22
|
+
hidden: boolean;
|
|
23
|
+
};
|
|
24
|
+
'api-url': {
|
|
25
|
+
type: 'option';
|
|
26
|
+
description: "AGLedger API base URL";
|
|
27
|
+
env: "AGLEDGER_API_URL";
|
|
28
|
+
hidden: boolean;
|
|
29
|
+
};
|
|
30
|
+
verbose: {
|
|
31
|
+
type: 'boolean';
|
|
32
|
+
description: "Report which credential was used, and each OIDC cert exchange, as JSON lines on stderr. Never prints a key, token or cert.";
|
|
33
|
+
default: false;
|
|
34
|
+
hidden: boolean;
|
|
35
|
+
};
|
|
36
|
+
profile: {
|
|
37
|
+
readonly description: "Profile name to remove (default: the active profile)";
|
|
38
|
+
} & {
|
|
39
|
+
readonly type: 'option';
|
|
40
|
+
};
|
|
41
|
+
all: {
|
|
42
|
+
readonly description: "Remove all profiles";
|
|
43
|
+
readonly default: false;
|
|
44
|
+
} & {
|
|
45
|
+
readonly type: 'boolean';
|
|
46
|
+
};
|
|
13
47
|
};
|
|
14
48
|
run(): Promise<void>;
|
|
15
49
|
}
|
package/dist/commands/logout.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { Flags } from '
|
|
1
|
+
import { Flags } from '../cli/index.js';
|
|
2
2
|
import { BaseCommand, ErrorCode, ExitCode } from '../base.js';
|
|
3
|
-
import { readConfig, writeConfig } from '../util/config.js';
|
|
3
|
+
import { getProfile, readConfig, writeConfig } from '../util/config.js';
|
|
4
4
|
export default class Logout extends BaseCommand {
|
|
5
5
|
static description = 'Remove a stored profile from ~/.agledger/config.json: the active profile, the one named by --profile, or every profile with --all. Exits 2 when there is no such profile to remove. Removing the active profile leaves none active: pick another with `config use`.';
|
|
6
6
|
static examples = [
|
|
7
|
-
'
|
|
8
|
-
'
|
|
9
|
-
'
|
|
7
|
+
'agledger logout',
|
|
8
|
+
'agledger logout --profile prod',
|
|
9
|
+
'agledger logout --all',
|
|
10
10
|
];
|
|
11
11
|
static flags = {
|
|
12
|
-
...BaseCommand.
|
|
12
|
+
...BaseCommand.offlineFlags,
|
|
13
13
|
profile: Flags.string({ description: 'Profile name to remove (default: the active profile)' }),
|
|
14
14
|
all: Flags.boolean({ description: 'Remove all profiles', default: false }),
|
|
15
15
|
};
|
|
@@ -32,10 +32,10 @@ export default class Logout extends BaseCommand {
|
|
|
32
32
|
if (!name) {
|
|
33
33
|
this.failWith(ErrorCode.MISSING_INPUT, 'No active profile, so there is nothing to log out of.', ExitCode.USAGE_ERROR, 'Run `agledger config list` to see profiles, then `agledger logout --profile <name>`.');
|
|
34
34
|
}
|
|
35
|
-
if (!config
|
|
35
|
+
if (!getProfile(config, name)) {
|
|
36
36
|
this.failWith(ErrorCode.MISSING_INPUT, `Profile '${name}' not found, so nothing was removed.`, ExitCode.USAGE_ERROR, 'Run `agledger config list` to see profiles.');
|
|
37
37
|
}
|
|
38
|
-
|
|
38
|
+
config.profiles = Object.fromEntries(Object.entries(config.profiles).filter(([profileName]) => profileName !== name));
|
|
39
39
|
// Logging out the active profile leaves none active. Promoting whichever
|
|
40
40
|
// profile came first would quietly switch the next call to a different
|
|
41
41
|
// identity (an admin key, say), so the caller picks one with `config use`.
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { type VerifyExportResult } from '@agledger/verify-core';
|
|
2
2
|
import { BaseCommand } from '../base.js';
|
|
3
|
+
/** A --trust-anchor was given and the run did not anchor to it; the code `agledger-verify` gives. */
|
|
4
|
+
export declare const EXIT_NOT_ANCHORED = 3;
|
|
3
5
|
/** One prose string from a result, its option names given as this command's flags. */
|
|
4
6
|
export declare function flagWording(text: string): string;
|
|
5
7
|
/**
|
|
@@ -20,19 +22,94 @@ export default class Verify extends BaseCommand {
|
|
|
20
22
|
static examples: string[];
|
|
21
23
|
static usage: string;
|
|
22
24
|
static args: {
|
|
23
|
-
file:
|
|
25
|
+
file: {
|
|
26
|
+
readonly description: "Path to the audit export JSON file (or \"-\" for stdin).";
|
|
27
|
+
};
|
|
24
28
|
};
|
|
25
29
|
static flags: {
|
|
26
|
-
json:
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
30
|
+
json: {
|
|
31
|
+
readonly description: "Force JSON output (default when stdout is piped)";
|
|
32
|
+
readonly default: false;
|
|
33
|
+
} & {
|
|
34
|
+
readonly type: 'boolean';
|
|
35
|
+
};
|
|
36
|
+
quiet: {
|
|
37
|
+
readonly description: "Suppress output (exit code only)";
|
|
38
|
+
readonly default: false;
|
|
39
|
+
} & {
|
|
40
|
+
readonly type: 'boolean';
|
|
41
|
+
};
|
|
42
|
+
keys: {
|
|
43
|
+
readonly description: string;
|
|
44
|
+
} & {
|
|
45
|
+
readonly type: 'option';
|
|
46
|
+
};
|
|
47
|
+
'trust-anchor': {
|
|
48
|
+
readonly multiple: true;
|
|
49
|
+
readonly multipleNonGreedy: true;
|
|
50
|
+
readonly description: string;
|
|
51
|
+
} & {
|
|
52
|
+
readonly type: 'option';
|
|
53
|
+
};
|
|
54
|
+
'distrusted-key': {
|
|
55
|
+
readonly multiple: true;
|
|
56
|
+
readonly multipleNonGreedy: true;
|
|
57
|
+
readonly description: string;
|
|
58
|
+
} & {
|
|
59
|
+
readonly type: 'option';
|
|
60
|
+
};
|
|
61
|
+
'agent-keys': {
|
|
62
|
+
readonly description: string;
|
|
63
|
+
} & {
|
|
64
|
+
readonly type: 'option';
|
|
65
|
+
};
|
|
66
|
+
'federation-key': {
|
|
67
|
+
readonly multiple: true;
|
|
68
|
+
readonly multipleNonGreedy: true;
|
|
69
|
+
readonly description: string;
|
|
70
|
+
} & {
|
|
71
|
+
readonly type: 'option';
|
|
72
|
+
};
|
|
73
|
+
'federation-key-history': {
|
|
74
|
+
readonly multiple: true;
|
|
75
|
+
readonly multipleNonGreedy: true;
|
|
76
|
+
readonly description: string;
|
|
77
|
+
} & {
|
|
78
|
+
readonly type: 'option';
|
|
79
|
+
};
|
|
80
|
+
'allow-after-retirement': {
|
|
81
|
+
readonly description: string;
|
|
82
|
+
readonly default: false;
|
|
83
|
+
} & {
|
|
84
|
+
readonly type: 'boolean';
|
|
85
|
+
};
|
|
86
|
+
'expected-entry-count': {
|
|
87
|
+
readonly description: string;
|
|
88
|
+
} & {
|
|
89
|
+
readonly type: 'option';
|
|
90
|
+
};
|
|
91
|
+
'require-key-id': {
|
|
92
|
+
readonly description: string;
|
|
93
|
+
} & {
|
|
94
|
+
readonly type: 'option';
|
|
95
|
+
};
|
|
96
|
+
'distrusted-keys': {
|
|
97
|
+
readonly hidden: true;
|
|
98
|
+
} & {
|
|
99
|
+
readonly type: 'option';
|
|
100
|
+
};
|
|
101
|
+
'require-out-of-band-keys': {
|
|
102
|
+
readonly hidden: true;
|
|
103
|
+
readonly default: false;
|
|
104
|
+
} & {
|
|
105
|
+
readonly type: 'boolean';
|
|
106
|
+
};
|
|
107
|
+
'require-supplied-keys': {
|
|
108
|
+
readonly description: string;
|
|
109
|
+
readonly default: false;
|
|
110
|
+
} & {
|
|
111
|
+
readonly type: 'boolean';
|
|
112
|
+
};
|
|
36
113
|
};
|
|
37
114
|
run(): Promise<void>;
|
|
38
115
|
/**
|
|
@@ -49,6 +126,49 @@ export default class Verify extends BaseCommand {
|
|
|
49
126
|
* entry that wraps its key as `{ publicKeyJwk: {...} }` (how an agent records
|
|
50
127
|
* the key it sent at cert exchange) is unwrapped. verify-core validates each.
|
|
51
128
|
*/
|
|
129
|
+
/**
|
|
130
|
+
* `--federation-key` values into the `[{ hubId, publicKey }]` list
|
|
131
|
+
* verify-core takes, each checked here so a bad key is a usage error, not a
|
|
132
|
+
* verdict. A hub named twice pins two keys.
|
|
133
|
+
*/
|
|
134
|
+
private parseFederationKeys;
|
|
135
|
+
/**
|
|
136
|
+
* Each `--federation-key-history` file attached to the `--federation-key`
|
|
137
|
+
* entry for the hub it names, or undefined when neither flag was given. A
|
|
138
|
+
* history needs a key for its hub: alone it is the peer's word.
|
|
139
|
+
*/
|
|
140
|
+
private attachFederationKeyHistories;
|
|
52
141
|
private unwrapAgentKeys;
|
|
53
142
|
private renderHuman;
|
|
54
143
|
}
|
|
144
|
+
/**
|
|
145
|
+
* The human line on the evidence bodies an `?evidence=true` export inlines,
|
|
146
|
+
* or null when it carries none. Each is hashed against the evidenceHash or
|
|
147
|
+
* payloadHash its entry signs; an encrypted-mode completion cannot be.
|
|
148
|
+
*/
|
|
149
|
+
export declare function evidenceBodiesLine(counts: {
|
|
150
|
+
present: number;
|
|
151
|
+
verified: number;
|
|
152
|
+
clientHashed: number;
|
|
153
|
+
failed: number;
|
|
154
|
+
}): string | null;
|
|
155
|
+
/**
|
|
156
|
+
* The human line on the sealed federation messages, or null when the chain
|
|
157
|
+
* carries none. `failed` messages failed a check and are reported as
|
|
158
|
+
* failures; the rest of the unverified ones came from a hub with no key.
|
|
159
|
+
*/
|
|
160
|
+
export declare function peerMessagesLine(wire: {
|
|
161
|
+
present: number;
|
|
162
|
+
verified: number;
|
|
163
|
+
failed: number;
|
|
164
|
+
afterRetirement: number;
|
|
165
|
+
}, federationKeysGiven: boolean): string | null;
|
|
166
|
+
/**
|
|
167
|
+
* What the export's entry count was held to. A chain cut from the end still
|
|
168
|
+
* verifies entry by entry, so the report names the stated count, if any, that
|
|
169
|
+
* stood behind the number of entries it verified.
|
|
170
|
+
*/
|
|
171
|
+
export declare function entryCountLine(count: {
|
|
172
|
+
expectedEntries: number | null;
|
|
173
|
+
statedEntries: number | null;
|
|
174
|
+
}, held?: number, supplied?: number): string;
|