Files
routstrd/src/utils/config.ts
T
redshift 8d6a7d7f21 feat(cli): NIP-98 auth for remote daemon URLs
- Add nostr-tools dependency for NIP-98 event signing
- Add nsec field to RoutstrdConfig for remote daemon authentication
- Extract NIP-98 auth utilities into src/utils/nip98.ts (parseSecretKey,
  createNIP98Authorization with SHA-256 payload tags)
- Wire NIP-98 Authorization headers into callDaemon and isDaemonRunning
  whenever both daemonUrl and nsec are configured
- Refactor refund command to use callDaemon instead of hardcoded localhost
  so it works correctly with remote daemon URLs
2026-04-28 10:02:45 +05:30

25 lines
764 B
TypeScript

const HOME = process.env.HOME || process.env.USERPROFILE || "";
export const CONFIG_DIR = process.env.ROUTSTRD_DIR || `${HOME}/.routstrd`;
export const SOCKET_PATH = process.env.ROUTSTRD_SOCKET || `${CONFIG_DIR}/routstrd.sock`;
export const PID_FILE = process.env.ROUTSTRD_PID || `${CONFIG_DIR}/routstrd.pid`;
export const DB_PATH = `${CONFIG_DIR}/routstr.db`;
export const CONFIG_FILE = `${CONFIG_DIR}/config.json`;
export const LOGS_DIR = `${CONFIG_DIR}/logs`;
export interface RoutstrdConfig {
port: number;
provider: string | null;
cocodPath: string | null;
mode?: "xcashu" | "apikeys";
daemonUrl?: string;
nsec?: string;
}
export const DEFAULT_CONFIG: RoutstrdConfig = {
port: 8008,
provider: null,
cocodPath: null,
mode: "apikeys",
};