@cotal-ai/auth 0.11.6 → 0.12.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/commands.js +16 -12
- package/dist/commands.js.map +1 -1
- package/dist/continuity.d.ts +23 -0
- package/dist/continuity.d.ts.map +1 -0
- package/dist/continuity.js +142 -0
- package/dist/continuity.js.map +1 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/ledger.d.ts +5 -0
- package/dist/ledger.d.ts.map +1 -1
- package/dist/ledger.js +50 -8
- package/dist/ledger.js.map +1 -1
- package/dist/provider.d.ts.map +1 -1
- package/dist/provider.js +44 -16
- package/dist/provider.js.map +1 -1
- package/dist/service.d.ts +13 -5
- package/dist/service.d.ts.map +1 -1
- package/dist/service.js +32 -14
- package/dist/service.js.map +1 -1
- package/dist/store.d.ts +18 -8
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +74 -51
- package/dist/store.js.map +1 -1
- package/package.json +5 -4
package/dist/store.js
CHANGED
|
@@ -1,35 +1,49 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* callout account identity, the issuer signing keys, and the owner-derivation secret must survive
|
|
6
|
-
* restarts, or previously-minted credentials/owners silently break:
|
|
2
|
+
* Persistence for a space's USER-AUTH material. Everything is generate-on-first-use and STABLE
|
|
3
|
+
* thereafter — the callout account identity, the issuer signing keys, and the owner-derivation
|
|
4
|
+
* secret must survive restarts, or previously-minted credentials/owners silently break:
|
|
7
5
|
*
|
|
8
6
|
* - `callout.json` — the dedicated auth-callout account ({@link CalloutAuth}: account + signing key,
|
|
9
7
|
* callout service creds, deny-all sentinel creds, xkey). Regenerating it would orphan the account
|
|
10
8
|
* the broker config preloads; minting it the first time needs the FULL SpaceAuth (operator seed).
|
|
11
9
|
* - `issuer.json` — the Cotal user-bearer issuer: its pinned `iss` string plus the serialized
|
|
12
10
|
* Ed25519 signing keys (private JWKs) and the active kid. Losing these kills every outstanding
|
|
13
|
-
* bearer (rotation is `rotate`/`retire` on the loaded issuer
|
|
11
|
+
* bearer (rotation is `rotate`/`retire` on the loaded issuer plus a re-put of the document).
|
|
14
12
|
* - `owner-secret.json` — the per-space owner-derivation secret (32 random bytes). REGENERATING IT
|
|
15
13
|
* RE-KEYS EVERY OWNER in the space (same human → different `u_…`), which is a migration, never an
|
|
16
14
|
* accident — hence load-or-create with no overwrite path.
|
|
17
15
|
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
16
|
+
* These SECRET kinds (plus `service-keys.json`, the daemon's key projection) read and write through
|
|
17
|
+
* the {@link SecretStore} seam — the caller composes the store (locally the workspace's
|
|
18
|
+
* `.cotal`-rooted filesystem store, so keys land byte-for-byte on today's paths; a hosted
|
|
19
|
+
* composition injects KMS/Vault) and nothing here discovers one ambiently. The store's atomic
|
|
20
|
+
* whole-value put replaces the explicit temp+rename here; its adapter owns 0600/0700 hardening.
|
|
21
|
+
*
|
|
22
|
+
* The NON-SEAM kinds stay explicit-dir filesystem APIs (the auth-paths posture: the caller picks
|
|
23
|
+
* the dir): the IdP pin (`idp.json`, a trust pin, not a secret) and the auth-service runtime
|
|
24
|
+
* discovery file (`auth-service.json`, ephemeral pid/port/capability).
|
|
25
|
+
*
|
|
26
|
+
* Versioned JSON with fail-loud parsing everywhere (the login session-cache posture: a torn or
|
|
27
|
+
* hand-edited credential surfaces as one legible sentence, never a raw SyntaxError downstream).
|
|
21
28
|
*/
|
|
22
29
|
import { existsSync, readFileSync, rmSync } from "node:fs";
|
|
23
30
|
import { randomBytes } from "node:crypto";
|
|
24
31
|
import { join } from "node:path";
|
|
25
32
|
import { mkSecretDir, writeSecretFileAtomic } from "@cotal-ai/core";
|
|
33
|
+
import { spaceSegment } from "@cotal-ai/workspace";
|
|
26
34
|
import { createCalloutAuth } from "./callout.js";
|
|
27
35
|
import { normalizeIdpUrl } from "./login.js";
|
|
28
36
|
import { createUserTokenIssuer, exportSigningKey, generateSigningKey, importSigningKey, } from "./issuer.js";
|
|
29
|
-
const CALLOUT_FILE = "callout.json";
|
|
30
|
-
const ISSUER_FILE = "issuer.json";
|
|
31
|
-
const OWNER_SECRET_FILE = "owner-secret.json";
|
|
32
37
|
const STORE_VER = 1;
|
|
38
|
+
/** Canonical {@link SecretStore} keys of the four secret kinds — one builder per kind, mirroring
|
|
39
|
+
* today's `.cotal/auth/<space>/<file>` layout so the local filesystem composition is unchanged.
|
|
40
|
+
* A hosted adapter treats them as opaque ids (its own resolve adds tenant scope). The space
|
|
41
|
+
* segment is workspace's ONE guarded encoder (`spaceSegment`, shared with `userAuthStateDir`):
|
|
42
|
+
* a `.`/`..`/empty space is refused before any key or path exists, on both surfaces. */
|
|
43
|
+
export const authCalloutKey = (space) => `auth/${spaceSegment(space)}/callout.json`;
|
|
44
|
+
export const authIssuerKey = (space) => `auth/${spaceSegment(space)}/issuer.json`;
|
|
45
|
+
export const authOwnerSecretKey = (space) => `auth/${spaceSegment(space)}/owner-secret.json`;
|
|
46
|
+
export const authServiceKeysKey = (space) => `auth/${spaceSegment(space)}/service-keys.json`;
|
|
33
47
|
/** The pinned `iss` for a space's Cotal user bearers — a stable URN, deliberately NOT the auth
|
|
34
48
|
* service's URL (the service port is ephemeral; an issuer pin must never change across restarts).
|
|
35
49
|
* Both the issuer (mint) and the callout (validate) take it from here — one source, no drift. */
|
|
@@ -38,55 +52,67 @@ export function spaceIssuer(space) {
|
|
|
38
52
|
throw new Error("spaceIssuer: a space is required");
|
|
39
53
|
return `urn:cotal:auth:${space}`;
|
|
40
54
|
}
|
|
41
|
-
/** Fail-loud versioned-JSON read
|
|
42
|
-
* a legible sentence naming
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
return undefined;
|
|
55
|
+
/** Fail-loud versioned-JSON parse, shared by the store-read and file-read paths: a torn/edited/
|
|
56
|
+
* unknown-version document is a legible sentence naming WHERE it lives (a store key or a path)
|
|
57
|
+
* and the recovery, never a raw parse error downstream. */
|
|
58
|
+
function parseStoreDoc(raw, where, what) {
|
|
46
59
|
let parsed;
|
|
47
60
|
try {
|
|
48
|
-
parsed = JSON.parse(
|
|
61
|
+
parsed = JSON.parse(raw);
|
|
49
62
|
}
|
|
50
63
|
catch (e) {
|
|
51
|
-
throw new Error(`${
|
|
64
|
+
throw new Error(`${where}: the ${what} entry is not valid JSON (${e instanceof Error ? e.message : String(e)}) - restore it from backup; regenerating breaks existing credentials`);
|
|
52
65
|
}
|
|
53
66
|
if (parsed === null || typeof parsed !== "object" || parsed.ver !== STORE_VER)
|
|
54
|
-
throw new Error(`${
|
|
67
|
+
throw new Error(`${where}: unknown ${what} version ${String(parsed?.ver)} (expected ${STORE_VER}) - refusing to guess at credential material`);
|
|
55
68
|
return parsed;
|
|
56
69
|
}
|
|
70
|
+
/** The store-side read: an absent key is undefined; everything else parses fail-loud. The key names
|
|
71
|
+
* the location in errors — under the local filesystem composition it IS the `.cotal`-relative path. */
|
|
72
|
+
async function readStoreValue(store, key, what) {
|
|
73
|
+
const raw = await store.get(key);
|
|
74
|
+
return raw === undefined ? undefined : parseStoreDoc(raw, key, what);
|
|
75
|
+
}
|
|
76
|
+
/** The file-side read, for the NON-SEAM kinds only (the IdP pin, service runtime discovery). */
|
|
77
|
+
function readStoreFile(path, what) {
|
|
78
|
+
if (!existsSync(path))
|
|
79
|
+
return undefined;
|
|
80
|
+
return parseStoreDoc(readFileSync(path, "utf8"), path, what);
|
|
81
|
+
}
|
|
57
82
|
/** Load the persisted callout account material, or undefined if this space never enabled user auth. */
|
|
58
|
-
export function loadCalloutAuth(
|
|
59
|
-
const
|
|
83
|
+
export async function loadCalloutAuth(store, space) {
|
|
84
|
+
const key = authCalloutKey(space);
|
|
85
|
+
const f = await readStoreValue(store, key, "callout account");
|
|
60
86
|
if (!f)
|
|
61
87
|
return undefined;
|
|
62
88
|
const c = f.callout;
|
|
63
89
|
if (!c?.account?.pub || !c.account.jwt || !c.calloutCreds || !c.sentinelCreds || !c.xkey?.seed)
|
|
64
|
-
throw new Error(`${
|
|
90
|
+
throw new Error(`${key}: malformed callout account material - restore it from backup; regenerating orphans the preloaded auth account`);
|
|
65
91
|
return c;
|
|
66
92
|
}
|
|
67
93
|
/** Load-or-create the callout account: first call on a space mints it (operator seed required)
|
|
68
94
|
* and persists; every later call returns the SAME account, so the broker config preload and
|
|
69
95
|
* previously-issued sentinel creds stay valid. Idempotent. */
|
|
70
|
-
export async function ensureCalloutAuth(
|
|
71
|
-
const existing = loadCalloutAuth(
|
|
96
|
+
export async function ensureCalloutAuth(store, input) {
|
|
97
|
+
const existing = await loadCalloutAuth(store, input.space);
|
|
72
98
|
if (existing)
|
|
73
99
|
return existing;
|
|
74
100
|
const callout = await createCalloutAuth(input);
|
|
75
|
-
|
|
76
|
-
writeSecretFileAtomic(join(dir, CALLOUT_FILE), JSON.stringify({ ver: STORE_VER, callout }, null, 2));
|
|
101
|
+
await store.put(authCalloutKey(input.space), JSON.stringify({ ver: STORE_VER, callout }, null, 2));
|
|
77
102
|
return callout;
|
|
78
103
|
}
|
|
79
104
|
/** Load the persisted issuer (all published kids live; the persisted active kid signs), or undefined
|
|
80
105
|
* if this space never enabled user auth. */
|
|
81
|
-
export async function loadIssuer(
|
|
82
|
-
const
|
|
106
|
+
export async function loadIssuer(store, space) {
|
|
107
|
+
const key = authIssuerKey(space);
|
|
108
|
+
const f = await readStoreValue(store, key, "issuer key");
|
|
83
109
|
if (!f)
|
|
84
110
|
return undefined;
|
|
85
111
|
if (!f.issuer || !Array.isArray(f.keys) || !f.keys.length || !f.activeKid)
|
|
86
|
-
throw new Error(`${
|
|
112
|
+
throw new Error(`${key}: malformed issuer key material - restore it from backup; regenerating kills every outstanding bearer`);
|
|
87
113
|
const active = f.keys.find((k) => k.kid === f.activeKid);
|
|
88
114
|
if (!active)
|
|
89
|
-
throw new Error(`${
|
|
115
|
+
throw new Error(`${key}: active kid ${f.activeKid} is not in the key set - restore it from backup`);
|
|
90
116
|
// createUserTokenIssuer starts with one active key; rotate() adds the rest (each rotate re-points
|
|
91
117
|
// active, so feed the non-active keys THROUGH rotate and finish on the persisted active kid).
|
|
92
118
|
const issuer = createUserTokenIssuer({ issuer: f.issuer, key: await importSigningKey(active) });
|
|
@@ -101,38 +127,37 @@ export async function loadIssuer(dir) {
|
|
|
101
127
|
* persists it under the pinned {@link spaceIssuer} `iss`; later calls return the SAME keys, so
|
|
102
128
|
* outstanding bearers keep verifying. A persisted `iss` that disagrees with the space's pin fails
|
|
103
129
|
* loud (the material belongs to another space/layout — never sign under a mismatched issuer). */
|
|
104
|
-
export async function ensureIssuer(
|
|
130
|
+
export async function ensureIssuer(store, space) {
|
|
105
131
|
const iss = spaceIssuer(space);
|
|
106
|
-
const existing = await loadIssuer(
|
|
132
|
+
const existing = await loadIssuer(store, space);
|
|
107
133
|
if (existing) {
|
|
108
134
|
if (existing.issuer !== iss)
|
|
109
|
-
throw new Error(`${
|
|
135
|
+
throw new Error(`${authIssuerKey(space)}: persisted issuer "${existing.issuer}" != this space's pin "${iss}" - the material belongs to a different space; refusing to mint under it`);
|
|
110
136
|
return existing;
|
|
111
137
|
}
|
|
112
138
|
const key = await generateSigningKey();
|
|
113
|
-
|
|
114
|
-
writeSecretFileAtomic(join(dir, ISSUER_FILE), JSON.stringify({ ver: STORE_VER, issuer: iss, activeKid: key.kid, keys: [await exportSigningKey(key)] }, null, 2));
|
|
139
|
+
await store.put(authIssuerKey(space), JSON.stringify({ ver: STORE_VER, issuer: iss, activeKid: key.kid, keys: [await exportSigningKey(key)] }, null, 2));
|
|
115
140
|
return createUserTokenIssuer({ issuer: iss, key });
|
|
116
141
|
}
|
|
117
142
|
/** Load the owner-derivation secret, or undefined if this space never enabled user auth. */
|
|
118
|
-
export function loadOwnerSecret(
|
|
119
|
-
const
|
|
143
|
+
export async function loadOwnerSecret(store, space) {
|
|
144
|
+
const key = authOwnerSecretKey(space);
|
|
145
|
+
const f = await readStoreValue(store, key, "owner secret");
|
|
120
146
|
if (!f)
|
|
121
147
|
return undefined;
|
|
122
148
|
const secret = Buffer.from(f.secretB64 ?? "", "base64");
|
|
123
149
|
if (secret.byteLength !== 32)
|
|
124
|
-
throw new Error(`${
|
|
150
|
+
throw new Error(`${key}: malformed owner secret - restore it from backup; a regenerated secret RE-KEYS EVERY OWNER in the space`);
|
|
125
151
|
return new Uint8Array(secret);
|
|
126
152
|
}
|
|
127
153
|
/** Load-or-create the per-space owner-derivation secret. There is deliberately NO regenerate path:
|
|
128
154
|
* a new secret re-keys every owner in the space (a migration, never an accident). */
|
|
129
|
-
export function ensureOwnerSecret(
|
|
130
|
-
const existing = loadOwnerSecret(
|
|
155
|
+
export async function ensureOwnerSecret(store, space) {
|
|
156
|
+
const existing = await loadOwnerSecret(store, space);
|
|
131
157
|
if (existing)
|
|
132
158
|
return existing;
|
|
133
159
|
const secret = randomBytes(32);
|
|
134
|
-
|
|
135
|
-
writeSecretFileAtomic(join(dir, OWNER_SECRET_FILE), JSON.stringify({ ver: STORE_VER, secretB64: Buffer.from(secret).toString("base64") }, null, 2));
|
|
160
|
+
await store.put(authOwnerSecretKey(space), JSON.stringify({ ver: STORE_VER, secretB64: Buffer.from(secret).toString("base64") }, null, 2));
|
|
136
161
|
return new Uint8Array(secret);
|
|
137
162
|
}
|
|
138
163
|
// ---- the pinned external IdP ----
|
|
@@ -169,22 +194,20 @@ export function ensurePinnedIdp(dir, idpUrl) {
|
|
|
169
194
|
writeSecretFileAtomic(join(dir, IDP_FILE), JSON.stringify({ ver: STORE_VER, ...pin }, null, 2));
|
|
170
195
|
return pin;
|
|
171
196
|
}
|
|
172
|
-
|
|
173
|
-
const
|
|
174
|
-
|
|
175
|
-
const f = readStoreFile(join(dir, SERVICE_KEYS_FILE), "service key projection");
|
|
197
|
+
export async function loadServiceKeys(store, space) {
|
|
198
|
+
const key = authServiceKeysKey(space);
|
|
199
|
+
const f = await readStoreValue(store, key, "service key projection");
|
|
176
200
|
if (!f)
|
|
177
201
|
return undefined;
|
|
178
202
|
if (!f.dataAccount?.pub || !f.dataAccount.signingSeed)
|
|
179
|
-
throw new Error(`${
|
|
203
|
+
throw new Error(`${key}: malformed service key projection - re-run \`cotal up --user-auth\` to rewrite it`);
|
|
180
204
|
return { dataAccount: { pub: f.dataAccount.pub, signingSeed: f.dataAccount.signingSeed } };
|
|
181
205
|
}
|
|
182
206
|
/** Write (or refresh) the service's key projection. Idempotent overwrite — the projection carries
|
|
183
207
|
* no identity of its own, it IS the (stable) data-account signing material, so rewriting from the
|
|
184
208
|
* same space bundle is a no-op in content. */
|
|
185
|
-
export function saveServiceKeys(
|
|
186
|
-
|
|
187
|
-
writeSecretFileAtomic(join(dir, SERVICE_KEYS_FILE), JSON.stringify({ ver: STORE_VER, ...keys }, null, 2));
|
|
209
|
+
export async function saveServiceKeys(store, space, keys) {
|
|
210
|
+
await store.put(authServiceKeysKey(space), JSON.stringify({ ver: STORE_VER, ...keys }, null, 2));
|
|
188
211
|
}
|
|
189
212
|
// ---- the auth-service runtime discovery file ----
|
|
190
213
|
const SERVICE_FILE = "auth-service.json";
|
package/dist/store.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store.js","sourceRoot":"","sources":["../src/store.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"store.js","sourceRoot":"","sources":["../src/store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,WAAW,EAAE,qBAAqB,EAAoB,MAAM,gBAAgB,CAAC;AACtF,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD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AAM,CAAC,IAAI,CAAC,GAAG,EAAE,YAAY,CAAC,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AACnD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cotal-ai/auth",
|
|
3
3
|
"description": "Cotal per-user auth bridge: opaque owner-token derivation and strict user-token validation for the NATS auth-callout cutover (Plane 1 ↔ Plane 2).",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.12.0",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
"@nats-io/nkeys": "^2.0.3",
|
|
23
23
|
"@nats-io/transport-node": "^3.4.0",
|
|
24
24
|
"jose": "^6.2.3",
|
|
25
|
-
"@cotal-ai/core": "0.
|
|
26
|
-
"@cotal-ai/workspace": "0.
|
|
25
|
+
"@cotal-ai/core": "0.12.0",
|
|
26
|
+
"@cotal-ai/workspace": "0.12.0"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"better-auth": "^1.6.23"
|
|
@@ -36,6 +36,7 @@
|
|
|
36
36
|
},
|
|
37
37
|
"scripts": {
|
|
38
38
|
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
39
|
-
"build": "tsc -p tsconfig.json"
|
|
39
|
+
"build": "tsc -p tsconfig.json",
|
|
40
|
+
"test": "tsx smoke/backup-continuity.smoke.ts && tsx smoke/views.smoke.ts"
|
|
40
41
|
}
|
|
41
42
|
}
|