@bitspark/archon-cli 0.12.0 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/cmd/enroll.d.ts +34 -0
- package/dist/src/cmd/enroll.js +245 -0
- package/dist/src/cmd/enroll.js.map +1 -0
- package/dist/src/cmd/key.js +3 -0
- package/dist/src/cmd/key.js.map +1 -1
- package/dist/src/cmd/key_store.d.ts +51 -10
- package/dist/src/cmd/key_store.js +222 -26
- package/dist/src/cmd/key_store.js.map +1 -1
- package/dist/src/cmd/keygen.js +13 -5
- package/dist/src/cmd/keygen.js.map +1 -1
- package/dist/src/cmd/login.d.ts +4 -0
- package/dist/src/cmd/login.js +25 -9
- package/dist/src/cmd/login.js.map +1 -1
- package/dist/src/cmd/sign.js +20 -4
- package/dist/src/cmd/sign.js.map +1 -1
- package/dist/src/keystore.d.ts +55 -11
- package/dist/src/keystore.js +255 -34
- package/dist/src/keystore.js.map +1 -1
- package/dist/src/main.js +3 -2
- package/dist/src/main.js.map +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { type EnrollChallenge, type EnrollIntent } from "@bitspark/archon-sdk";
|
|
2
|
+
import * as keystore from "../keystore.js";
|
|
3
|
+
export declare const USAGE: string;
|
|
4
|
+
/** Where the command meets the world, so a test can stand in for the terminal and the clock. */
|
|
5
|
+
export interface EnrollIo {
|
|
6
|
+
/** The controlling terminal: where the statement is shown and the question asked. */
|
|
7
|
+
openTerminal(): {
|
|
8
|
+
readLine(): string;
|
|
9
|
+
write(text: string): void;
|
|
10
|
+
close(): void;
|
|
11
|
+
};
|
|
12
|
+
/** Whether stdin is a terminal: then the token is asked for, and its line limit can cut it. */
|
|
13
|
+
stdinIsTerminal(): boolean;
|
|
14
|
+
/** One line of stdin, at most MAX_INPUT bytes. */
|
|
15
|
+
readStdinLine(): Promise<string>;
|
|
16
|
+
stdout(text: string): void;
|
|
17
|
+
/** Unix seconds. */
|
|
18
|
+
now(): number;
|
|
19
|
+
}
|
|
20
|
+
export declare function run(args: string[], io?: EnrollIo): Promise<void>;
|
|
21
|
+
/** Steps 4 to 6 of docs/enroll.md §4: the token's audience is the selected one, its key is the
|
|
22
|
+
* entry's, and its deadline is still ahead. The token's audience is display-safe already (the
|
|
23
|
+
* codec refuses otherwise), and is JSON-quoted to show where it ends. */
|
|
24
|
+
export declare function checkChallenge(ch: EnrollChallenge, audience: string, key: Uint8Array, now: number): void;
|
|
25
|
+
/** The statement of docs/enroll.md §4, byte-identical in every lane
|
|
26
|
+
* (cli/testdata/enroll-statement.json). */
|
|
27
|
+
export declare function renderStatement(audience: string, intent: EnrollIntent, key: Uint8Array, deadline: number, keySource: string): string;
|
|
28
|
+
/** The question, naming the account the person is agreeing to, in plain quotes. */
|
|
29
|
+
export declare function prompt(intent: EnrollIntent): string;
|
|
30
|
+
/** Why the entry may not enroll, and how to change that. `key policy` replaces a list rather
|
|
31
|
+
* than adding to it, so the command printed names every context the entry keeps, then
|
|
32
|
+
* archon-enroll/1; it is printed only when every context needs no quoting in any shell, and
|
|
33
|
+
* otherwise the contexts are listed JSON-quoted. */
|
|
34
|
+
export declare function policyRefusal(name: string, policy: keystore.Policy | null): string;
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
// `archon enroll` (docs/enroll.md §4, ADR 0013): make the enrollment proof for a key in the
|
|
2
|
+
// store, but only after showing the person which account the key joins, decoded from the very
|
|
3
|
+
// intent bytes whose digest the proof binds. The challenge arrives as a token the person carries
|
|
4
|
+
// from the signed-in page; the proof leaves as a token they carry back. The command contacts no
|
|
5
|
+
// server, so its success means a proof was produced, never that the key is enrolled.
|
|
6
|
+
import { closeSync, openSync, readSync } from "node:fs";
|
|
7
|
+
import { encodeKey, getPublicKey } from "@bitspark/archon";
|
|
8
|
+
import { decodeEnrollChallenge, ENROLL_DOMAIN, ENROLL_MAX_TOKEN_SIZE, encodeEnrollProof, enrollChallengeRequest, proveEnroll, verifyEnroll, } from "@bitspark/archon-sdk";
|
|
9
|
+
import { jsonString, wantsHelp } from "../io.js";
|
|
10
|
+
import * as keystore from "../keystore.js";
|
|
11
|
+
import { openControllingTerminal, openEntered, readDefaultKeyName, readPasswordEntry, readTerminalLine, takePasswordFd, usableKey, } from "./key_store.js";
|
|
12
|
+
import { formatRfc3339Utc, selectedAudience } from "./login.js";
|
|
13
|
+
export const USAGE = "usage: archon enroll [--challenge-file <file>] [--audience <base>] [--key <name>] [--password-fd <n>]\n" +
|
|
14
|
+
" makes the enrollment proof for a key in the store, after showing which account it joins\n" +
|
|
15
|
+
" (docs/enroll.md). The challenge token is read from --challenge-file, or one line of stdin;\n" +
|
|
16
|
+
" the audience is --audience or ARCHON_AUDIENCE; the key is --key or the default key. The\n" +
|
|
17
|
+
" question is asked on the terminal, always, and the proof token is printed on stdout.";
|
|
18
|
+
/** Asks for the token when stdin is a terminal. */
|
|
19
|
+
const PASTE_PROMPT = "paste the challenge token, then press Enter: ";
|
|
20
|
+
/** The one purpose version 1 renders (docs/enroll.md §2). */
|
|
21
|
+
const PURPOSE = "add-key";
|
|
22
|
+
/** What is read before decoding: a token and its surrounding whitespace. */
|
|
23
|
+
const MAX_INPUT = 1 << 20;
|
|
24
|
+
const NO_TERMINAL = "enroll: there is no terminal to ask on; archon enroll asks every time, and a password from " +
|
|
25
|
+
"ARCHON_KEY_PASSWORD or --password-fd does not answer it";
|
|
26
|
+
const realIo = {
|
|
27
|
+
openTerminal() {
|
|
28
|
+
const terminal = openControllingTerminal();
|
|
29
|
+
return {
|
|
30
|
+
readLine: () => readTerminalLine(terminal),
|
|
31
|
+
write: (text) => terminal.io.write(text),
|
|
32
|
+
close: () => terminal.close(),
|
|
33
|
+
};
|
|
34
|
+
},
|
|
35
|
+
stdinIsTerminal: () => process.stdin.isTTY === true,
|
|
36
|
+
async readStdinLine() {
|
|
37
|
+
// Bounded like the Go and Rust lanes, and the stream is stopped once the line is in: when
|
|
38
|
+
// stdin is the terminal, a reader left running would take the person's "y" from the
|
|
39
|
+
// controlling terminal's reader, which shares the device.
|
|
40
|
+
const chunks = [];
|
|
41
|
+
let size = 0;
|
|
42
|
+
for await (const chunk of process.stdin) {
|
|
43
|
+
const b = chunk;
|
|
44
|
+
const nl = b.indexOf(0x0a);
|
|
45
|
+
chunks.push(nl >= 0 ? b.subarray(0, nl) : b);
|
|
46
|
+
size += nl >= 0 ? nl : b.length;
|
|
47
|
+
if (nl >= 0 || size > MAX_INPUT)
|
|
48
|
+
break; // breaking out destroys the stream
|
|
49
|
+
}
|
|
50
|
+
if (size > MAX_INPUT) {
|
|
51
|
+
throw new Error(`enroll: the line on stdin is over ${MAX_INPUT} bytes; a challenge token is at most ${ENROLL_MAX_TOKEN_SIZE}`);
|
|
52
|
+
}
|
|
53
|
+
return Buffer.concat(chunks).toString("utf8");
|
|
54
|
+
},
|
|
55
|
+
stdout: (text) => process.stdout.write(text),
|
|
56
|
+
now: () => Math.floor(Date.now() / 1000),
|
|
57
|
+
};
|
|
58
|
+
export async function run(args, io = realIo) {
|
|
59
|
+
if (wantsHelp(args)) {
|
|
60
|
+
io.stdout(`${USAGE}\n`);
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
const { rest, fd } = takePasswordFd(args);
|
|
64
|
+
let challengeFile;
|
|
65
|
+
let audienceFlag;
|
|
66
|
+
let keyName;
|
|
67
|
+
for (let i = 0; i < rest.length; i += 2) {
|
|
68
|
+
const flag = rest[i];
|
|
69
|
+
const value = rest[i + 1];
|
|
70
|
+
if (value === undefined || value === "")
|
|
71
|
+
throw new Error(`flag ${JSON.stringify(flag)} needs a value\n${USAGE}`);
|
|
72
|
+
if (flag === "--challenge-file")
|
|
73
|
+
challengeFile = value;
|
|
74
|
+
else if (flag === "--audience")
|
|
75
|
+
audienceFlag = value;
|
|
76
|
+
else if (flag === "--key")
|
|
77
|
+
keyName = value;
|
|
78
|
+
else
|
|
79
|
+
throw new Error(`unknown flag ${JSON.stringify(flag)}\n${USAGE}`);
|
|
80
|
+
}
|
|
81
|
+
if (challengeFile === undefined && fd === 0) {
|
|
82
|
+
throw new Error("enroll: --password-fd 0 and a challenge token on stdin would read the same stream; pass the token with --challenge-file");
|
|
83
|
+
}
|
|
84
|
+
// 1. The entry: one read, whose header the seal authenticates at unlock (ADR 0012 §4).
|
|
85
|
+
const name = keyName ?? readDefaultKeyName();
|
|
86
|
+
if (name === undefined || name === "") {
|
|
87
|
+
throw new Error("enroll: no default key is set; pass --key <name>, or choose one with: archon key default <name>");
|
|
88
|
+
}
|
|
89
|
+
const { file, header } = usableKey(name);
|
|
90
|
+
if (header.policy === null || !keystore.permits(header.policy, ENROLL_DOMAIN)) {
|
|
91
|
+
throw new Error(policyRefusal(name, header.policy));
|
|
92
|
+
}
|
|
93
|
+
// 2. The audience the person selected, and a terminal to ask on.
|
|
94
|
+
const audience = selectedAudience("enroll", "the audience is your configuration, never a token's word (docs/enroll.md §4)", audienceFlag);
|
|
95
|
+
let terminal;
|
|
96
|
+
try {
|
|
97
|
+
terminal = io.openTerminal();
|
|
98
|
+
}
|
|
99
|
+
catch {
|
|
100
|
+
throw new Error(NO_TERMINAL);
|
|
101
|
+
}
|
|
102
|
+
try {
|
|
103
|
+
// 3. The token, read and decoded once. From here on only these values are used.
|
|
104
|
+
const fromTerminal = challengeFile === undefined && io.stdinIsTerminal();
|
|
105
|
+
if (fromTerminal)
|
|
106
|
+
terminal.write(PASTE_PROMPT);
|
|
107
|
+
const text = challengeFile !== undefined ? readChallengeFile(challengeFile) : await io.readStdinLine();
|
|
108
|
+
let ch;
|
|
109
|
+
try {
|
|
110
|
+
ch = decodeEnrollChallenge(text);
|
|
111
|
+
}
|
|
112
|
+
catch (err) {
|
|
113
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
114
|
+
throw new Error(fromTerminal ? `${message} (a terminal cuts a long pasted line; save the token to a file and pass --challenge-file)` : message);
|
|
115
|
+
}
|
|
116
|
+
// 4.–7. Everything decidable before the person is asked.
|
|
117
|
+
checkChallenge(ch, audience, header.publicKey, io.now());
|
|
118
|
+
const { request, intent } = enrollChallengeRequest(ch);
|
|
119
|
+
if (intent.purpose !== PURPOSE) {
|
|
120
|
+
throw new Error(`enroll: the intent's purpose is ${jsonString(intent.purpose)}; this archon renders only "${PURPOSE}", so it signs nothing else`);
|
|
121
|
+
}
|
|
122
|
+
// 8. Show, and ask on the terminal.
|
|
123
|
+
terminal.write(renderStatement(audience, intent, header.publicKey, ch.deadline, `the store key ${name}`) + prompt(intent));
|
|
124
|
+
const answer = terminal.readLine().trim().toLowerCase();
|
|
125
|
+
if (answer !== "y" && answer !== "yes") {
|
|
126
|
+
// Non-zero, so a script never mistakes a refusal for a proof: stdout stays empty.
|
|
127
|
+
terminal.write("refused. nothing was signed.\n");
|
|
128
|
+
throw new Error("enroll: refused. nothing was signed.");
|
|
129
|
+
}
|
|
130
|
+
// 9. Only now is the key unlocked: the same snapshot, its header now authenticated.
|
|
131
|
+
const seed = openEntered(name, file, readPasswordEntry(fd, false));
|
|
132
|
+
try {
|
|
133
|
+
if (!keystore.permits(header.policy, ENROLL_DOMAIN))
|
|
134
|
+
throw new Error(policyRefusal(name, header.policy));
|
|
135
|
+
const opened = getPublicKey(seed);
|
|
136
|
+
if (!equal(opened, header.publicKey) || !equal(header.publicKey, ch.newKey)) {
|
|
137
|
+
throw new Error(`enroll: key ${name} did not open to the key that was shown; nothing was signed`);
|
|
138
|
+
}
|
|
139
|
+
// 10. The proof, over what was shown, checked before it is printed.
|
|
140
|
+
const proof = proveEnroll(seed, audience, request);
|
|
141
|
+
if (!verifyEnroll(audience, request, proof))
|
|
142
|
+
throw new Error("enroll: the proof did not verify; nothing was printed");
|
|
143
|
+
const token = encodeEnrollProof({ transaction: request.transaction, newKey: request.newKey, proof });
|
|
144
|
+
// 11. The proof token on stdout, alone; the person is told what it is not.
|
|
145
|
+
io.stdout(`${token}\n`);
|
|
146
|
+
terminal.write("proof produced. paste it into the service's page: the key is enrolled only when the page completes.\n");
|
|
147
|
+
}
|
|
148
|
+
finally {
|
|
149
|
+
seed.fill(0);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
finally {
|
|
153
|
+
terminal.close();
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
/** Steps 4 to 6 of docs/enroll.md §4: the token's audience is the selected one, its key is the
|
|
157
|
+
* entry's, and its deadline is still ahead. The token's audience is display-safe already (the
|
|
158
|
+
* codec refuses otherwise), and is JSON-quoted to show where it ends. */
|
|
159
|
+
export function checkChallenge(ch, audience, key, now) {
|
|
160
|
+
if (ch.audience !== audience) {
|
|
161
|
+
throw new Error(`enroll: the token is for ${jsonString(ch.audience)}, not the audience you selected, ${jsonString(audience)}; nothing was shown or signed`);
|
|
162
|
+
}
|
|
163
|
+
if (!equal(ch.newKey, key)) {
|
|
164
|
+
throw new Error(`enroll: the token enrolls ${encodeKey(ch.newKey)}, not this key, ${encodeKey(key)}; nothing was shown or signed`);
|
|
165
|
+
}
|
|
166
|
+
if (now >= ch.deadline) {
|
|
167
|
+
throw new Error(`enroll: the request's deadline, about ${formatRfc3339Utc(ch.deadline)}, has passed; begin again on the service's page`);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
/** The statement of docs/enroll.md §4, byte-identical in every lane
|
|
171
|
+
* (cli/testdata/enroll-statement.json). */
|
|
172
|
+
export function renderStatement(audience, intent, key, deadline, keySource) {
|
|
173
|
+
let out = `${audience} asks you to add a key to an account:\n`;
|
|
174
|
+
out += ` account: ${intent.accountName}\n`;
|
|
175
|
+
out += ` account id: ${intent.accountId}\n`;
|
|
176
|
+
out += ` key: ${encodeKey(key)}\n`;
|
|
177
|
+
if (intent.restrictions.length === 0) {
|
|
178
|
+
out += " restrictions: none\n";
|
|
179
|
+
}
|
|
180
|
+
else {
|
|
181
|
+
out += " restrictions:\n";
|
|
182
|
+
for (const r of intent.restrictions)
|
|
183
|
+
out += ` ${r}\n`;
|
|
184
|
+
}
|
|
185
|
+
out += "the service may give this key the account's authority.\n";
|
|
186
|
+
out += `the request's deadline is about ${formatRfc3339Utc(deadline)}, the service's word; it is not the key's expiry.\n`;
|
|
187
|
+
out += `signing with ${keySource}\n`;
|
|
188
|
+
return out;
|
|
189
|
+
}
|
|
190
|
+
/** The question, naming the account the person is agreeing to, in plain quotes. */
|
|
191
|
+
export function prompt(intent) {
|
|
192
|
+
return `add this key to the account "${intent.accountName}"? [y/N] `;
|
|
193
|
+
}
|
|
194
|
+
/** A context every shell receives as itself, unquoted: sh, cmd.exe and PowerShell alike. A
|
|
195
|
+
* leading `@` or `-` is left out, since PowerShell and flag parsers read those as something
|
|
196
|
+
* else (docs/enroll.md §4 step 1). */
|
|
197
|
+
const BARE_CONTEXT = /^[A-Za-z0-9][A-Za-z0-9._/:+=-]*$/;
|
|
198
|
+
/** Why the entry may not enroll, and how to change that. `key policy` replaces a list rather
|
|
199
|
+
* than adding to it, so the command printed names every context the entry keeps, then
|
|
200
|
+
* archon-enroll/1; it is printed only when every context needs no quoting in any shell, and
|
|
201
|
+
* otherwise the contexts are listed JSON-quoted. */
|
|
202
|
+
export function policyRefusal(name, policy) {
|
|
203
|
+
// A version-2 entry always has one; said the same way in every lane regardless.
|
|
204
|
+
if (policy === null)
|
|
205
|
+
return `enroll: key ${name} may not sign in ${ENROLL_DOMAIN}: it has no policy`;
|
|
206
|
+
const head = `enroll: key ${name} may not sign in ${ENROLL_DOMAIN}: its policy is ${keystore.describePolicy(policy)}`;
|
|
207
|
+
if (policy.contexts.length >= keystore.MAX_CONTEXTS) {
|
|
208
|
+
return `${head}.\n it already lists ${keystore.MAX_CONTEXTS} contexts, the most a policy holds: drop one with archon key policy, or keep a separate key for enrollment`;
|
|
209
|
+
}
|
|
210
|
+
if (!policy.contexts.every((c) => BARE_CONTEXT.test(c))) {
|
|
211
|
+
return `${head}.\n key policy replaces the list: run archon key policy ${name} with --allow for each of ${policy.contexts.map(jsonString).join(", ")}, and for ${ENROLL_DOMAIN}`;
|
|
212
|
+
}
|
|
213
|
+
const command = [`archon key policy ${name}`, ...policy.contexts.map((c) => `--allow ${c}`), `--allow ${ENROLL_DOMAIN}`].join(" ");
|
|
214
|
+
return `${head}.\n to let it enroll, keeping what it has (key policy replaces the list):\n ${command}`;
|
|
215
|
+
}
|
|
216
|
+
function readChallengeFile(path) {
|
|
217
|
+
let fd;
|
|
218
|
+
try {
|
|
219
|
+
fd = openSync(path, "r");
|
|
220
|
+
}
|
|
221
|
+
catch (err) {
|
|
222
|
+
throw new Error(`enroll: could not read ${JSON.stringify(path)}: ${err instanceof Error ? err.message : String(err)}`);
|
|
223
|
+
}
|
|
224
|
+
try {
|
|
225
|
+
const buf = Buffer.alloc(MAX_INPUT + 1);
|
|
226
|
+
let n = 0;
|
|
227
|
+
for (;;) {
|
|
228
|
+
const got = readSync(fd, buf, n, buf.length - n, null);
|
|
229
|
+
if (got === 0)
|
|
230
|
+
break;
|
|
231
|
+
n += got;
|
|
232
|
+
if (n > MAX_INPUT) {
|
|
233
|
+
throw new Error(`enroll: ${JSON.stringify(path)} is over ${MAX_INPUT} bytes; a challenge token is at most ${ENROLL_MAX_TOKEN_SIZE}`);
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
return buf.subarray(0, n).toString("utf8");
|
|
237
|
+
}
|
|
238
|
+
finally {
|
|
239
|
+
closeSync(fd);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
function equal(a, b) {
|
|
243
|
+
return a.length === b.length && a.every((x, i) => x === b[i]);
|
|
244
|
+
}
|
|
245
|
+
//# sourceMappingURL=enroll.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enroll.js","sourceRoot":"","sources":["../../../src/cmd/enroll.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAC5F,8FAA8F;AAC9F,iGAAiG;AACjG,gGAAgG;AAChG,qFAAqF;AACrF,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAExD,OAAO,EAAE,SAAS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/key.js
CHANGED
package/dist/src/cmd/key.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"key.js","sourceRoot":"","sources":["../../../src/cmd/key.ts"],"names":[],"mappings":"AAAA,wFAAwF;AACxF,qEAAqE;AACrE,EAAE;AACF,+EAA+E;AAC/E,uFAAuF;AACvF,gFAAgF;AAChF,uFAAuF;AACvF,2EAA2E;AAC3E,yFAAyF;AACzF,6EAA6E;AAC7E,EAAE;AACF,mFAAmF;AACnF,yFAAyF;AACzF,wFAAwF;AACxF,OAAO,EACL,SAAS,EACT,SAAS,EACT,YAAY,EACZ,cAAc,EACd,aAAa,EACb,eAAe,EACf,WAAW,EACX,cAAc,EACd,eAAe,EACf,KAAK,GACN,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAkB,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5E,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAC;AAExC,MAAM,KAAK,GACT,8DAA8D;IAC9D,qEAAqE;IACrE,0DAA0D;IAC1D,4EAA4E;IAC5E,+EAA+E;IAC/E,gEAAgE;IAChE,2EAA2E;IAC3E,kFAAkF;IAClF,oDAAoD,CAAC;AAEvD,MAAM,UAAU,GAAG,CAAC,IAAc;IAChC,IAAI,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC;QACpB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,KAAK,IAAI,CAAC,CAAC;QACnC,OAAO;IACT,CAAC;IACD,MAAM,CAAC,EAAE,EAAE,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC;IAC3B,QAAQ,EAAE,EAAE,CAAC;QACX,2EAA2E;QAC3E,gFAAgF;QAChF,KAAK,KAAK;YACR,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;YACnB,OAAO;QACT,KAAK,MAAM;YACT,K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AC1C,CAAC;IACD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC;AAC3D,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as keystore from "../keystore.js";
|
|
1
2
|
export declare const USAGE: string;
|
|
2
3
|
/**
|
|
3
4
|
* Scans for `--password-fd <n>` and removes it. The password never travels in argv, so
|
|
@@ -47,6 +48,8 @@ export declare function openControllingTerminal(): ControllingTerminal;
|
|
|
47
48
|
* prompt turned each byte into its own character, so a non-ASCII password derived a key no
|
|
48
49
|
* other lane derives; `openEntered` still opens keys sealed that way, and re-seals them. */
|
|
49
50
|
export declare function promptHidden(label: string, io: HiddenPromptIo): string;
|
|
51
|
+
/** One visible line from the controlling terminal, in cooked mode: `key policy`'s and `enroll`'s y/N. */
|
|
52
|
+
export declare function readTerminalLine(terminal: ControllingTerminal): string;
|
|
50
53
|
/** What the prompt before 0.11.0 made of the same keystrokes: each UTF-8 byte of `password`
|
|
51
54
|
* as a character of its own. undefined for an ASCII password, where both readings agree. */
|
|
52
55
|
export declare function legacyPromptDecoding(password: string): string | undefined;
|
|
@@ -73,11 +76,17 @@ export declare function readPasswordEntry(fd: number | undefined, confirm: boole
|
|
|
73
76
|
*/
|
|
74
77
|
export declare function openEntered(name: string, file: Uint8Array, entry: PasswordEntry): Uint8Array;
|
|
75
78
|
/**
|
|
76
|
-
* The store's own "is there a key called that": a validated name
|
|
77
|
-
* nothing, asking for no password. Shared by `key default <name>` and by
|
|
78
|
-
* pre-network check, so both refuse a missing key with one
|
|
79
|
+
* The store's own "is there a key called that, and can it be used": a validated name and a
|
|
80
|
+
* header read — opening nothing, asking for no password. Shared by `key default <name>` and by
|
|
81
|
+
* `login`'s pre-network check, so both refuse a missing, unreadable or version-1 key with one
|
|
82
|
+
* wording (docs/keystore.md §8.2).
|
|
79
83
|
*/
|
|
80
|
-
export declare function requireNamedKey(name: string):
|
|
84
|
+
export declare function requireNamedKey(name: string): keystore.KeyHeader;
|
|
85
|
+
/** A refusal of a named entry with its machine-mode category (§8.2). */
|
|
86
|
+
export declare class StoreRefusal extends Error {
|
|
87
|
+
readonly category: string;
|
|
88
|
+
constructor(category: string, message: string);
|
|
89
|
+
}
|
|
81
90
|
/**
|
|
82
91
|
* The ONE reader of the default pointer ($ARCHON_HOME/default), shared by `key default`
|
|
83
92
|
* and by `login`'s fallback so the two can never disagree about what "the default" is.
|
|
@@ -93,28 +102,60 @@ export declare function readDefaultKeyName(): string | undefined;
|
|
|
93
102
|
*/
|
|
94
103
|
export declare function unlockNamedKey(name: string, fd: number | undefined): Uint8Array;
|
|
95
104
|
/**
|
|
96
|
-
* A stored key's file and
|
|
97
|
-
* no password. The claim is what `sign --key --expect` checks
|
|
98
|
-
* only when the seal opens, because `keystore.open`
|
|
105
|
+
* A stored key's file and its header as the header CLAIMS it — public key, version, policy —
|
|
106
|
+
* opening nothing and asking for no password. The claim is what `sign --key --expect` checks
|
|
107
|
+
* before the prompt; it is proven only when the seal opens, because `keystore.open` verifies the
|
|
108
|
+
* tag over the header and refuses a seed that does not derive the public key.
|
|
109
|
+
*
|
|
110
|
+
* Every refusal is a StoreRefusal: no-key when no file has that name, else the header's kind.
|
|
99
111
|
*/
|
|
100
112
|
export declare function readNamedKey(name: string): {
|
|
101
113
|
file: Uint8Array;
|
|
102
|
-
|
|
114
|
+
header: keystore.KeyHeader;
|
|
115
|
+
};
|
|
116
|
+
/**
|
|
117
|
+
* readNamedKey for a command that will sign, log in, export or make a key the default: only a
|
|
118
|
+
* version-2 entry may (§8.2). A version-1 entry is refused with the command that converts it,
|
|
119
|
+
* named in full, so a person can act on the line they read.
|
|
120
|
+
*/
|
|
121
|
+
export declare function usableKey(name: string): {
|
|
122
|
+
file: Uint8Array;
|
|
123
|
+
header: keystore.KeyHeader;
|
|
103
124
|
};
|
|
125
|
+
/**
|
|
126
|
+
* Removes --allow <context> (repeatable) and --unrestricted from args and returns the policy
|
|
127
|
+
* they name (docs/keystore.md §8.3). There is no default: undefined when neither appears, and
|
|
128
|
+
* the caller decides whether that is allowed.
|
|
129
|
+
*/
|
|
130
|
+
export declare function takePolicyFlags(args: string[]): {
|
|
131
|
+
rest: string[];
|
|
132
|
+
policy: keystore.Policy | undefined;
|
|
133
|
+
};
|
|
134
|
+
/** The refusal for a new key that names no policy: there is no default. */
|
|
135
|
+
export declare const policyNeeded: (name: string) => Error;
|
|
104
136
|
/**
|
|
105
137
|
* The one place a key is written, shared by `key add` and `keygen --store` so the two
|
|
106
138
|
* cannot drift apart. Salt and nonce are drawn HERE, in the command: the format takes them
|
|
107
139
|
* as arguments and never sources randomness, which is what makes it pinnable.
|
|
108
140
|
*/
|
|
109
|
-
export declare function sealAndWrite(path: string, seed: Uint8Array, password: string): string;
|
|
141
|
+
export declare function sealAndWrite(path: string, seed: Uint8Array, password: string, policy: keystore.Policy): string;
|
|
110
142
|
/** `keygen --store <name>`: the same seal path as `key add`. */
|
|
111
|
-
export declare function storeGenerated(name: string, seed: Uint8Array, fd: number | undefined): void;
|
|
143
|
+
export declare function storeGenerated(name: string, seed: Uint8Array, fd: number | undefined, policy: keystore.Policy): void;
|
|
112
144
|
export declare function runAdd(args: string[]): void;
|
|
113
145
|
/**
|
|
114
146
|
* Prints what each header CLAIMS. The claim is only proven at unlock, which is why this
|
|
115
147
|
* never opens a key and never asks for a password.
|
|
116
148
|
*/
|
|
117
149
|
export declare function runList(args: string[]): void;
|
|
150
|
+
/**
|
|
151
|
+
* Shows an entry's policy, or converts a version-1 entry or changes a version-2 one
|
|
152
|
+
* (docs/keystore.md §8.3). The change form is ALWAYS interactive: it shows the old and the new
|
|
153
|
+
* policy before asking for anything, asks y/N at the controlling terminal, and takes the
|
|
154
|
+
* password from that terminal only — no --yes, no ARCHON_KEY_PASSWORD, no --password-fd. That
|
|
155
|
+
* is a safeguard against a password a program inherited, not an authorization claim (ADR 0012
|
|
156
|
+
* §6): whoever can type the password can also decrypt the file.
|
|
157
|
+
*/
|
|
158
|
+
export declare function runPolicy(args: string[]): void;
|
|
118
159
|
/**
|
|
119
160
|
* Removes a key and says exactly what it removed, from where, and what it does NOT speak
|
|
120
161
|
* for. An unparsable file is refused unless --force: deleting an unrecognised file inside
|