import { isDid, isRecordKey, type Did, type RecordKey } from "@atcute/lexicons/syntax"; // asserting wrappers over atcute's syntax guards for xrpc input boundaries. // untrusted strings (user input, route params, storage) get rejected here // instead of traveling to the server and failing as a 400. export const didOf = (value: string): Did => { if (!isDid(value)) throw new Error(`invalid did: ${value}`); return value; }; export const recordKeyOf = (value: string): RecordKey => { if (!isRecordKey(value)) throw new Error(`invalid rkey: ${value}`); return value; };