Skip to content

armgit / hypit

Public Imported from GitHub
0

Clone any viral video with AI agents. Not just a script, the whole workflow: swap the face, the words, the B-roll, ship 100 variants in one command, and get your 100M views.

feat(credentials): add a platform Store and select it in every example

Mikee Aib326e81b86b8
diff --git a/examples/interview/hypit.runtime.json b/examples/interview/hypit.runtime.json
index 175f8149..760dc56e 100644
--- a/examples/interview/hypit.runtime.json
+++ b/examples/interview/hypit.runtime.json
@@ -2,8 +2,8 @@
"format": "hypit.runtime-local@1",
"dataRoot": ".hypit/runtimes/local",
"credentials": {
- "os": {
- "use": "@hypit/credential-store-os"
+ "platform": {
+ "use": "@hypit/credential-store-platform"
}
},
"endpoints": {
@@ -12,7 +12,7 @@
"config": {
"baseUrl": "https://hypit.ai",
"apiKey": {
- "store": "os",
+ "store": "platform",
"key": "hypihub.oauth"
},
"defaultConcurrency": 4,
diff --git a/examples/podcast/hypit.runtime.json b/examples/podcast/hypit.runtime.json
index c10b40e7..e7db740a 100644
--- a/examples/podcast/hypit.runtime.json
+++ b/examples/podcast/hypit.runtime.json
@@ -5,8 +5,8 @@
"env": {
"use": "@hypit/credential-store-env"
},
- "os": {
- "use": "@hypit/credential-store-os"
+ "platform": {
+ "use": "@hypit/credential-store-platform"
}
},
"endpoints": {
@@ -15,7 +15,7 @@
"config": {
"baseUrl": "https://hypit.ai",
"apiKey": {
- "store": "os",
+ "store": "platform",
"key": "hypihub.oauth"
},
"defaultConcurrency": 4,
diff --git a/examples/provider-package/hypit.runtime.json b/examples/provider-package/hypit.runtime.json
index 4f3b877c..c414c7c1 100644
--- a/examples/provider-package/hypit.runtime.json
+++ b/examples/provider-package/hypit.runtime.json
@@ -1,11 +1,11 @@
{
"format": "hypit.runtime-local@1",
"dataRoot": ".hypit/execution",
- "credentials": { "os": { "use": "@hypit/credential-store-os" } },
+ "credentials": { "platform": { "use": "@hypit/credential-store-platform" } },
"endpoints": {
"images.personal": {
"use": "@example/provider-images",
- "config": { "baseUrl": "https://images.example", "apiKey": { "store": "os", "key": "images.personal" } }
+ "config": { "baseUrl": "https://images.example", "apiKey": { "store": "platform", "key": "images.personal" } }
}
},
"bindings": { "@hypit/gpt-image@1#gpt-image-2": "images.personal" }
diff --git a/examples/ranking-football/hypit.runtime.json b/examples/ranking-football/hypit.runtime.json
index 175f8149..760dc56e 100644
--- a/examples/ranking-football/hypit.runtime.json
+++ b/examples/ranking-football/hypit.runtime.json
@@ -2,8 +2,8 @@
"format": "hypit.runtime-local@1",
"dataRoot": ".hypit/runtimes/local",
"credentials": {
- "os": {
- "use": "@hypit/credential-store-os"
+ "platform": {
+ "use": "@hypit/credential-store-platform"
}
},
"endpoints": {
@@ -12,7 +12,7 @@
"config": {
"baseUrl": "https://hypit.ai",
"apiKey": {
- "store": "os",
+ "store": "platform",
"key": "hypihub.oauth"
},
"defaultConcurrency": 4,
diff --git a/examples/ranking-football/reference-banana-from-swap/hypit.runtime.json b/examples/ranking-football/reference-banana-from-swap/hypit.runtime.json
index e9ad64ae..3a6ebf05 100644
--- a/examples/ranking-football/reference-banana-from-swap/hypit.runtime.json
+++ b/examples/ranking-football/reference-banana-from-swap/hypit.runtime.json
@@ -2,8 +2,8 @@
"format": "hypit.runtime-local@1",
"dataRoot": ".hypit/runtimes/local",
"credentials": {
- "os": {
- "use": "@hypit/credential-store-os"
+ "platform": {
+ "use": "@hypit/credential-store-platform"
}
},
"endpoints": {
@@ -31,7 +31,7 @@
"use": "@hypit/provider-hypihub",
"config": {
"apiKey": {
- "store": "os",
+ "store": "platform",
"key": "hypihub.default"
}
}
diff --git a/examples/ranking-football/reference-banana/hypit.runtime.json b/examples/ranking-football/reference-banana/hypit.runtime.json
index e9ad64ae..3a6ebf05 100644
--- a/examples/ranking-football/reference-banana/hypit.runtime.json
+++ b/examples/ranking-football/reference-banana/hypit.runtime.json
@@ -2,8 +2,8 @@
"format": "hypit.runtime-local@1",
"dataRoot": ".hypit/runtimes/local",
"credentials": {
- "os": {
- "use": "@hypit/credential-store-os"
+ "platform": {
+ "use": "@hypit/credential-store-platform"
}
},
"endpoints": {
@@ -31,7 +31,7 @@
"use": "@hypit/provider-hypihub",
"config": {
"apiKey": {
- "store": "os",
+ "store": "platform",
"key": "hypihub.default"
}
}
diff --git a/examples/ranking-football/swap-effect-banana-reference-sync/hypit.runtime.json b/examples/ranking-football/swap-effect-banana-reference-sync/hypit.runtime.json
index e9ad64ae..3a6ebf05 100644
--- a/examples/ranking-football/swap-effect-banana-reference-sync/hypit.runtime.json
+++ b/examples/ranking-football/swap-effect-banana-reference-sync/hypit.runtime.json
@@ -2,8 +2,8 @@
"format": "hypit.runtime-local@1",
"dataRoot": ".hypit/runtimes/local",
"credentials": {
- "os": {
- "use": "@hypit/credential-store-os"
+ "platform": {
+ "use": "@hypit/credential-store-platform"
}
},
"endpoints": {
@@ -31,7 +31,7 @@
"use": "@hypit/provider-hypihub",
"config": {
"apiKey": {
- "store": "os",
+ "store": "platform",
"key": "hypihub.default"
}
}
diff --git a/examples/ranking-football/swap-effect-banana/hypit.runtime.json b/examples/ranking-football/swap-effect-banana/hypit.runtime.json
index e9ad64ae..3a6ebf05 100644
--- a/examples/ranking-football/swap-effect-banana/hypit.runtime.json
+++ b/examples/ranking-football/swap-effect-banana/hypit.runtime.json
@@ -2,8 +2,8 @@
"format": "hypit.runtime-local@1",
"dataRoot": ".hypit/runtimes/local",
"credentials": {
- "os": {
- "use": "@hypit/credential-store-os"
+ "platform": {
+ "use": "@hypit/credential-store-platform"
}
},
"endpoints": {
@@ -31,7 +31,7 @@
"use": "@hypit/provider-hypihub",
"config": {
"apiKey": {
- "store": "os",
+ "store": "platform",
"key": "hypihub.default"
}
}
diff --git a/packages/credential-store-file/README.md b/packages/credential-store-file/README.md
index c0a6aafb..245daddb 100644
--- a/packages/credential-store-file/README.md
+++ b/packages/credential-store-file/README.md
@@ -4,7 +4,9 @@ A writable CredentialStore for a deployment that explicitly chooses local file s
Linux without an OS credential locker. It stores unencrypted credential values in an owner-private
directory outside the video project. On Windows the selected directory must have a private user ACL;
POSIX file modes do not set Windows ACLs. Choose `@hypit/credential-store-os` when using macOS Keychain
-or Windows Credential Locker, or `@hypit/credential-store-env` for externally supplied, read-only values.
+or Windows Credential Locker, `@hypit/credential-store-platform` to keep each credential in the store its
+host provides — this one where the host has no locker — or `@hypit/credential-store-env` for externally
+supplied, read-only values.
## Select it before login
diff --git a/packages/credential-store-os/README.md b/packages/credential-store-os/README.md
index 313df6b3..e99d4acc 100644
--- a/packages/credential-store-os/README.md
+++ b/packages/credential-store-os/README.md
@@ -11,3 +11,7 @@ bytes do not appear in command arguments or temporary files.
Use `hypit auth login <endpoint> --runtime <profile>` to write the selected credential and
`hypit auth logout` to remove it.
+
+A Profile that must also run where no locker exists selects `@hypit/credential-store-platform`
+instead: this Store holds the credential on macOS and Windows, and an owner-private file holds it
+elsewhere. Selecting this Store by name still means this locker on every host that runs the Profile.
diff --git a/packages/credential-store-platform/README.md b/packages/credential-store-platform/README.md
new file mode 100644
index 00000000..9b4475f0
--- /dev/null
+++ b/packages/credential-store-platform/README.md
@@ -0,0 +1,59 @@
+# `@hypit/credential-store-platform`
+
+One CredentialStore that keeps each credential where its platform keeps credentials: the user's
+login keychain or Credential Locker on macOS and Windows, and an owner-private file on a host that
+has no such locker. A Profile written once therefore authenticates on Linux, macOS and Windows
+without an author editing it, and `@hypit/credential-store-os`, `@hypit/credential-store-file` and
+`@hypit/credential-store-env` stay selectable by name for anyone who wants one specific store.
+
+## Select it
+
+```json
+{
+ "credentials": {
+ "platform": { "use": "@hypit/credential-store-platform" }
+ },
+ "endpoints": {
+ "hypihub.default": {
+ "use": "@hypit/provider-hypihub",
+ "config": {
+ "baseUrl": "https://hypit.ai",
+ "apiKey": { "store": "platform", "key": "hypihub.oauth" }
+ }
+ }
+ }
+}
+```
+
+The Endpoint still owns its acquisition flow and the Store only persists the result:
+
+```bash
+hypit auth login hypihub.default --runtime <profile>
+hypit auth status hypihub.default --runtime <profile>
+hypit auth logout hypihub.default --runtime <profile>
+```
+
+## What it does not do
+
+The choice is made once per host, from the platform the Runtime is running on. This is not a lookup
+chain: a miss in one store never tries another, and no credential is migrated between them. A
+credential stored in a locker stays in that locker; a credential stored in a file stays in that file.
+
+## Configuration
+
+- `path` selects the directory for the file fallback, resolved against the Host state root printed by
+ `hypit paths`. The default is the same `credentials` directory `@hypit/credential-store-file` uses,
+ so on a host without a locker, switching between the two Stores finds the credential already stored.
+- `service` selects the locker service name. The OS Store's own default applies when it is absent.
+
+## Storage on each platform
+
+On macOS and Windows the credential is held by the platform locker, with exactly the rules of
+`@hypit/credential-store-os`: it is encrypted and access-controlled by the operating system, and it
+is not readable from another machine.
+
+Everywhere else the credential is held by an owner-private document with exactly the rules of
+`@hypit/credential-store-file`: unencrypted JSON, one document per key, directory mode `0700`, file
+mode `0600`, outside the video project, and never enumerated or indexed. Filesystem path-length
+limits apply to an overlong key, which fails rather than selecting another name. A damaged document
+can be replaced by `auth login` or deleted by `auth logout` without decoding the old value.
diff --git a/packages/credential-store-platform/package.json b/packages/credential-store-platform/package.json
new file mode 100644
index 00000000..5591b1b5
--- /dev/null
+++ b/packages/credential-store-platform/package.json
@@ -0,0 +1,23 @@
+{
+ "name": "@hypit/credential-store-platform",
+ "version": "0.0.0-dev",
+ "license": "SEE LICENSE IN LICENSE",
+ "private": true,
+ "type": "module",
+ "exports": {
+ ".": "./src/index.ts"
+ },
+ "files": [
+ "src",
+ "README.md"
+ ],
+ "hypit": {
+ "activation": "./src/activation.ts"
+ },
+ "dependencies": {
+ "@hypit/credential-store-file": "workspace:*",
+ "@hypit/credential-store-os": "workspace:*",
+ "@hypit/runtime": "workspace:*",
+ "@hypit/runtime-kit": "workspace:*"
+ }
+}
diff --git a/packages/credential-store-platform/src/activation.ts b/packages/credential-store-platform/src/activation.ts
new file mode 100644
index 00000000..e434766f
--- /dev/null
+++ b/packages/credential-store-platform/src/activation.ts
@@ -0,0 +1,39 @@
+import { join, resolve } from "node:path";
+import {
+ createRuntimeCredentialStoreAdapterFacet,
+ runtimeConfigExact,
+ runtimeConfigObject,
+ runtimeConfigString,
+} from "@hypit/runtime-kit";
+import { PlatformCredentialStore } from "./store.js";
+
+const platformCredentialStoreAdapter = createRuntimeCredentialStoreAdapterFacet({
+ use: "@hypit/credential-store-platform",
+ validate(context) {
+ const config = runtimeConfigObject(context.config, "platform CredentialStore");
+ runtimeConfigExact(config, ["path", "service"], "platform CredentialStore");
+ runtimeConfigString(config.path, "platform credential path");
+ runtimeConfigString(config.service, "platform credential service");
+ },
+ open(context) {
+ const config = runtimeConfigObject(context.config, "platform CredentialStore");
+ const path = runtimeConfigString(config.path, "platform credential path");
+ const service = runtimeConfigString(config.service, "platform credential service");
+ return {
+ value: new PlatformCredentialStore({
+ // The file fallback lands in the same directory the file Store uses by default, so a Profile
+ // that switches between them on a host without a locker finds the credential it stored.
+ directory: path === undefined
+ ? join(context.hostStateRoot, "credentials")
+ : resolve(context.hostStateRoot, path),
+ ...(service === undefined ? {} : { service }),
+ }),
+ };
+ },
+});
+
+export const hypitPackage = {
+ format: "hypit.node-package@1" as const,
+ hostFacets: [platformCredentialStoreAdapter],
+};
+export default hypitPackage;
diff --git a/packages/credential-store-platform/src/index.ts b/packages/credential-store-platform/src/index.ts
new file mode 100644
index 00000000..aac0559f
--- /dev/null
+++ b/packages/credential-store-platform/src/index.ts
@@ -0,0 +1,2 @@
+export { PlatformCredentialStore } from "./store.js";
+export type { PlatformCredentialStoreOptions } from "./store.js";
diff --git a/packages/credential-store-platform/src/store.ts b/packages/credential-store-platform/src/store.ts
new file mode 100644
index 00000000..9e413bde
--- /dev/null
+++ b/packages/credential-store-platform/src/store.ts
@@ -0,0 +1,97 @@
+import {
+ credentialRef,
+ verifyCredentialRef,
+} from "@hypit/runtime";
+import type {
+ CredentialRef,
+ CredentialValue,
+ WritableCredentialStore,
+} from "@hypit/runtime";
+import { FileCredentialStore } from "@hypit/credential-store-file";
+import { OsCredentialStore } from "@hypit/credential-store-os";
+import type {
+ OsCredentialDeleter,
+ OsCredentialReader,
+ OsCredentialWriter,
+} from "@hypit/credential-store-os";
+
+/** The platforms whose user keychain or credential locker this Store prefers. */
+const LOCKER_PLATFORMS: readonly NodeJS.Platform[] = ["darwin", "win32"];
+
+export type PlatformCredentialStoreOptions = {
+ /** Directory holding the documents used where the platform has no locker. */
+ readonly directory: string;
+ /** Service the locker's entries are filed under; the OS Store's own default applies where absent. */
+ readonly service?: string;
+ /**
+ * The platform to select for, defaulting to the running one. A Profile never states this: it is
+ * separate so the selection can be exercised on one machine for every platform.
+ */
+ readonly platform?: NodeJS.Platform;
+ /** Locker backend to read and write with, where the platform's own locker is not the one to use. */
+ readonly locker?: {
+ readonly read: OsCredentialReader;
+ readonly write: OsCredentialWriter;
+ readonly remove: OsCredentialDeleter;
+ };
+};
+
+/**
+ * One Store that answers to the name `platform` everywhere and keeps each credential where its
+ * platform keeps credentials: the user's keychain or credential locker where one exists, and an
+ * owner-private file where none does. A Profile written once therefore behaves the same on Linux,
+ * macOS and Windows without an author editing it, while `file`, `os` and `env` stay selectable by
+ * name for anyone who wants one specific locker or file.
+ */
+export class PlatformCredentialStore implements WritableCredentialStore {
+ readonly #delegate: WritableCredentialStore;
+ readonly #backing: "os" | "file";
+
+ constructor(options: PlatformCredentialStoreOptions) {
+ if (LOCKER_PLATFORMS.includes(options.platform ?? process.platform)) {
+ this.#backing = "os";
+ this.#delegate = new OsCredentialStore({
+ ...(options.service === undefined ? {} : { service: options.service }),
+ ...options.locker,
+ });
+ } else {
+ this.#backing = "file";
+ this.#delegate = new FileCredentialStore(options.directory);
+ }
+ }
+
+ /** The Store this one delegates to here: the platform locker, or the file Store where there is none. */
+ get backing(): "os" | "file" {
+ return this.#backing;
+ }
+
+ owns(ref: CredentialRef): boolean {
+ return ref.store === "platform";
+ }
+
+ /**
+ * Each delegate owns its own name and refuses refs filed under another, so a ref this Store owns
+ * is retargeted before the delegate sees it. Only the name changes; the opaque key is untouched.
+ */
+ #translated(ref: CredentialRef): CredentialRef {
+ return credentialRef(this.#backing, ref.key);
+ }
+
+ async resolve(ref: CredentialRef): Promise<CredentialValue | undefined> {
+ verifyCredentialRef(ref);
+ if (!this.owns(ref)) return undefined;
+ return await this.#delegate.resolve(this.#translated(ref));
+ }
+
+ async put(ref: CredentialRef, value: CredentialValue): Promise<void> {
+ verifyCredentialRef(ref);
+ if (!this.owns(ref)) throw new Error(`Platform CredentialStore does not own ${ref.store}`);
+ await this.#delegate.put(this.#translated(ref), value);
+ }
+
+ async delete(ref: CredentialRef): Promise<boolean> {
+ verifyCredentialRef(ref);
+ if (!this.owns(ref)) throw new Error(`Platform CredentialStore does not own ${ref.store}`);
+ return await this.#delegate.delete(this.#translated(ref));
+ }
+}
diff --git a/packages/credential-store-platform/test/store.test.ts b/packages/credential-store-platform/test/store.test.ts
new file mode 100644
index 00000000..255dc182
--- /dev/null
+++ b/packages/credential-store-platform/test/store.test.ts
@@ -0,0 +1,99 @@
+import assert from "node:assert/strict";
+import { mkdtemp, readdir, rm, stat } from "node:fs/promises";
+import { tmpdir } from "node:os";
+import { join } from "node:path";
+import test from "node:test";
+import { credentialRef } from "@hypit/runtime";
+import { FileCredentialStore } from "@hypit/credential-store-file";
+import { OsCredentialStore } from "@hypit/credential-store-os";
+import { PlatformCredentialStore } from "../src/store.js";
+
+/** A locker that keeps entries in memory, so a platform's locker is exercised without touching one. */
+function memoryLocker(entries: Readonly<Record<string, string>> = {}) {
+ const values = new Map(Object.entries(entries));
+ return {
+ read: async (_service: string, account: string) => values.get(account),
+ write: async (_service: string, account: string, secret: string) => { values.set(account, secret); },
+ remove: async (_service: string, account: string) => values.delete(account),
+ entries: values,
+ };
+}
+
+async function scratch(prefix: string): Promise<string> {
+ return await mkdtemp(join(tmpdir(), prefix));
+}
+
+test("a platform with a locker stores there and never creates a file", async () => {
+ const root = await scratch("hypit-platform-credentials-");
+ try {
+ const directory = join(root, "credentials");
+ const locker = memoryLocker();
+ const store = new PlatformCredentialStore({ directory, platform: "darwin", locker });
+ assert.equal(store.backing, "os");
+ const ref = credentialRef("platform", "hypihub.oauth");
+ assert.equal(await store.resolve(ref), undefined);
+ await store.put(ref, { secret: "locker-secret" });
+ assert.deepEqual(await store.resolve(ref), { secret: "locker-secret" });
+ assert.equal(locker.entries.get("hypihub.oauth"), "locker-secret");
+ assert.equal(await store.delete(ref), true);
+ assert.equal(await store.resolve(ref), undefined);
+ assert.deepEqual(await readdir(root), [], "the file fallback stays untouched where a locker exists");
+ } finally { await rm(root, { recursive: true, force: true }); }
+});
+
+test("Windows selects the locker as well", async () => {
+ const root = await scratch("hypit-platform-credentials-");
+ try {
+ const store = new PlatformCredentialStore({
+ directory: join(root, "credentials"), platform: "win32", locker: memoryLocker(),
+ });
+ assert.equal(store.backing, "os");
+ } finally { await rm(root, { recursive: true, force: true }); }
+});
+
+test("a platform without a locker stores owner-private documents in the file Store's directory", async () => {
+ const root = await scratch("hypit-platform-credentials-");
+ try {
+ const directory = join(root, "credentials");
+ const store = new PlatformCredentialStore({ directory, platform: "linux" });
+ assert.equal(store.backing, "file");
+ const ref = credentialRef("platform", "hypihub.oauth");
+ await store.put(ref, { secret: "file-secret", expiresAt: 42 });
+ assert.deepEqual(await store.resolve(ref), { secret: "file-secret", expiresAt: 42 });
+ const files = await readdir(directory);
+ assert.deepEqual(files, [`key-${Buffer.from("hypihub.oauth", "utf16le").toString("hex")}.json`]);
+ if (process.platform !== "win32") {
+ assert.equal((await stat(join(directory, files[0]!))).mode & 0o777, 0o600);
+ }
+ assert.equal(await store.delete(ref), true);
+ assert.deepEqual(await readdir(directory), []);
+ } finally { await rm(root, { recursive: true, force: true }); }
+});
+
+test("switching between this Store and the file Store finds the same credential", async () => {
+ const root = await scratch("hypit-platform-credentials-");
+ try {
+ const directory = join(root, "credentials");
+ await new FileCredentialStore(directory).put(credentialRef("file", "hypihub.oauth"), { secret: "written-by-file" });
+ const platform = new PlatformCredentialStore({ directory, platform: "linux" });
+ assert.deepEqual(await platform.resolve(credentialRef("platform", "hypihub.oauth")), { secret: "written-by-file" });
+ await platform.put(credentialRef("platform", "second"), { secret: "written-by-platform" });
+ assert.deepEqual(await new FileCredentialStore(directory).resolve(credentialRef("file", "second")),
+ { secret: "written-by-platform" });
+ } finally { await rm(root, { recursive: true, force: true }); }
+});
+
+test("only this Store owns the name platform, and it owns no other name", async () => {
+ const root = await scratch("hypit-platform-credentials-");
+ try {
+ const directory = join(root, "credentials");
+ const platform = new PlatformCredentialStore({ directory, platform: "linux" });
+ const ref = credentialRef("platform", "hypihub.oauth");
+ assert.equal(await platform.resolve(credentialRef("file", "hypihub.oauth")), undefined,
+ "a ref filed under another name is not this Store's to answer");
+ await assert.rejects(platform.put(credentialRef("env", "HYPIHUB_OAUTH"), { secret: "x" }), /does not own env/u);
+ await assert.rejects(platform.delete(credentialRef("os", "hypihub.oauth")), /does not own os/u);
+ assert.equal(new FileCredentialStore(directory).owns(ref), false);
+ assert.equal(new OsCredentialStore(memoryLocker()).owns(ref), false);
+ } finally { await rm(root, { recursive: true, force: true }); }
+});
diff --git a/packages/video-cli/test/platform-credentials.test.ts b/packages/video-cli/test/platform-credentials.test.ts
new file mode 100644
index 00000000..291a0193
--- /dev/null
+++ b/packages/video-cli/test/platform-credentials.test.ts
@@ -0,0 +1,49 @@
+import assert from "node:assert/strict";
+import { execFile } from "node:child_process";
+import { mkdir, mkdtemp, readdir, rm, writeFile } from "node:fs/promises";
+import { tmpdir } from "node:os";
+import { join } from "node:path";
+import { fileURLToPath } from "node:url";
+import { promisify } from "node:util";
+import test from "node:test";
+
+const exec = promisify(execFile);
+const launcher = fileURLToPath(new URL("../../../bin/hypit.mjs", import.meta.url));
+
+/**
+ * The examples select the `platform` Store so one committed Profile works on every host. On a
+ * platform that has a locker, that Store would use the real keychain or Credential Locker of
+ * whoever runs the suite, so this test covers the hosts it is about and skips the others.
+ */
+const hasLocker = process.platform === "darwin" || process.platform === "win32";
+
+test("the interview example authenticates on a host with no OS locker, without editing its Profile",
+ { skip: hasLocker, timeout: 120_000 }, async (t) => {
+ const root = await mkdtemp(join(tmpdir(), "hypit-platform-example-"));
+ t.after(() => rm(root, { recursive: true, force: true }));
+ const project = join(root, "project");
+ const state = join(root, "host");
+ await mkdir(project, { recursive: true });
+ const profile = fileURLToPath(new URL("../../../examples/interview/hypit.runtime.json", import.meta.url));
+ const run = (...args: string[]) => exec(process.execPath, [launcher, ...args, "--json"], {
+ cwd: project, env: { ...process.env, HYPIT_STATE_HOME: state }, timeout: 60_000, windowsHide: true,
+ });
+ const auth = (action: string, ...args: string[]) =>
+ run("auth", action, "hypihub.default", "--runtime", profile, ...args);
+
+ const before = JSON.parse((await auth("status")).stdout).credentials[0];
+ assert.equal(before.configured, false, "the committed Profile opens, so nothing here rewrites it");
+ assert.equal(before.writable, true, "a host with no locker still accepts a credential");
+ const input = join(root, "secret.txt");
+ await writeFile(input, "example-secret-never-displayed");
+ const login = await auth("login", "--from", input);
+ assert.doesNotMatch(login.stdout, /example-secret-never-displayed/u);
+ assert.equal(JSON.parse((await auth("status")).stdout).credentials[0].configured, true);
+
+ // The fallback is the file Store's own directory, so switching Stores on such a host finds it.
+ assert.equal((await readdir(join(state, "credentials"))).length, 1);
+
+ await auth("logout");
+ assert.equal(JSON.parse((await auth("status")).stdout).credentials[0].configured, false);
+ assert.deepEqual(await readdir(join(state, "credentials")), []);
+ });
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 9ae67447..27400a32 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -966,6 +966,21 @@ importers:
specifier: workspace:*
version: link:../runtime-kit
+ packages/credential-store-platform:
+ dependencies:
+ '@hypit/credential-store-file':
+ specifier: workspace:*
+ version: link:../credential-store-file
+ '@hypit/credential-store-os':
+ specifier: workspace:*
+ version: link:../credential-store-os
+ '@hypit/runtime':
+ specifier: workspace:*
+ version: link:../runtime
+ '@hypit/runtime-kit':
+ specifier: workspace:*
+ version: link:../runtime-kit
+
packages/deck-track:
dependencies:
'@hypit/artifact':