@claudexor/secrets 1.0.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 joi-lab
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,7 @@
1
+ # @claudexor/secrets
2
+
3
+ Internal package of [Claudexor](https://github.com/razzant/claudexor) — Cross-platform secret store: OS keychain where available, else a 0600 file; named secret refs resolved by adapters.
4
+
5
+ Published as part of the Claudexor toolchain; it follows the monorepo's
6
+ lockstep version and has no separate semver contract. Use the `claudexor`
7
+ CLI (or `@claudexor/cli`) as the supported entry point.
@@ -0,0 +1,57 @@
1
+ export { redactSecrets } from "@claudexor/util";
2
+ export type SecretBackend = "auto" | "keychain" | "file";
3
+ /**
4
+ * Secret store mirroring how Codex/Claude store credentials: OS keychain where
5
+ * available (macOS), otherwise a 0600 file under the config dir. (Adapters read
6
+ * their own provider env vars directly; the env-var/helper-command indirection
7
+ * was retired.) Subscriptions are NOT stored here — Claudexor reuses each
8
+ * harness's own native login.
9
+ */
10
+ export declare class SecretStore {
11
+ private readonly backend;
12
+ constructor(backend?: SecretBackend);
13
+ resolvedBackend(): "keychain" | "file";
14
+ /** Why the last `set` landed in the file store despite a keychain backend. */
15
+ lastFallbackReason: string | null;
16
+ set(name: string, value: string): "keychain" | "file";
17
+ get(name: string): string | null;
18
+ delete(name: string): void;
19
+ list(): {
20
+ name: string;
21
+ backend: "keychain" | "file";
22
+ present: true;
23
+ }[];
24
+ private fileStore;
25
+ private writeFileStore;
26
+ private fileSet;
27
+ private fileGet;
28
+ private fileDelete;
29
+ private getKeychain;
30
+ private keychainNames;
31
+ }
32
+ /**
33
+ * The single allowlist of managed secret names (previously duplicated in
34
+ * the CLI and the control API, and BOTH were missing `claude_oauth` — the
35
+ * claude adapter reads it, so it must be settable). Names are secret REFS,
36
+ * never values; adding a name here makes it settable via CLI and HTTP alike.
37
+ */
38
+ export declare const MANAGED_SECRET_NAMES: readonly ["openai", "anthropic", "claude_oauth", "openrouter", "cursor", "opencode", "raw"];
39
+ export declare function isManagedSecretName(name: string): boolean;
40
+ export interface ResolveOptions {
41
+ /** Test seam: inject a scoped store. Production callers use the default. */
42
+ store?: SecretStore;
43
+ }
44
+ /**
45
+ * Resolve a stored secret by name. (The env-var and helper-command indirection
46
+ * options were retired: no production caller ever passed them — adapters read
47
+ * their own provider env vars directly, and a vault helper belongs to a
48
+ * future typed config surface, not a dead parameter.)
49
+ *
50
+ * CLAUDEXOR_DISABLE_STORED_SECRETS=1 is the hermetic kill switch, honored HERE
51
+ * (the single owner) so every adapter's key resolution obeys it uniformly —
52
+ * tests and isolation envelopes must never read the operator's real store.
53
+ * Explicit `opts.store` (the test seam) bypasses the switch: an injected
54
+ * scoped store IS the hermetic fixture.
55
+ */
56
+ export declare function resolveSecret(name: string, opts?: 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E,IAAI,GAAE,cAAmB,GAAG,MAAM,GAAG,IAAI,CAGpF"}
package/dist/index.js ADDED
@@ -0,0 +1,229 @@
1
+ import { execFileSync } from "node:child_process";
2
+ import { chmodSync, existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
3
+ import { platform } from "node:os";
4
+ import { join } from "node:path";
5
+ import { userConfigDir } from "@claudexor/util";
6
+ export { redactSecrets } from "@claudexor/util";
7
+ const SERVICE = "claudexor";
8
+ function configDir() {
9
+ return userConfigDir();
10
+ }
11
+ function fileStorePath() {
12
+ return join(configDir(), "secrets.json");
13
+ }
14
+ function keychainAvailable() {
15
+ if (platform() !== "darwin")
16
+ return false;
17
+ try {
18
+ execFileSync("security", ["help"], { stdio: "ignore" });
19
+ return true;
20
+ }
21
+ catch {
22
+ return false;
23
+ }
24
+ }
25
+ /**
26
+ * Secret store mirroring how Codex/Claude store credentials: OS keychain where
27
+ * available (macOS), otherwise a 0600 file under the config dir. (Adapters read
28
+ * their own provider env vars directly; the env-var/helper-command indirection
29
+ * was retired.) Subscriptions are NOT stored here — Claudexor reuses each
30
+ * harness's own native login.
31
+ */
32
+ export class SecretStore {
33
+ backend;
34
+ constructor(backend = "auto") {
35
+ this.backend = backend;
36
+ }
37
+ resolvedBackend() {
38
+ if (this.backend === "keychain")
39
+ return "keychain";
40
+ if (this.backend === "file")
41
+ return "file";
42
+ // backend === "auto": an explicit env override lets a sandboxed run/test
43
+ // (CLAUDEXOR_CONFIG_DIR + CLAUDEXOR_SECRETS_BACKEND=file) keep ALL secret I/O
44
+ // in the 0600 file store and never read/mutate the real OS login Keychain
45
+ // (which is not path-scoped, so CLAUDEXOR_CONFIG_DIR alone can't redirect it).
46
+ // Precedence: explicit constructor arg > env > platform default. A non-empty
47
+ // env typo FAILS LOUDLY rather than silently falling back to the Keychain
48
+ // (e.g. CLAUDEXOR_SECRETS_BACKEND=fil must not quietly hit the real Keychain).
49
+ const envBackend = process.env.CLAUDEXOR_SECRETS_BACKEND;
50
+ if (envBackend !== undefined && envBackend !== "" && envBackend !== "file" && envBackend !== "keychain" && envBackend !== "auto") {
51
+ throw new Error(`CLAUDEXOR_SECRETS_BACKEND must be file|keychain|auto (got '${envBackend}')`);
52
+ }
53
+ if (envBackend === "file")
54
+ return "file";
55
+ if (envBackend === "keychain")
56
+ return "keychain";
57
+ return keychainAvailable() ? "keychain" : "file";
58
+ }
59
+ /** Why the last `set` landed in the file store despite a keychain backend. */
60
+ lastFallbackReason = null;
61
+ set(name, value) {
62
+ this.lastFallbackReason = null;
63
+ if (this.resolvedBackend() === "keychain") {
64
+ try {
65
+ execFileSync("security", ["add-generic-password", "-U", "-a", SERVICE, "-s", `${SERVICE}:${name}`, "-w"], { input: `${value}\n${value}\n`, stdio: ["pipe", "ignore", "ignore"] });
66
+ return "keychain";
67
+ }
68
+ catch (err) {
69
+ // SURFACED degradation (not silent): callers report this to the UI/CLI.
70
+ this.lastFallbackReason = `keychain write failed (${err instanceof Error ? err.message.split("\n")[0] : "error"}); stored in 0600 file instead`;
71
+ }
72
+ }
73
+ this.fileSet(name, value);
74
+ return "file";
75
+ }
76
+ get(name) {
77
+ if (this.resolvedBackend() === "keychain") {
78
+ try {
79
+ const out = execFileSync("security", ["find-generic-password", "-a", SERVICE, "-s", `${SERVICE}:${name}`, "-w"], { encoding: "utf8", stdio: ["ignore", "pipe", "ignore"] });
80
+ const v = out.trim();
81
+ if (v)
82
+ return v;
83
+ }
84
+ catch {
85
+ /* not in keychain; try file */
86
+ }
87
+ }
88
+ return this.fileGet(name);
89
+ }
90
+ delete(name) {
91
+ if (this.resolvedBackend() === "keychain") {
92
+ try {
93
+ execFileSync("security", ["delete-generic-password", "-a", SERVICE, "-s", `${SERVICE}:${name}`], {
94
+ stdio: "ignore",
95
+ });
96
+ }
97
+ catch {
98
+ /* ignore */
99
+ }
100
+ }
101
+ this.fileDelete(name);
102
+ }
103
+ list() {
104
+ const backend = this.resolvedBackend();
105
+ if (backend === "file") {
106
+ return Object.keys(this.fileStore())
107
+ .sort()
108
+ .map((name) => ({ name, backend: "file", present: true }));
109
+ }
110
+ const names = new Set();
111
+ for (const name of this.keychainNames())
112
+ names.add(name);
113
+ for (const name of Object.keys(this.fileStore()))
114
+ names.add(name);
115
+ return [...names].sort().map((name) => ({
116
+ name,
117
+ backend: this.getKeychain(name) !== null ? "keychain" : "file",
118
+ present: true,
119
+ }));
120
+ }
121
+ fileStore() {
122
+ const path = fileStorePath();
123
+ if (!existsSync(path))
124
+ return {};
125
+ try {
126
+ const parsed = JSON.parse(readFileSync(path, "utf8"));
127
+ if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
128
+ throw new Error("expected an object");
129
+ }
130
+ const out = {};
131
+ for (const [key, value] of Object.entries(parsed)) {
132
+ if (typeof value !== "string")
133
+ throw new Error(`secret '${key}' is not a string`);
134
+ out[key] = value;
135
+ }
136
+ return out;
137
+ }
138
+ catch (err) {
139
+ throw new Error(`invalid Claudexor secret store at ${path}: ${err instanceof Error ? err.message : String(err)}`);
140
+ }
141
+ }
142
+ writeFileStore(store) {
143
+ mkdirSync(configDir(), { recursive: true });
144
+ const path = fileStorePath();
145
+ writeFileSync(path, JSON.stringify(store, null, 2) + "\n", { mode: 0o600 });
146
+ try {
147
+ chmodSync(path, 0o600);
148
+ }
149
+ catch {
150
+ /* best-effort on platforms without POSIX modes */
151
+ }
152
+ }
153
+ fileSet(name, value) {
154
+ const store = this.fileStore();
155
+ store[name] = value;
156
+ this.writeFileStore(store);
157
+ }
158
+ fileGet(name) {
159
+ return this.fileStore()[name] ?? null;
160
+ }
161
+ fileDelete(name) {
162
+ const store = this.fileStore();
163
+ delete store[name];
164
+ this.writeFileStore(store);
165
+ }
166
+ getKeychain(name) {
167
+ try {
168
+ const out = execFileSync("security", ["find-generic-password", "-a", SERVICE, "-s", `${SERVICE}:${name}`, "-w"], { encoding: "utf8", stdio: ["ignore", "pipe", "ignore"] });
169
+ const v = out.trim();
170
+ return v || null;
171
+ }
172
+ catch {
173
+ return null;
174
+ }
175
+ }
176
+ keychainNames() {
177
+ if (platform() !== "darwin")
178
+ return [];
179
+ try {
180
+ const out = execFileSync("security", ["dump-keychain"], { encoding: "utf8", stdio: ["ignore", "pipe", "ignore"] });
181
+ const re = new RegExp(`"svce"<blob>="${SERVICE}:([^"]+)"`, "g");
182
+ const names = [];
183
+ for (let m = re.exec(out); m !== null; m = re.exec(out)) {
184
+ if (m[1])
185
+ names.push(m[1]);
186
+ }
187
+ return names;
188
+ }
189
+ catch {
190
+ return [];
191
+ }
192
+ }
193
+ }
194
+ /**
195
+ * The single allowlist of managed secret names (previously duplicated in
196
+ * the CLI and the control API, and BOTH were missing `claude_oauth` — the
197
+ * claude adapter reads it, so it must be settable). Names are secret REFS,
198
+ * never values; adding a name here makes it settable via CLI and HTTP alike.
199
+ */
200
+ export const MANAGED_SECRET_NAMES = [
201
+ "openai",
202
+ "anthropic",
203
+ "claude_oauth",
204
+ "openrouter",
205
+ "cursor",
206
+ "opencode",
207
+ "raw",
208
+ ];
209
+ export function isManagedSecretName(name) {
210
+ return MANAGED_SECRET_NAMES.includes(name);
211
+ }
212
+ /**
213
+ * Resolve a stored secret by name. (The env-var and helper-command indirection
214
+ * options were retired: no production caller ever passed them — adapters read
215
+ * their own provider env vars directly, and a vault helper belongs to a
216
+ * future typed config surface, not a dead parameter.)
217
+ *
218
+ * CLAUDEXOR_DISABLE_STORED_SECRETS=1 is the hermetic kill switch, honored HERE
219
+ * (the single owner) so every adapter's key resolution obeys it uniformly —
220
+ * tests and isolation envelopes must never read the operator's real store.
221
+ * Explicit `opts.store` (the test seam) bypasses the switch: an injected
222
+ * scoped store IS the hermetic fixture.
223
+ */
224
+ export function resolveSecret(name, opts = {}) {
225
+ if (!opts.store && process.env.CLAUDEXOR_DISABLE_STORED_SECRETS === "1")
226
+ return null;
227
+ return (opts.store ?? new SecretStore()).get(name);
228
+ }
229
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":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CAAC,EAAE,CAAC;gBACxD,IAAI,CAAC,CAAC,CAAC,CAAC;oBAAE,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YAC7B,CAAC;YACD,OAAO,KAAK,CAAC;QACf,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,EAAE,CAAC;QACZ,CAAC;IACH,CAAC;CACF;AAED;;;;;GAKG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,QAAQ;IACR,WAAW;IACX,cAAc;IACd,YAAY;IACZ,QAAQ;IACR,UAAU;IACV,KAAK;CACG,CAAC;AAEX,MAAM,UAAU,mBAAmB,CAAC,IAAY;IAC9C,OAAQ,oBAA0C,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AACpE,CAAC;AAOD;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,aAAa,CAAC,IAAY,EAAE,OAAuB,EAAE;IACnE,IAAI,CAAC,IAAI,CAAC,KAAK,IAAI,OAAO,CAAC,GAAG,CAAC,gCAAgC,KAAK,GAAG;QAAE,OAAO,IAAI,CAAC;IACrF,OAAO,CAAC,IAAI,CAAC,KAAK,IAAI,IAAI,WAAW,EAAE,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AACrD,CAAC"}
package/package.json ADDED
@@ -0,0 +1,40 @@
1
+ {
2
+ "name": "@claudexor/secrets",
3
+ "version": "1.0.0",
4
+ "license": "MIT",
5
+ "description": "Cross-platform secret store: OS keychain where available, else a 0600 file; named secret refs resolved by adapters.",
6
+ "type": "module",
7
+ "main": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "default": "./dist/index.js"
13
+ }
14
+ },
15
+ "files": [
16
+ "dist"
17
+ ],
18
+ "dependencies": {
19
+ "@claudexor/util": "1.0.0"
20
+ },
21
+ "repository": {
22
+ "type": "git",
23
+ "url": "git+https://github.com/razzant/claudexor.git",
24
+ "directory": "packages/secrets"
25
+ },
26
+ "homepage": "https://github.com/razzant/claudexor#readme",
27
+ "bugs": {
28
+ "url": "https://github.com/razzant/claudexor/issues"
29
+ },
30
+ "engines": {
31
+ "node": ">=20.19"
32
+ },
33
+ "publishConfig": {
34
+ "access": "public"
35
+ },
36
+ "scripts": {
37
+ "build": "tsc",
38
+ "typecheck": "tsc --noEmit"
39
+ }
40
+ }