@atlasauth/pca-cli 0.0.0-stage → 0.1.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 +32 -2
- package/dist/cli.d.ts +10 -0
- package/dist/cli.js +138 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.d.ts +76 -0
- package/dist/index.js +280 -0
- package/dist/index.js.map +1 -0
- package/package.json +33 -3
package/README.md
CHANGED
|
@@ -1,3 +1,33 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @atlasauth/pca-cli
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The pca dev CLI: decode and explain a PCActn (why it passed or failed each check), mint a dev grant/key, and simulate a policy over actions.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
npm i -g @atlasauth/pca-cli
|
|
9
|
+
# or: npx @atlasauth/pca-cli <command>
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
Installs the `pca` binary. Depends on the core `@atlasauth/pca`.
|
|
13
|
+
|
|
14
|
+
## Usage
|
|
15
|
+
|
|
16
|
+
```sh
|
|
17
|
+
# Summarize a PCActn (JSON or base64url; '-' reads STDIN).
|
|
18
|
+
pca decode action.json
|
|
19
|
+
pca decode -
|
|
20
|
+
|
|
21
|
+
# Run the REAL verifier and explain each check (PASS / FAIL / —), with a final ALLOW/DENY.
|
|
22
|
+
pca explain action.json --aud ins_acme
|
|
23
|
+
|
|
24
|
+
# Mint a throwaway Ed25519 dev keypair.
|
|
25
|
+
pca keygen
|
|
26
|
+
|
|
27
|
+
# Replay actions against a compiled policy (auto / step_up / deny + budget).
|
|
28
|
+
pca simulate policy.json actions.json
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
The programmatic functions (`cmdDecode`, `cmdExplain`, `cmdKeygen`, `cmdSimulate`) are also exported. `decode` / `explain` are read-only inspectors — `explain` runs `verifyPCActnCore` against the grant in the PCActn's own capability chain, so its verdict is the local, grant-relative view. Nothing here authorizes anything; the resource server's verifier, with its stored counter / revocation state, remains the authority.
|
|
32
|
+
|
|
33
|
+
Part of Proof-Carrying Authority — see `@atlasauth/pca`.
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* `pca` — the PCA developer CLI entrypoint.
|
|
4
|
+
*
|
|
5
|
+
* A tiny, dependency-free argv parser dispatches to the pure command functions in `./index`. Input
|
|
6
|
+
* that is a PCActn / JSON is read from a file path argument, or from STDIN when the argument is `-`.
|
|
7
|
+
* Errors print to stderr and set a non-zero `process.exitCode` (we never call `process.exit`, so
|
|
8
|
+
* buffered stdout always flushes first).
|
|
9
|
+
*/
|
|
10
|
+
export {};
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
/**
|
|
4
|
+
* `pca` — the PCA developer CLI entrypoint.
|
|
5
|
+
*
|
|
6
|
+
* A tiny, dependency-free argv parser dispatches to the pure command functions in `./index`. Input
|
|
7
|
+
* that is a PCActn / JSON is read from a file path argument, or from STDIN when the argument is `-`.
|
|
8
|
+
* Errors print to stderr and set a non-zero `process.exitCode` (we never call `process.exit`, so
|
|
9
|
+
* buffered stdout always flushes first).
|
|
10
|
+
*/
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
const node_fs_1 = require("node:fs");
|
|
13
|
+
const index_1 = require("./index");
|
|
14
|
+
const USAGE = `pca — Proof-Carrying Authority dev CLI
|
|
15
|
+
|
|
16
|
+
Usage:
|
|
17
|
+
pca decode <file|-> Summarize a PCActn (JSON or base64url).
|
|
18
|
+
pca explain <file|-> [--aud <id>] Run the real verifier and explain each check (PASS/FAIL/—).
|
|
19
|
+
pca keygen Mint a throwaway Ed25519 dev keypair (base64url).
|
|
20
|
+
pca simulate <policy.json> <actions.json>
|
|
21
|
+
Replay actions against a compiled policy (auto/step_up/deny).
|
|
22
|
+
pca discovery --aud <id> [--suites a,b] [--stepup <url>] [--revocation <url>] [--beacon <url>] [--attest <url>]
|
|
23
|
+
Emit a .well-known/pca-configuration document.
|
|
24
|
+
|
|
25
|
+
Notes:
|
|
26
|
+
<-> reads from STDIN. Nothing here authorizes anything — the resource server's verifier decides.
|
|
27
|
+
`;
|
|
28
|
+
/** Read a positional file argument, or STDIN when it is '-'. */
|
|
29
|
+
function readSource(arg) {
|
|
30
|
+
if (arg === '-')
|
|
31
|
+
return (0, node_fs_1.readFileSync)(0, 'utf8');
|
|
32
|
+
return (0, node_fs_1.readFileSync)(arg, 'utf8');
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Minimal hand-rolled parser (no dependency): everything after the sub-command, splitting
|
|
36
|
+
* `--flag value` and `--flag=value` out of the positionals. A bare `--flag` with no value is treated
|
|
37
|
+
* as the empty string.
|
|
38
|
+
*/
|
|
39
|
+
function parseArgs(argv) {
|
|
40
|
+
const positionals = [];
|
|
41
|
+
const flags = {};
|
|
42
|
+
for (let i = 0; i < argv.length; i++) {
|
|
43
|
+
const a = argv[i];
|
|
44
|
+
if (a === undefined)
|
|
45
|
+
continue;
|
|
46
|
+
if (a.startsWith('--')) {
|
|
47
|
+
const body = a.slice(2);
|
|
48
|
+
const eq = body.indexOf('=');
|
|
49
|
+
if (eq >= 0) {
|
|
50
|
+
flags[body.slice(0, eq)] = body.slice(eq + 1);
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
const next = argv[i + 1];
|
|
54
|
+
if (next !== undefined && !next.startsWith('--')) {
|
|
55
|
+
flags[body] = next;
|
|
56
|
+
i++;
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
flags[body] = '';
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
positionals.push(a);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return { positionals, flags };
|
|
68
|
+
}
|
|
69
|
+
async function main() {
|
|
70
|
+
const argv = process.argv.slice(2);
|
|
71
|
+
const command = argv[0];
|
|
72
|
+
if (command === undefined || command === '--help' || command === '-h' || command === 'help') {
|
|
73
|
+
process.stdout.write(USAGE);
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
const { positionals, flags } = parseArgs(argv.slice(1));
|
|
77
|
+
switch (command) {
|
|
78
|
+
case 'decode': {
|
|
79
|
+
const src = positionals[0];
|
|
80
|
+
if (src === undefined)
|
|
81
|
+
throw new Error("decode: expected a file path or '-' for STDIN");
|
|
82
|
+
process.stdout.write((0, index_1.cmdDecode)(readSource(src)) + '\n');
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
case 'explain': {
|
|
86
|
+
const src = positionals[0];
|
|
87
|
+
if (src === undefined)
|
|
88
|
+
throw new Error("explain: expected a file path or '-' for STDIN");
|
|
89
|
+
const opts = {};
|
|
90
|
+
if (flags.aud !== undefined && flags.aud !== '')
|
|
91
|
+
opts.audience = flags.aud;
|
|
92
|
+
const res = await (0, index_1.cmdExplain)(readSource(src), opts);
|
|
93
|
+
process.stdout.write(res.text + '\n');
|
|
94
|
+
if (!res.allow)
|
|
95
|
+
process.exitCode = 1;
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
case 'keygen': {
|
|
99
|
+
process.stdout.write((0, index_1.cmdKeygen)().text + '\n');
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
case 'simulate': {
|
|
103
|
+
const policyPath = positionals[0];
|
|
104
|
+
const actionsPath = positionals[1];
|
|
105
|
+
if (policyPath === undefined || actionsPath === undefined) {
|
|
106
|
+
throw new Error('simulate: expected <policy.json> <actions.json>');
|
|
107
|
+
}
|
|
108
|
+
process.stdout.write((0, index_1.cmdSimulate)(readSource(policyPath), readSource(actionsPath)) + '\n');
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
case 'discovery': {
|
|
112
|
+
if (flags.aud === undefined || flags.aud === '')
|
|
113
|
+
throw new Error('discovery: --aud <id> is required');
|
|
114
|
+
const endpoints = {};
|
|
115
|
+
if (flags.attest)
|
|
116
|
+
endpoints.attestation_challenge = flags.attest;
|
|
117
|
+
if (flags.revocation)
|
|
118
|
+
endpoints.revocation_epoch = flags.revocation;
|
|
119
|
+
if (flags.beacon)
|
|
120
|
+
endpoints.liveness_beacon = flags.beacon;
|
|
121
|
+
if (flags.stepup)
|
|
122
|
+
endpoints.stepup = flags.stepup;
|
|
123
|
+
process.stdout.write((0, index_1.cmdDiscovery)({
|
|
124
|
+
audience: flags.aud,
|
|
125
|
+
...(flags.suites ? { suites: flags.suites.split(',').map((s) => s.trim()).filter(Boolean) } : {}),
|
|
126
|
+
...(Object.keys(endpoints).length ? { endpoints } : {}),
|
|
127
|
+
}) + '\n');
|
|
128
|
+
break;
|
|
129
|
+
}
|
|
130
|
+
default:
|
|
131
|
+
throw new Error(`unknown command '${command}'\n\n${USAGE}`);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
main().catch((e) => {
|
|
135
|
+
process.stderr.write(`pca: ${e instanceof Error ? e.message : String(e)}\n`);
|
|
136
|
+
process.exitCode = 1;
|
|
137
|
+
});
|
|
138
|
+
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;AACA;;;;;;;GAOG;;AAEH,qCAAuC;AAEvC,mCAAsF;AAEtF,MAAM,KAAK,GAAG;;;;;;;;;;;;;CAab,CAAC;AAEF,gEAAgE;AAChE,SAAS,UAAU,CAAC,GAAW;IAC7B,IAAI,GAAG,KAAK,GAAG;QAAE,OAAO,IAAA,sBAAY,EAAC,CAAC,EAAE,MAAM,CAAC,CAAC;IAChD,OAAO,IAAA,sBAAY,EAAC,GAAG,EAAE,MAAM,CAAC,CAAC;AACnC,CAAC;AAO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,IAAI,KAAK,CAAC,MAAM;gBAAE,SAAS,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;YAClD,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,IAAA,oBAAY,EAAC;gBACX,QAAQ,EAAE,KAAK,CAAC,GAAG;gBACnB,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;gBACjG,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;aACxD,CAAC,GAAG,IAAI,CACV,CAAC;YACF,MAAM;QACR,CAAC;QACD;YACE,MAAM,IAAI,KAAK,CAAC,oBAAoB,OAAO,QAAQ,KAAK,EAAE,CAAC,CAAC;IAChE,CAAC;AACH,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,CAAU,EAAE,EAAE;IAC1B,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IAC7E,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;AACvB,CAAC,CAAC,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `pca` developer CLI — the honest inspector for Proof-Carrying Authority.
|
|
3
|
+
*
|
|
4
|
+
* Four pure command functions, each taking parsed arguments and returning a string (or a small
|
|
5
|
+
* structured result) so they are unit-testable without spawning a process. They lean ENTIRELY on
|
|
6
|
+
* `@atlasauth/pca`'s own primitives — the same decode / verify / compile / simulate code the
|
|
7
|
+
* resource server and the facade use — so what the CLI prints is what the verifier actually does.
|
|
8
|
+
*
|
|
9
|
+
* HONEST about scope: nothing here authorizes anything. `decode` and `explain` are read-only
|
|
10
|
+
* inspectors; `explain` runs the REAL `verifyPCActnCore` against a grant it reads straight out of
|
|
11
|
+
* the PCActn's own capability chain, so a "verdict" it prints is the local, grant-relative view —
|
|
12
|
+
* the resource server, with its stored counter / revocation / attestation state, remains the
|
|
13
|
+
* authority. `keygen` mints a throwaway dev keypair (never a production holder). `simulate` is a
|
|
14
|
+
* pure offline planning replay: it mutates nothing, signs nothing, and reaches no network.
|
|
15
|
+
*/
|
|
16
|
+
import { decodePCActn } from '@atlasauth/pca';
|
|
17
|
+
/**
|
|
18
|
+
* Parse CLI input that is EITHER PCActn JSON text or its base64url wire form. Detection is
|
|
19
|
+
* structural: a leading `{` (after trimming) is JSON; anything else is tried as base64url whose
|
|
20
|
+
* decoded bytes must be UTF-8 PCActn JSON. Either way the bytes go through the strict
|
|
21
|
+
* `decodePCActn` parser, so a malformed object throws a clear Error.
|
|
22
|
+
*/
|
|
23
|
+
export declare function parsePCActnInput(input: string): ReturnType<typeof decodePCActn>;
|
|
24
|
+
/**
|
|
25
|
+
* Decode a PCActn (JSON or base64url) and return a readable summary: verb, resource, audience, the
|
|
26
|
+
* issued/expiry window (ISO + raw ms), counter, capability-chain depth, the claimed risk, and
|
|
27
|
+
* whether a threshold or zk-compliance field rides along. Throws a clear Error on malformed input.
|
|
28
|
+
*/
|
|
29
|
+
export declare function cmdDecode(input: string): string;
|
|
30
|
+
export interface ExplainResult {
|
|
31
|
+
allow: boolean;
|
|
32
|
+
checks: Record<string, string>;
|
|
33
|
+
reasons: string[];
|
|
34
|
+
text: string;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* The "why did it (not) verify?" explainer. Decodes the PCActn, takes its `cap_chain[0]` as the root
|
|
38
|
+
* grant (the capability the whole chain descends from), and runs the REAL `verifyPCActnCore` against
|
|
39
|
+
* it, then formats each check as PASS / FAIL / — (not enforced at this milestone) with a final
|
|
40
|
+
* verdict line. `--aud` supplies this verifier's audience; omit it to accept any audience.
|
|
41
|
+
*/
|
|
42
|
+
export declare function cmdExplain(input: string, opts: {
|
|
43
|
+
audience?: string;
|
|
44
|
+
now?: number;
|
|
45
|
+
}): Promise<ExplainResult>;
|
|
46
|
+
export interface KeygenResult {
|
|
47
|
+
publicKey: string;
|
|
48
|
+
secretKey: string;
|
|
49
|
+
text: string;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Mint a throwaway Ed25519 dev keypair and return both keys base64url-encoded plus a clearly labelled
|
|
53
|
+
* block. This is a DEV convenience — not a production holder key. The secret signs PCActns as this
|
|
54
|
+
* holder and must stay private; the public key is what a grant binds to (`holder`).
|
|
55
|
+
*/
|
|
56
|
+
export declare function cmdKeygen(): KeygenResult;
|
|
57
|
+
export interface DiscoveryCmdOptions {
|
|
58
|
+
audience: string;
|
|
59
|
+
suites?: string[];
|
|
60
|
+
endpoints?: {
|
|
61
|
+
attestation_challenge?: string;
|
|
62
|
+
revocation_epoch?: string;
|
|
63
|
+
liveness_beacon?: string;
|
|
64
|
+
stepup?: string;
|
|
65
|
+
grant?: string;
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
/** Emit a `.well-known/pca-configuration` document for a resource server to publish. */
|
|
69
|
+
export declare function cmdDiscovery(opts: DiscoveryCmdOptions): string;
|
|
70
|
+
/**
|
|
71
|
+
* Compile a policy spec `{ permissions, limits? }` and replay an actions array against it, printing a
|
|
72
|
+
* per-action table (auto / step_up / deny + the trust budget remaining after each), the static lints
|
|
73
|
+
* `lintPolicy` found, and the autonomy bound (the most this grant can spend/risk between human
|
|
74
|
+
* co-signs). Pure and offline — the resource server's verifier remains the authority at run time.
|
|
75
|
+
*/
|
|
76
|
+
export declare function cmdSimulate(policyJson: string, actionsJson: string): string;
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* The `pca` developer CLI — the honest inspector for Proof-Carrying Authority.
|
|
4
|
+
*
|
|
5
|
+
* Four pure command functions, each taking parsed arguments and returning a string (or a small
|
|
6
|
+
* structured result) so they are unit-testable without spawning a process. They lean ENTIRELY on
|
|
7
|
+
* `@atlasauth/pca`'s own primitives — the same decode / verify / compile / simulate code the
|
|
8
|
+
* resource server and the facade use — so what the CLI prints is what the verifier actually does.
|
|
9
|
+
*
|
|
10
|
+
* HONEST about scope: nothing here authorizes anything. `decode` and `explain` are read-only
|
|
11
|
+
* inspectors; `explain` runs the REAL `verifyPCActnCore` against a grant it reads straight out of
|
|
12
|
+
* the PCActn's own capability chain, so a "verdict" it prints is the local, grant-relative view —
|
|
13
|
+
* the resource server, with its stored counter / revocation / attestation state, remains the
|
|
14
|
+
* authority. `keygen` mints a throwaway dev keypair (never a production holder). `simulate` is a
|
|
15
|
+
* pure offline planning replay: it mutates nothing, signs nothing, and reaches no network.
|
|
16
|
+
*/
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.parsePCActnInput = parsePCActnInput;
|
|
19
|
+
exports.cmdDecode = cmdDecode;
|
|
20
|
+
exports.cmdExplain = cmdExplain;
|
|
21
|
+
exports.cmdKeygen = cmdKeygen;
|
|
22
|
+
exports.cmdDiscovery = cmdDiscovery;
|
|
23
|
+
exports.cmdSimulate = cmdSimulate;
|
|
24
|
+
const pca_1 = require("@atlasauth/pca");
|
|
25
|
+
// ---- small helpers --------------------------------------------------------------------------------
|
|
26
|
+
/** Message of an unknown throwable without an `any`/suppression cast. */
|
|
27
|
+
function errMessage(e) {
|
|
28
|
+
return e instanceof Error ? e.message : String(e);
|
|
29
|
+
}
|
|
30
|
+
function isRecord(v) {
|
|
31
|
+
return typeof v === 'object' && v !== null && !Array.isArray(v);
|
|
32
|
+
}
|
|
33
|
+
/** Parse JSON into `unknown` (never `any`) with a labelled error. */
|
|
34
|
+
function parseJson(s, label) {
|
|
35
|
+
try {
|
|
36
|
+
return JSON.parse(s);
|
|
37
|
+
}
|
|
38
|
+
catch (e) {
|
|
39
|
+
throw new Error(`${label}: invalid JSON: ${errMessage(e)}`);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
/** Epoch-ms → ISO 8601, or a clear marker when the value is not a finite instant. */
|
|
43
|
+
function iso(ms) {
|
|
44
|
+
if (typeof ms !== 'number' || !Number.isFinite(ms))
|
|
45
|
+
return '(none)';
|
|
46
|
+
const d = new Date(ms);
|
|
47
|
+
return Number.isNaN(d.getTime()) ? '(invalid)' : d.toISOString();
|
|
48
|
+
}
|
|
49
|
+
/** Right-pad to `width` for simple fixed-column tables. */
|
|
50
|
+
function pad(s, width) {
|
|
51
|
+
return s.length >= width ? s : s + ' '.repeat(width - s.length);
|
|
52
|
+
}
|
|
53
|
+
// ---- decode ---------------------------------------------------------------------------------------
|
|
54
|
+
/**
|
|
55
|
+
* Parse CLI input that is EITHER PCActn JSON text or its base64url wire form. Detection is
|
|
56
|
+
* structural: a leading `{` (after trimming) is JSON; anything else is tried as base64url whose
|
|
57
|
+
* decoded bytes must be UTF-8 PCActn JSON. Either way the bytes go through the strict
|
|
58
|
+
* `decodePCActn` parser, so a malformed object throws a clear Error.
|
|
59
|
+
*/
|
|
60
|
+
function parsePCActnInput(input) {
|
|
61
|
+
const trimmed = input.trim();
|
|
62
|
+
if (trimmed.length === 0)
|
|
63
|
+
throw new Error('empty input: expected a PCActn as JSON text or base64url');
|
|
64
|
+
if (trimmed.startsWith('{')) {
|
|
65
|
+
try {
|
|
66
|
+
return (0, pca_1.decodePCActn)(trimmed);
|
|
67
|
+
}
|
|
68
|
+
catch (e) {
|
|
69
|
+
throw new Error(`not a valid PCActn (JSON): ${errMessage(e)}`);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
let bytes;
|
|
73
|
+
try {
|
|
74
|
+
bytes = (0, pca_1.unb64u)(trimmed);
|
|
75
|
+
}
|
|
76
|
+
catch (e) {
|
|
77
|
+
throw new Error(`input is neither JSON (no leading '{') nor valid base64url: ${errMessage(e)}`);
|
|
78
|
+
}
|
|
79
|
+
let text;
|
|
80
|
+
try {
|
|
81
|
+
text = new TextDecoder('utf-8', { fatal: true }).decode(bytes);
|
|
82
|
+
}
|
|
83
|
+
catch {
|
|
84
|
+
throw new Error('base64url decoded to bytes that are not valid UTF-8; not a PCActn');
|
|
85
|
+
}
|
|
86
|
+
try {
|
|
87
|
+
return (0, pca_1.decodePCActn)(text);
|
|
88
|
+
}
|
|
89
|
+
catch (e) {
|
|
90
|
+
throw new Error(`base64url decoded but is not a valid PCActn: ${errMessage(e)}`);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Decode a PCActn (JSON or base64url) and return a readable summary: verb, resource, audience, the
|
|
95
|
+
* issued/expiry window (ISO + raw ms), counter, capability-chain depth, the claimed risk, and
|
|
96
|
+
* whether a threshold or zk-compliance field rides along. Throws a clear Error on malformed input.
|
|
97
|
+
*/
|
|
98
|
+
function cmdDecode(input) {
|
|
99
|
+
const p = parsePCActnInput(input);
|
|
100
|
+
const chainDepth = Array.isArray(p.cap_chain) ? p.cap_chain.length : 0;
|
|
101
|
+
const riskR = isRecord(p.risk_claim) && typeof p.risk_claim.r === 'number' ? String(p.risk_claim.r) : '(none)';
|
|
102
|
+
const lines = [
|
|
103
|
+
'PCActn summary',
|
|
104
|
+
` verb ${p.action.verb}`,
|
|
105
|
+
` resource ${p.action.resource}`,
|
|
106
|
+
` reversibility ${p.action.reversibility_class}`,
|
|
107
|
+
` audience ${p.aud || '(none)'}`,
|
|
108
|
+
` issued (iat) ${iso(p.iat)} [${p.iat}]`,
|
|
109
|
+
` expires (exp) ${iso(p.exp)} [${p.exp}]`,
|
|
110
|
+
` counter ${p.counter}`,
|
|
111
|
+
` cap-chain depth ${chainDepth}`,
|
|
112
|
+
` risk_claim.r ${riskR}`,
|
|
113
|
+
` threshold ${p.threshold !== undefined ? 'present' : 'absent'}`,
|
|
114
|
+
` zk_compliance ${p.zk_compliance !== undefined ? 'present' : 'absent'}`,
|
|
115
|
+
];
|
|
116
|
+
return lines.join('\n');
|
|
117
|
+
}
|
|
118
|
+
// ---- explain --------------------------------------------------------------------------------------
|
|
119
|
+
const STATUS_LABEL = { pass: 'PASS', fail: 'FAIL', 'not-enforced': '—' };
|
|
120
|
+
/**
|
|
121
|
+
* The "why did it (not) verify?" explainer. Decodes the PCActn, takes its `cap_chain[0]` as the root
|
|
122
|
+
* grant (the capability the whole chain descends from), and runs the REAL `verifyPCActnCore` against
|
|
123
|
+
* it, then formats each check as PASS / FAIL / — (not enforced at this milestone) with a final
|
|
124
|
+
* verdict line. `--aud` supplies this verifier's audience; omit it to accept any audience.
|
|
125
|
+
*/
|
|
126
|
+
async function cmdExplain(input, opts) {
|
|
127
|
+
const p = parsePCActnInput(input);
|
|
128
|
+
const grant = Array.isArray(p.cap_chain) ? p.cap_chain[0] : undefined;
|
|
129
|
+
if (!grant)
|
|
130
|
+
throw new Error('cannot explain: the PCActn has an empty capability chain (no root grant)');
|
|
131
|
+
const result = await (0, pca_1.verifyPCActnCore)(p, {
|
|
132
|
+
grant,
|
|
133
|
+
audience: opts.audience ?? null,
|
|
134
|
+
nowEpoch: opts.now,
|
|
135
|
+
});
|
|
136
|
+
const checks = {};
|
|
137
|
+
for (const [name, status] of Object.entries(result.checks)) {
|
|
138
|
+
checks[name] = STATUS_LABEL[status] ?? status;
|
|
139
|
+
}
|
|
140
|
+
const reasons = [];
|
|
141
|
+
if (result.reason)
|
|
142
|
+
reasons.push(result.reason);
|
|
143
|
+
const audLine = opts.audience === undefined ? 'any (not supplied)' : opts.audience;
|
|
144
|
+
const width = Math.max(...Object.keys(checks).map((k) => k.length), 0) + 2;
|
|
145
|
+
const checkLines = Object.entries(result.checks).map(([name, status]) => {
|
|
146
|
+
const label = STATUS_LABEL[status] ?? status;
|
|
147
|
+
const note = status === 'not-enforced' ? ' (not enforced at this milestone)' : '';
|
|
148
|
+
return ` ${pad(name, width)}${label}${note}`;
|
|
149
|
+
});
|
|
150
|
+
const text = [
|
|
151
|
+
'PCActn verification (explain)',
|
|
152
|
+
` verb ${p.action.verb}`,
|
|
153
|
+
` resource ${p.action.resource}`,
|
|
154
|
+
` action audience ${p.aud || '(none)'}`,
|
|
155
|
+
` verifier aud ${audLine}`,
|
|
156
|
+
'',
|
|
157
|
+
...checkLines,
|
|
158
|
+
'',
|
|
159
|
+
` VERDICT: ${result.allow ? 'ALLOW' : 'DENY'}`,
|
|
160
|
+
...(reasons.length ? ['', ' reasons:', ...reasons.map((r) => ` - ${r}`)] : []),
|
|
161
|
+
].join('\n');
|
|
162
|
+
return { allow: result.allow, checks, reasons, text };
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Mint a throwaway Ed25519 dev keypair and return both keys base64url-encoded plus a clearly labelled
|
|
166
|
+
* block. This is a DEV convenience — not a production holder key. The secret signs PCActns as this
|
|
167
|
+
* holder and must stay private; the public key is what a grant binds to (`holder`).
|
|
168
|
+
*/
|
|
169
|
+
function cmdKeygen() {
|
|
170
|
+
const kp = (0, pca_1.generateKeyPair)();
|
|
171
|
+
const publicKey = (0, pca_1.b64u)(kp.publicKey);
|
|
172
|
+
const secretKey = (0, pca_1.b64u)(kp.secretKey);
|
|
173
|
+
const text = [
|
|
174
|
+
'PCA dev keypair (Ed25519)',
|
|
175
|
+
` public ${publicKey}`,
|
|
176
|
+
` secret ${secretKey}`,
|
|
177
|
+
'',
|
|
178
|
+
' Keep the SECRET key private — it signs PCActns as this holder.',
|
|
179
|
+
' Share only the public key (a grant binds to it as `holder`).',
|
|
180
|
+
].join('\n');
|
|
181
|
+
return { publicKey, secretKey, text };
|
|
182
|
+
}
|
|
183
|
+
/** Emit a `.well-known/pca-configuration` document for a resource server to publish. */
|
|
184
|
+
function cmdDiscovery(opts) {
|
|
185
|
+
const doc = (0, pca_1.buildDiscoveryDocument)({
|
|
186
|
+
audience: opts.audience,
|
|
187
|
+
...(opts.suites && opts.suites.length ? { signatureSuites: opts.suites } : {}),
|
|
188
|
+
...(opts.endpoints && Object.keys(opts.endpoints).length ? { endpoints: opts.endpoints } : {}),
|
|
189
|
+
});
|
|
190
|
+
return JSON.stringify(doc, null, 2);
|
|
191
|
+
}
|
|
192
|
+
function parsePolicySpec(policyJson) {
|
|
193
|
+
const spec = parseJson(policyJson, 'policy');
|
|
194
|
+
if (!isRecord(spec))
|
|
195
|
+
throw new Error('policy must be a JSON object { permissions, limits? }');
|
|
196
|
+
if (!isRecord(spec.permissions))
|
|
197
|
+
throw new Error('policy.permissions must be an object { connector: [action, ...] }');
|
|
198
|
+
const permissions = {};
|
|
199
|
+
for (const [connector, acts] of Object.entries(spec.permissions)) {
|
|
200
|
+
if (!Array.isArray(acts))
|
|
201
|
+
throw new Error(`policy.permissions.${connector} must be an array of action names`);
|
|
202
|
+
const names = [];
|
|
203
|
+
for (const a of acts) {
|
|
204
|
+
if (typeof a !== 'string')
|
|
205
|
+
throw new Error(`policy.permissions.${connector} must contain only strings`);
|
|
206
|
+
names.push(a);
|
|
207
|
+
}
|
|
208
|
+
permissions[connector] = names;
|
|
209
|
+
}
|
|
210
|
+
if (spec.limits === undefined)
|
|
211
|
+
return { permissions };
|
|
212
|
+
if (!isRecord(spec.limits))
|
|
213
|
+
throw new Error('policy.limits must be an object { action: "$X/period" }');
|
|
214
|
+
const limits = {};
|
|
215
|
+
for (const [k, v] of Object.entries(spec.limits)) {
|
|
216
|
+
if (typeof v !== 'string')
|
|
217
|
+
throw new Error(`policy.limits.${k} must be a string like "$500/day"`);
|
|
218
|
+
limits[k] = v;
|
|
219
|
+
}
|
|
220
|
+
return { permissions, limits };
|
|
221
|
+
}
|
|
222
|
+
function parseSimActions(actionsJson) {
|
|
223
|
+
const arr = parseJson(actionsJson, 'actions');
|
|
224
|
+
if (!Array.isArray(arr))
|
|
225
|
+
throw new Error('actions must be a JSON array of { verb, resource, params?, at? }');
|
|
226
|
+
return arr.map((raw, i) => {
|
|
227
|
+
if (!isRecord(raw))
|
|
228
|
+
throw new Error(`actions[${i}] must be an object`);
|
|
229
|
+
if (typeof raw.verb !== 'string')
|
|
230
|
+
throw new Error(`actions[${i}].verb must be a string`);
|
|
231
|
+
if (typeof raw.resource !== 'string')
|
|
232
|
+
throw new Error(`actions[${i}].resource must be a string`);
|
|
233
|
+
const out = { verb: raw.verb, resource: raw.resource };
|
|
234
|
+
if (raw.params !== undefined) {
|
|
235
|
+
if (!isRecord(raw.params))
|
|
236
|
+
throw new Error(`actions[${i}].params must be an object`);
|
|
237
|
+
out.params = raw.params;
|
|
238
|
+
}
|
|
239
|
+
if (raw.at !== undefined) {
|
|
240
|
+
if (typeof raw.at !== 'number' || !Number.isFinite(raw.at))
|
|
241
|
+
throw new Error(`actions[${i}].at must be a number (epoch ms)`);
|
|
242
|
+
out.at = raw.at;
|
|
243
|
+
}
|
|
244
|
+
return out;
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Compile a policy spec `{ permissions, limits? }` and replay an actions array against it, printing a
|
|
249
|
+
* per-action table (auto / step_up / deny + the trust budget remaining after each), the static lints
|
|
250
|
+
* `lintPolicy` found, and the autonomy bound (the most this grant can spend/risk between human
|
|
251
|
+
* co-signs). Pure and offline — the resource server's verifier remains the authority at run time.
|
|
252
|
+
*/
|
|
253
|
+
function cmdSimulate(policyJson, actionsJson) {
|
|
254
|
+
const { permissions, limits } = parsePolicySpec(policyJson);
|
|
255
|
+
const policy = (0, pca_1.compilePolicy)({ permissions, ...(limits !== undefined ? { limits } : {}) });
|
|
256
|
+
const actions = parseSimActions(actionsJson);
|
|
257
|
+
const report = (0, pca_1.simulate)(policy, actions);
|
|
258
|
+
const lints = (0, pca_1.lintPolicy)(policy);
|
|
259
|
+
const { bMax, kappa } = policy.riskPolicy;
|
|
260
|
+
const safety = kappa > 0 ? Math.max(0, bMax) / kappa : 0;
|
|
261
|
+
const autonomyBound = safety * kappa;
|
|
262
|
+
const header = ` ${pad('#', 3)}${pad('verb', 18)}${pad('resource', 20)}${pad('outcome', 10)}budgetAfter`;
|
|
263
|
+
const rows = report.results.map((r, i) => ` ${pad(String(i + 1), 3)}${pad(r.action.verb, 18)}${pad(r.action.resource, 20)}${pad(r.outcome, 10)}${r.budgetAfter.toFixed(2)}`);
|
|
264
|
+
const lintLines = lints.length
|
|
265
|
+
? lints.map((l) => ` [${l.level}] ${l.code}: ${l.message}`)
|
|
266
|
+
: [' (none)'];
|
|
267
|
+
return [
|
|
268
|
+
`Policy simulation (${report.results.length} action${report.results.length === 1 ? '' : 's'})`,
|
|
269
|
+
'',
|
|
270
|
+
header,
|
|
271
|
+
...rows,
|
|
272
|
+
'',
|
|
273
|
+
` auto=${report.auto} step_up=${report.stepUp} deny=${report.deny} endBudget=${report.endBudget.toFixed(2)} peakRisk=${report.peakRisk.toFixed(3)}`,
|
|
274
|
+
` autonomy bound: ${autonomyBound.toFixed(2)} (most this grant can spend/risk between human co-signs)`,
|
|
275
|
+
'',
|
|
276
|
+
'Lints:',
|
|
277
|
+
...lintLines,
|
|
278
|
+
].join('\n');
|
|
279
|
+
}
|
|
280
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;AAsDH,4CA6BC;AAOD,8BAoBC;AAmBD,gCA4CC;AAeD,8BAaC;AASD,oCAOC;AA+DD,kCAiCC;AAvTD,wCAUwB;AAExB,sGAAsG;AAEtG,yEAAyE;AACzE,SAAS,UAAU,CAAC,CAAU;IAC5B,OAAO,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;AACpD,CAAC;A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AE,CAAC,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CACnI,CAAC;IAEF,MAAM,SAAS,GAAG,KAAK,CAAC,MAAM;QAC5B,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC;QAC5D,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC;IAEjB,OAAO;QACL,sBAAsB,MAAM,CAAC,OAAO,CAAC,MAAM,UAAU,MAAM,CAAC,OAAO,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,GAAG;QAC9F,EAAE;QACF,MAAM;QACN,GAAG,IAAI;QACP,EAAE;QACF,UAAU,MAAM,CAAC,IAAI,aAAa,MAAM,CAAC,MAAM,UAAU,MAAM,CAAC,IAAI,eAAe,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,cAAc,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE;QACxJ,qBAAqB,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC,0DAA0D;QACvG,EAAE;QACF,QAAQ;QACR,GAAG,SAAS;KACb,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,36 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlasauth/pca-cli",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "The pca dev CLI: decode and explain a PCActn (why it passed or failed each check), mint a dev grant/key, and simulate a policy over actions.",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"types": "./dist/index.d.ts",
|
|
7
|
+
"bin": {
|
|
8
|
+
"pca": "./dist/cli.js"
|
|
9
|
+
},
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"default": "./dist/index.js"
|
|
14
|
+
},
|
|
15
|
+
"./package.json": "./package.json"
|
|
16
|
+
},
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"@atlasauth/pca": "0.1.0"
|
|
19
|
+
},
|
|
20
|
+
"devDependencies": {
|
|
21
|
+
"typescript": "^5.6.3",
|
|
22
|
+
"vitest": "^2.1.4"
|
|
23
|
+
},
|
|
24
|
+
"files": [
|
|
25
|
+
"dist",
|
|
26
|
+
"README.md"
|
|
27
|
+
],
|
|
28
|
+
"publishConfig": {
|
|
29
|
+
"access": "public"
|
|
30
|
+
},
|
|
31
|
+
"scripts": {
|
|
32
|
+
"build": "tsc -p tsconfig.build.json",
|
|
33
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
34
|
+
"test": "vitest run"
|
|
35
|
+
}
|
|
6
36
|
}
|