UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

23 lines (22 loc) • 1.18 kB
import { i as normalizeIdentityKey, t as DeviceIdentityStorageError } from "./device-identity-material-BGzHHiUD.mjs"; import { t as resolveClientCredentialStorePath } from "./client-credential-paths-CIYPaDgB.mjs"; import path from "node:path"; //#region src/infra/device-identity-store-options.ts /** Resolve once before awaiting work so another caller's environment cannot change the root. */ function resolveDeviceIdentityStore(e = {}) { const t = path.resolve(e.path ?? resolveClientCredentialStorePath(e.env ?? process.env)); if (path.basename(t) !== "credentials.sqlite" || path.basename(path.dirname(t)) !== "client") throw new DeviceIdentityStorageError("Device identity path must be <client-root>/client/credentials.sqlite; pass env.OPENCLAW_STATE_DIR to select the client root."); return { databasePath: t, identityKey: normalizeIdentityKey(e.identityKey) }; } function resolveDeviceIdentityEnvironment(e) { const { databasePath: t } = resolveDeviceIdentityStore(e); return { ...e.env ?? process.env, OPENCLAW_STATE_DIR: path.dirname(path.dirname(t)) }; } //#endregion export { resolveDeviceIdentityStore as n, resolveDeviceIdentityEnvironment as t };