@skrr-ai/auth-core 0.1.2
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 +21 -0
- package/dist/cjs/aead.d.ts +24 -0
- package/dist/cjs/aead.js +65 -0
- package/dist/cjs/authExpiredDetector.d.ts +65 -0
- package/dist/cjs/authExpiredDetector.js +89 -0
- package/dist/cjs/authHelper.d.ts +51 -0
- package/dist/cjs/authHelper.js +321 -0
- package/dist/cjs/credentialEnvelope.d.ts +85 -0
- package/dist/cjs/credentialEnvelope.js +230 -0
- package/dist/cjs/credentialEnvelopeBridge.d.ts +116 -0
- package/dist/cjs/credentialEnvelopeBridge.js +637 -0
- package/dist/cjs/credentialResolver.d.ts +278 -0
- package/dist/cjs/credentialResolver.js +423 -0
- package/dist/cjs/daemonPair.d.ts +172 -0
- package/dist/cjs/daemonPair.js +495 -0
- package/dist/cjs/daemonScopes.d.ts +74 -0
- package/dist/cjs/daemonScopes.js +84 -0
- package/dist/cjs/deviceIdentityBridge.d.ts +113 -0
- package/dist/cjs/deviceIdentityBridge.js +591 -0
- package/dist/cjs/deviceKey.d.ts +167 -0
- package/dist/cjs/deviceKey.js +332 -0
- package/dist/cjs/fdToken.d.ts +17 -0
- package/dist/cjs/fdToken.js +238 -0
- package/dist/cjs/harnessTrust.d.ts +72 -0
- package/dist/cjs/harnessTrust.js +103 -0
- package/dist/cjs/headers-helper.d.ts +25 -0
- package/dist/cjs/headers-helper.js +323 -0
- package/dist/cjs/index.d.ts +37 -0
- package/dist/cjs/index.js +305 -0
- package/dist/cjs/jwtUtils.d.ts +35 -0
- package/dist/cjs/jwtUtils.js +61 -0
- package/dist/cjs/kek/index.d.ts +89 -0
- package/dist/cjs/kek/index.js +208 -0
- package/dist/cjs/kek/linux.d.ts +92 -0
- package/dist/cjs/kek/linux.js +596 -0
- package/dist/cjs/kek/macos.d.ts +112 -0
- package/dist/cjs/kek/macos.js +599 -0
- package/dist/cjs/kek/types.d.ts +111 -0
- package/dist/cjs/kek/types.js +43 -0
- package/dist/cjs/kek/windows.d.ts +71 -0
- package/dist/cjs/kek/windows.js +350 -0
- package/dist/cjs/kek/zeroize-registry.d.ts +44 -0
- package/dist/cjs/kek/zeroize-registry.js +63 -0
- package/dist/cjs/legacyStatePreflight.d.ts +67 -0
- package/dist/cjs/legacyStatePreflight.js +78 -0
- package/dist/cjs/localIdentity.d.ts +54 -0
- package/dist/cjs/localIdentity.js +57 -0
- package/dist/cjs/loginLocalhost.d.ts +115 -0
- package/dist/cjs/loginLocalhost.js +368 -0
- package/dist/cjs/loginWithLocalhost.d.ts +131 -0
- package/dist/cjs/loginWithLocalhost.js +359 -0
- package/dist/cjs/machineId.d.ts +35 -0
- package/dist/cjs/machineId.js +239 -0
- package/dist/cjs/messages.d.ts +9 -0
- package/dist/cjs/messages.js +44 -0
- package/dist/cjs/package.json +3 -0
- package/dist/cjs/pkce.d.ts +62 -0
- package/dist/cjs/pkce.js +158 -0
- package/dist/cjs/recoveryCode.d.ts +61 -0
- package/dist/cjs/recoveryCode.js +213 -0
- package/dist/cjs/refresh.d.ts +215 -0
- package/dist/cjs/refresh.js +877 -0
- package/dist/cjs/refreshClassification.d.ts +53 -0
- package/dist/cjs/refreshClassification.js +105 -0
- package/dist/cjs/refreshScheduler.d.ts +53 -0
- package/dist/cjs/refreshScheduler.js +332 -0
- package/dist/cjs/runtime.d.ts +149 -0
- package/dist/cjs/runtime.js +136 -0
- package/dist/cjs/spawnEnv.d.ts +76 -0
- package/dist/cjs/spawnEnv.js +153 -0
- package/dist/cjs/ttlParser.d.ts +54 -0
- package/dist/cjs/ttlParser.js +87 -0
- package/dist/cjs/types.d.ts +91 -0
- package/dist/cjs/types.js +26 -0
- package/dist/esm/aead.d.ts +24 -0
- package/dist/esm/aead.js +57 -0
- package/dist/esm/authExpiredDetector.d.ts +65 -0
- package/dist/esm/authExpiredDetector.js +85 -0
- package/dist/esm/authHelper.d.ts +51 -0
- package/dist/esm/authHelper.js +311 -0
- package/dist/esm/credentialEnvelope.d.ts +85 -0
- package/dist/esm/credentialEnvelope.js +213 -0
- package/dist/esm/credentialEnvelopeBridge.d.ts +116 -0
- package/dist/esm/credentialEnvelopeBridge.js +620 -0
- package/dist/esm/credentialResolver.d.ts +278 -0
- package/dist/esm/credentialResolver.js +414 -0
- package/dist/esm/daemonPair.d.ts +172 -0
- package/dist/esm/daemonPair.js +476 -0
- package/dist/esm/daemonScopes.d.ts +74 -0
- package/dist/esm/daemonScopes.js +80 -0
- package/dist/esm/deviceIdentityBridge.d.ts +113 -0
- package/dist/esm/deviceIdentityBridge.js +572 -0
- package/dist/esm/deviceKey.d.ts +167 -0
- package/dist/esm/deviceKey.js +320 -0
- package/dist/esm/fdToken.d.ts +17 -0
- package/dist/esm/fdToken.js +231 -0
- package/dist/esm/harnessTrust.d.ts +72 -0
- package/dist/esm/harnessTrust.js +97 -0
- package/dist/esm/headers-helper.d.ts +25 -0
- package/dist/esm/headers-helper.js +316 -0
- package/dist/esm/index.d.ts +37 -0
- package/dist/esm/index.js +144 -0
- package/dist/esm/jwtUtils.d.ts +35 -0
- package/dist/esm/jwtUtils.js +57 -0
- package/dist/esm/kek/index.d.ts +89 -0
- package/dist/esm/kek/index.js +162 -0
- package/dist/esm/kek/linux.d.ts +92 -0
- package/dist/esm/kek/linux.js +585 -0
- package/dist/esm/kek/macos.d.ts +112 -0
- package/dist/esm/kek/macos.js +586 -0
- package/dist/esm/kek/types.d.ts +111 -0
- package/dist/esm/kek/types.js +39 -0
- package/dist/esm/kek/windows.d.ts +71 -0
- package/dist/esm/kek/windows.js +344 -0
- package/dist/esm/kek/zeroize-registry.d.ts +44 -0
- package/dist/esm/kek/zeroize-registry.js +58 -0
- package/dist/esm/legacyStatePreflight.d.ts +67 -0
- package/dist/esm/legacyStatePreflight.js +71 -0
- package/dist/esm/localIdentity.d.ts +54 -0
- package/dist/esm/localIdentity.js +54 -0
- package/dist/esm/loginLocalhost.d.ts +115 -0
- package/dist/esm/loginLocalhost.js +355 -0
- package/dist/esm/loginWithLocalhost.d.ts +131 -0
- package/dist/esm/loginWithLocalhost.js +353 -0
- package/dist/esm/machineId.d.ts +35 -0
- package/dist/esm/machineId.js +231 -0
- package/dist/esm/messages.d.ts +9 -0
- package/dist/esm/messages.js +40 -0
- package/dist/esm/pkce.d.ts +62 -0
- package/dist/esm/pkce.js +148 -0
- package/dist/esm/recoveryCode.d.ts +61 -0
- package/dist/esm/recoveryCode.js +207 -0
- package/dist/esm/refresh.d.ts +215 -0
- package/dist/esm/refresh.js +863 -0
- package/dist/esm/refreshClassification.d.ts +53 -0
- package/dist/esm/refreshClassification.js +106 -0
- package/dist/esm/refreshScheduler.d.ts +53 -0
- package/dist/esm/refreshScheduler.js +329 -0
- package/dist/esm/runtime.d.ts +149 -0
- package/dist/esm/runtime.js +121 -0
- package/dist/esm/spawnEnv.d.ts +76 -0
- package/dist/esm/spawnEnv.js +149 -0
- package/dist/esm/ttlParser.d.ts +54 -0
- package/dist/esm/ttlParser.js +83 -0
- package/dist/esm/types.d.ts +91 -0
- package/dist/esm/types.js +21 -0
- package/package.json +82 -0
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import type { KekStrategy } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Stable telemetry kind string — fleet dashboards size the macOS cohort
|
|
4
|
+
* by this value. Only one backend ships in this module today.
|
|
5
|
+
*/
|
|
6
|
+
declare const KIND_SHELLOUT = "macos-keychain-shellout";
|
|
7
|
+
/**
|
|
8
|
+
* @internal Test seam — inject a mock execFile for hermetic tests so the
|
|
9
|
+
* suite never touches the real Keychain. Reset to `null` to restore the
|
|
10
|
+
* real `child_process.execFile`.
|
|
11
|
+
*/
|
|
12
|
+
type ExecFileLike = (file: string, args: readonly string[], options?: {
|
|
13
|
+
encoding?: BufferEncoding;
|
|
14
|
+
stdio?: unknown;
|
|
15
|
+
}) => Promise<{
|
|
16
|
+
stdout: string;
|
|
17
|
+
stderr: string;
|
|
18
|
+
}>;
|
|
19
|
+
export declare function __setExecFileForTest(fn: ExecFileLike | null): void;
|
|
20
|
+
/** @internal Test seam — clear the security-binary probe cache. */
|
|
21
|
+
export declare function __resetSecurityProbeCacheForTest(): void;
|
|
22
|
+
/** @internal Test seam — clear the resolved-keychain cache. */
|
|
23
|
+
export declare function __resetResolvedKeychainCacheForTest(): void;
|
|
24
|
+
/**
|
|
25
|
+
* Zero out and drop every cached master-KEK buffer.
|
|
26
|
+
*
|
|
27
|
+
* Iterates the cache map, fills each buffer with zeroes (so any
|
|
28
|
+
* residual reference held by a caller observes the wipe), then clears
|
|
29
|
+
* the map. The buffer-fill happens before the map clear so the typed
|
|
30
|
+
* test seam (`__getKekCacheForTest`) can prove the wipe targeted the
|
|
31
|
+
* actual cached bytes rather than a copy.
|
|
32
|
+
*
|
|
33
|
+
* Must be called on:
|
|
34
|
+
* - Daemon shutdown (SIGTERM / SIGINT) so the KEK does not linger in
|
|
35
|
+
* memory across the process exit window where coredumps could land.
|
|
36
|
+
* - KEK rotation, after the new KEK has been resolved and the wrapped
|
|
37
|
+
* DEK re-issued, so the OLD KEK does not stay resident.
|
|
38
|
+
* - Logout flows that wipe at-rest credentials, so there is no useful
|
|
39
|
+
* KEK left to wrap a re-enrolled DEK under the previous identity.
|
|
40
|
+
*
|
|
41
|
+
* Idempotent — safe to call when the cache is already empty.
|
|
42
|
+
*/
|
|
43
|
+
export declare function zeroizeMacosKekCache(): void;
|
|
44
|
+
/** @internal Test seam — clear the in-process master-KEK cache. Internally
|
|
45
|
+
* routes through the production zeroize helper so the test-reset path
|
|
46
|
+
* exercises the same buffer-fill that ships in production. */
|
|
47
|
+
export declare function __resetKekCacheForTest(): void;
|
|
48
|
+
/**
|
|
49
|
+
* @internal Test seam — return the live cache buffer for the given
|
|
50
|
+
* `service`/`account` pair so the zeroize test can hold a reference,
|
|
51
|
+
* run zeroize, and verify the underlying bytes went to all-zero
|
|
52
|
+
* (proving the fill was on the actual buffer rather than a copy).
|
|
53
|
+
* Returns null when no entry is cached for that pair.
|
|
54
|
+
*
|
|
55
|
+
* Defaults to the canonical production keys so existing tests that
|
|
56
|
+
* call `__getKekCacheForTest()` keep working without args.
|
|
57
|
+
*/
|
|
58
|
+
export declare function __getKekCacheForTest(service?: string, account?: string): Buffer | null;
|
|
59
|
+
export declare class MacosKek implements KekStrategy {
|
|
60
|
+
readonly id = "macos-secure-enclave";
|
|
61
|
+
/** Telemetry kind of the backend that satisfied the most recent call.
|
|
62
|
+
* Public so the daemon's `cred_envelope` events can include it. */
|
|
63
|
+
private _lastKind;
|
|
64
|
+
/** Keychain `service` (the `-s` arg) this instance reads/writes. */
|
|
65
|
+
private readonly service;
|
|
66
|
+
/** Keychain `account` (the `-a` arg) this instance reads/writes. */
|
|
67
|
+
private readonly account;
|
|
68
|
+
/**
|
|
69
|
+
* @param opts.service Optional override for the keychain `-s` value.
|
|
70
|
+
* Defaults to `ai.skrr.daemon.kek` — the canonical production
|
|
71
|
+
* pair. Override only for hermetic multi-tenant tests or for the
|
|
72
|
+
* real-keychain smoke test, which generates a unique service per
|
|
73
|
+
* run so its `delete-generic-password` teardown cannot clobber the
|
|
74
|
+
* developer's actual master KEK. Production callers MUST pass
|
|
75
|
+
* nothing so fleet telemetry stays sized against one keychain
|
|
76
|
+
* entry per host.
|
|
77
|
+
* @param opts.account Optional override for the keychain `-a` value.
|
|
78
|
+
* Defaults to `master-kek-v1`. Same caveat as `service`: an
|
|
79
|
+
* override that points at a non-default entry must be paired with
|
|
80
|
+
* explicit cleanup if the entry should not persist past the
|
|
81
|
+
* caller's lifetime — `MacosKek` itself never deletes keychain
|
|
82
|
+
* items.
|
|
83
|
+
*/
|
|
84
|
+
constructor(opts?: {
|
|
85
|
+
service?: string;
|
|
86
|
+
account?: string;
|
|
87
|
+
});
|
|
88
|
+
/**
|
|
89
|
+
* Telemetry kind of the most recent successful wrap/unwrap. `null`
|
|
90
|
+
* before any call. Stable string `'macos-keychain-shellout'` after the
|
|
91
|
+
* first successful wrap or unwrap. The kind does not vary with
|
|
92
|
+
* `service`/`account` overrides — the backend is the same.
|
|
93
|
+
*/
|
|
94
|
+
get kind(): typeof KIND_SHELLOUT | null;
|
|
95
|
+
/**
|
|
96
|
+
* `available()` is true on darwin when (a) `security` is on PATH AND
|
|
97
|
+
* (b) a user login keychain can be resolved. Both checks are required
|
|
98
|
+
* because shelling out without a resolvable keychain triggers a
|
|
99
|
+
* system-modal `Keychain Not Found` dialog from the daemon — which
|
|
100
|
+
* blocks the process and offers a destructive `Reset To Defaults`
|
|
101
|
+
* action. When the keychain resolution fails, we honestly return
|
|
102
|
+
* `false` so `credEnvelope.ts` reports `disabled.kek_unavailable`
|
|
103
|
+
* cleanly. Cached results — the probe spawns at most one
|
|
104
|
+
* `security help` and one `security default-keychain` per process.
|
|
105
|
+
*/
|
|
106
|
+
available(): Promise<boolean>;
|
|
107
|
+
wrap(dek: Buffer, aad?: Buffer): Promise<Buffer>;
|
|
108
|
+
unwrap(wrapped: Buffer, aad?: Buffer): Promise<Buffer>;
|
|
109
|
+
unwrapExisting(wrapped: Buffer, aad?: Buffer): Promise<Buffer>;
|
|
110
|
+
describe(): string;
|
|
111
|
+
}
|
|
112
|
+
export {};
|