( obj: Record<string, unknown> | undefined, )
| 51 | const STRIPPED_KEYS = new Set(["cloud.public_api_key", "cloud.publicApiKey"]); |
| 52 | |
| 53 | function stripCloudKeys( |
| 54 | obj: Record<string, unknown> | undefined, |
| 55 | ): Record<string, unknown> { |
| 56 | if (!obj) return {}; |
| 57 | const out: Record<string, unknown> = {}; |
| 58 | for (const [k, v] of Object.entries(obj)) { |
| 59 | if (!STRIPPED_KEYS.has(k)) out[k] = v; |
| 60 | } |
| 61 | return out; |
| 62 | } |
| 63 | |
| 64 | // Pull telemetry_id out of a CopilotKit license token without verifying |
| 65 | // the signature. The token shape is a standard JWT |