Versions 2 to 318
new file, 157 lines
1+// A credential is never picked up from a file nobody asked for. A folder with a key signs in with that key only, and a
2+// key file that can't be read is an error, not a reason to try another credential. With no key, this machine's
3+// ~/.abso/token signs in only for a command given --token-file. The admin token is read by admin commands alone, and
5+
8+import { mkdirSync, mkdtempSync, readdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
15+
26+
34+
41+
46+ writeFileSync(join(dir, ".abso", "config.json"), JSON.stringify({ server, project: "p", agent: "me" }));
50+
65+
86+
88+ it("a folder's key is the only credential it sends; an unreadable key file is an error", () => {
94+ assert.equal(tokenFor(server, { ABSO_TOKEN: "env-token" }, keyed), KEY, "even with ABSO_TOKEN");
95+ assert.throws(() => tokenFor(server, {}, folder(server, "not a key")), /key file .* can't be read/);
97+ assert.equal(tokenFor(server, {}, keyless), undefined, "the token file is never read by itself");
102+
103+ it("a keyless folder: refused as signed out, naming --token-file; with --token-file it signs in", async () => {
127+ /You're not signed in\. Run abso login, then abso join <project>\. ~\/\.abso\/token is used only with --token-file\./,
133+
135+ assert.equal(adminTokenWords({ ABSO_ADMIN_TOKEN: "x" }), "Using the admin token, from ABSO_ADMIN_TOKEN.");
146+ assert.deepEqual(users.sort(), ["flag-commands.ts", "main.ts"], "abso flag and abso key, and nothing else");
150+ /const admin = adminToken\(env\.env\);\s+\(env\.writeErr \?\? env\.write\)\(`\$\{adminTokenWords/,
- MCP
- compare on this site's /mcp
- CLI
- abso diff 2 318 client/test/token-file.test.ts --json
- JSON
- /christopher/abso-core/compare/2..318?file=client%2Ftest%2Ftoken-file.test.ts&format=json