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.
TypeScript agentic-aiaiai-agentsai-videocompilerdslffmpeggenerative-aillmmarkup-languagemonorepoplugin-systemprogramming-languagetext-to-videotypescriptvideovideo-automationvideo-clonevideo-editingvideo-generation
fix(credentials): make platform storage policy explicit
kashorin7d132d940f68
diff --git a/packages/credential-store-file/README.md b/packages/credential-store-file/README.mdindex 245daddb..adfdd8a7 100644--- a/packages/credential-store-file/README.md+++ b/packages/credential-store-file/README.md@@ -4,8 +4,8 @@ A writable CredentialStore for a deployment that explicitly chooses local file sLinux without an OS credential locker. It stores unencrypted credential values in an owner-privatedirectory 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, `@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+or Windows Credential Locker, `@hypit/credential-store-platform` for OS storage on macOS/Windows+and this file Store on Linux or `@hypit/credential-store-env` for externallysupplied, read-only values.## Select it before logindiff --git a/packages/credential-store-os/README.md b/packages/credential-store-os/README.mdindex e99d4acc..4f0ff7e4 100644--- a/packages/credential-store-os/README.md+++ b/packages/credential-store-os/README.md@@ -12,6 +12,6 @@ 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.+A Profile that must also run on Linux can select `@hypit/credential-store-platform`:+that package uses this Store on macOS and Windows, and an unencrypted, owner-private file on Linux.+Selecting `@hypit/credential-store-os` directly continues to require macOS or Windows.diff --git a/packages/credential-store-platform/README.md b/packages/credential-store-platform/README.mdindex 9b4475f0..5b123bbb 100644--- a/packages/credential-store-platform/README.md+++ b/packages/credential-store-platform/README.md@@ -1,10 +1,13 @@# `@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.+An explicitly selected CredentialStore policy: macOS Keychain on macOS, Windows Credential Locker+on Windows, and an unencrypted, owner-private file on Linux. Other platforms are unsupported by this+package and report an error. Linux may offer other credential services; this package chooses file+storage there and does not detect or integrate those services.++A Profile can select this package to use that policy on Linux, macOS and Windows.+`@hypit/credential-store-os`, `@hypit/credential-store-file` and `@hypit/credential-store-env`+remain selectable directly for a deployment with a different storage choice.## Select it@@ -36,14 +39,14 @@ hypit auth logout hypihub.default --runtime <profile>## What it does not doThe 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+chain: a miss or failure in one store never tries another, and no credential is migrated between them. Acredential 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+- `path` selects the directory for Linux file storage, 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.+ so on Linux, 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@@ -52,7 +55,7 @@ On macOS and Windows the credential is held by the platform locker, with exactly`@hypit/credential-store-os`: it is encrypted and access-controlled by the operating system, and itis not readable from another machine.-Everywhere else the credential is held by an owner-private document with exactly the rules of+On Linux 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`, filemode `0600`, outside the video project, and never enumerated or indexed. Filesystem path-lengthlimits apply to an overlong key, which fails rather than selecting another name. A damaged documentdiff --git a/packages/credential-store-platform/src/activation.ts b/packages/credential-store-platform/src/activation.tsindex e434766f..e97bcfa3 100644--- a/packages/credential-store-platform/src/activation.ts+++ b/packages/credential-store-platform/src/activation.ts@@ -21,8 +21,8 @@ const platformCredentialStoreAdapter = createRuntimeCredentialStoreAdapterFacet(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.+ // Linux uses the same directory the file Store uses by default, so a Profile+ // that switches between them on Linux finds the credential it stored.directory: path === undefined? join(context.hostStateRoot, "credentials"): resolve(context.hostStateRoot, path),diff --git a/packages/credential-store-platform/src/store.ts b/packages/credential-store-platform/src/store.tsindex 3963b216..7d5b9b7d 100644--- a/packages/credential-store-platform/src/store.ts+++ b/packages/credential-store-platform/src/store.ts@@ -15,11 +15,8 @@ import type {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. */+ /** Directory holding the documents this Store selects on Linux. */readonly directory: string;/** Service the locker's entries are filed under; the OS Store's own default applies where absent. */readonly service?: string;@@ -37,26 +34,26 @@ export type PlatformCredentialStoreOptions = {};/**- * 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.+ * An explicitly selected storage policy: OS credentials on macOS/Windows, files on Linux.+ * The selected backend's errors propagate; other platforms are unsupported by this package.*/export class PlatformCredentialStore implements WritableCredentialStore {readonly #delegate: WritableCredentialStore;readonly #backing: "os" | "file";constructor(options: PlatformCredentialStoreOptions) {- if (LOCKER_PLATFORMS.includes(options.platform ?? process.platform)) {+ const platform = options.platform ?? process.platform;+ if (platform === "darwin" || platform === "win32") {this.#backing = "os";this.#delegate = new OsCredentialStore({...(options.service === undefined ? {} : { service: options.service }),...options.locker,});- } else {+ } else if (platform === "linux") {this.#backing = "file";this.#delegate = new FileCredentialStore(options.directory);+ } else {+ throw new Error(`Platform CredentialStore does not support ${platform}; select an explicit CredentialStore supported by this host`);}}diff --git a/packages/credential-store-platform/test/store.test.ts b/packages/credential-store-platform/test/store.test.tsindex 60d8cb20..a856021d 100644--- a/packages/credential-store-platform/test/store.test.ts+++ b/packages/credential-store-platform/test/store.test.ts@@ -23,7 +23,7 @@ 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 () => {+test("macOS stores credentials in its locker and never creates a file", async () => {const root = await scratch("hypit-platform-credentials-");try {const directory = join(root, "credentials");@@ -36,7 +36,7 @@ test("a platform with a locker stores there and never creates a file", async ()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");+ assert.deepEqual(await readdir(root), [], "file storage stays untouched by the OS policy");} finally { await rm(root, { recursive: true, force: true }); }});@@ -49,11 +49,11 @@ test("Windows selects the locker as well", async () => {});await store.put(credentialRef("platform", "hypihub.oauth"), { secret: "locker-secret" });assert.equal(locker.entries.get("hypihub.oauth"), "locker-secret");- assert.deepEqual(await readdir(root), [], "the file fallback stays untouched where a locker exists");+ assert.deepEqual(await readdir(root), [], "file storage stays untouched by the OS policy");} 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 () => {+test("Linux stores owner-private documents in the file Store's directory", async () => {const root = await scratch("hypit-platform-credentials-");try {const directory = join(root, "credentials");@@ -98,3 +98,31 @@ test("only this Store owns the name platform, and it owns no other name", asyncassert.equal(new OsCredentialStore(memoryLocker()).owns(ref), false);} finally { await rm(root, { recursive: true, force: true }); }});+++test("unsupported platforms fail before creating credential files", async () => {+ const root = await scratch("hypit-platform-credentials-");+ try {+ assert.throws(() => new PlatformCredentialStore({+ directory: join(root, "credentials"), platform: "freebsd",+ }), /Platform CredentialStore does not support freebsd/u);+ assert.deepEqual(await readdir(root), []);+ } finally { await rm(root, { recursive: true, force: true }); }+});++test("locker failures propagate without switching to file storage", async () => {+ const root = await scratch("hypit-platform-credentials-");+ try {+ const failure = new Error("locker unavailable");+ const fail = async () => { throw failure; };+ const store = new PlatformCredentialStore({+ directory: join(root, "credentials"), platform: "darwin",+ locker: { read: fail, write: fail, remove: fail },+ });+ const ref = credentialRef("platform", "hypihub.oauth");+ await assert.rejects(store.resolve(ref), (error) => error === failure);+ await assert.rejects(store.put(ref, { secret: "not-written" }), (error) => error === failure);+ await assert.rejects(store.delete(ref), (error) => error === failure);+ assert.deepEqual(await readdir(root), []);+ } 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.tsindex 291a0193..6de6bdfe 100644--- a/packages/video-cli/test/platform-credentials.test.ts+++ b/packages/video-cli/test/platform-credentials.test.ts@@ -11,14 +11,14 @@ 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.+ * The examples select the `platform` Store so one committed Profile works on Linux, macOS and Windows.+ * On macOS and Windows it would use the real keychain or Credential Locker of whoever runs the+ * suite, so this test covers Linux and skips other platforms.*/-const hasLocker = process.platform === "darwin" || process.platform === "win32";+const isLinux = process.platform === "linux";-test("the interview example authenticates on a host with no OS locker, without editing its Profile",- { skip: hasLocker, timeout: 120_000 }, async (t) => {+test("the interview example authenticates on Linux, without editing its Profile",+ { skip: !isLinux, 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");@@ -33,14 +33,14 @@ test("the interview example authenticates on a host with no OS locker, without econst 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");+ assert.equal(before.writable, true, "the Linux policy 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.+ // Linux uses the file Store's own directory, so switching Stores there finds it.assert.equal((await readdir(join(state, "credentials"))).length, 1);await auth("logout");