{"record":{"id":"078f4c0f8423e1f1","repo":"JuliusBrussee/caveman","slug":"runtimepolicy-publickey-must-be-a-base64-encoded-3","errorCode":null,"errorMessage":"runtimePolicy publicKey must be a base64-encoded 32-byte Ed25519 key","messagePattern":"runtimePolicy publicKey must be a base64-encoded 32-byte Ed25519 key","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/sdk/typescript/src/index.ts","lineNumber":1082,"sourceCode":" * failure. `decide()` is synchronous, local-only, and never throws — with no\n * bundle it returns the caller's baseline. Mirrors the Python\n * `RuntimePolicyClient`.\n */\nexport class RuntimePolicyClient {\n  private bundle: Record<string, unknown> | null = null;\n  private signedBundle = false;\n  private pinnedKey: Uint8Array | null = null;\n  private killedLocally = false;\n  private timer: ReturnType<typeof setInterval> | null = null;\n  /** True while a `refresh()` is in flight; the background timer skips rather than pile on. */\n  private refreshing = false;\n  private readonly killEnv: string;\n\n  constructor(private cave: Cave, options: RuntimePolicyOptions = {}) {\n    this.killEnv = options.killEnv ?? \"CAVEMAN_POLICY_KILL\";\n    if (options.publicKey !== undefined) {\n      const pin = base64Bytes(options.publicKey);\n      if (pin === null || pin.length !== 32) throw new Error(\"runtimePolicy publicKey must be a base64-encoded 32-byte Ed25519 key\");\n      this.pinnedKey = pin;\n    }\n    const seconds = options.autoRefreshSeconds;\n    if (typeof seconds === \"number\" && Number.isFinite(seconds) && seconds > 0) {\n      const timer = setInterval(() => {\n        // A slow or hung endpoint must not queue refreshes behind each other:\n        // one tick while a refresh is already in flight is skipped, not stacked.\n        if (this.refreshing) return;\n        void this.refresh();\n      }, seconds * 1000);\n      (timer as unknown as { unref?: () => void }).unref?.();\n      this.timer = timer;\n    }\n  }\n\n  /**\n   * Fetch and verify the current bundle (`GET /sdk/v1/runtime-policy`).\n   *","sourceCodeStart":1064,"sourceCodeEnd":1100,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/27d5a3981a347890211bb1bf2439e5c821a63bc9/packages/sdk/typescript/src/index.ts#L1064-L1100","documentation":"Error \"runtimePolicy publicKey must be a base64-encoded 32-byte Ed25519 key\" thrown in JuliusBrussee/caveman.","triggerScenarios":"Thrown at packages/sdk/typescript/src/index.ts:1082 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set runtimePolicy.publicKey to a base64-encoded 32-byte Ed25519 public key."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"27d5a3981a347890211bb1bf2439e5c821a63bc9","analyzedAt":"2026-08-15T09:26:11.751Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}