openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
3 lines • 977 B
JavaScript
import{i as normalizeIdentityKey,t as DeviceIdentityStorageError}from"./device-identity-material-CkS6RKfU.mjs";import{t as resolveClientCredentialStorePath}from"./client-credential-paths-D__QHGyH.mjs";import path from"node:path";
//!src/infra/device-identity-store-options.ts
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))}}export{resolveDeviceIdentityStore as n,resolveDeviceIdentityEnvironment as t};