The best way to control Claude Code, Codex and more from any computer or phone
| 1 | import { sha256 } from "@noble/hashes/sha2"; |
| 2 | import * as Hex from "effect/encoding/Hex"; |
| 3 | |
| 4 | /** |
| 5 | * Hashes an identifier before it reaches analytics. Clients and the server both |
| 6 | * use it, so one Connect account gives the same owner id on every surface. |
| 7 | */ |
| 8 | export const hashTelemetryId = (value: string): string => |
| 9 | Hex.encode(sha256(new TextEncoder().encode(value))); |
| 10 | |
| 11 | /** True for a `hashTelemetryId` result. The server accepts only this shape from clients. */ |
| 12 | export const isTelemetryIdHash = (value: string): boolean => /^[0-9a-f]{64}$/u.test(value); |