From dc9741d8ba5efeadb1b64e40344243973ea425df Mon Sep 17 00:00:00 2001 From: Samuel Newman Date: Mon, 3 Aug 2026 13:29:19 +0300 Subject: [PATCH] add the chat proxy service constant Co-Authored-By: Claude Fable 5 --- src/lib/constants.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/lib/constants.ts b/src/lib/constants.ts index bc079c7af5..1a89fa5b5e 100644 --- a/src/lib/constants.ts +++ b/src/lib/constants.ts @@ -1,5 +1,6 @@ import {type Insets, Platform} from 'react-native' import {type AppBskyActorDefs, BSKY_LABELER_DID} from '@atproto/api' +import {type Service} from '@atproto/lex' import {type ProxyHeaderValue} from '#/state/session/agent' import {BLUESKY_PROXY_DID, CHAT_PROXY_DID, IS_DEV} from '#/env' @@ -247,6 +248,21 @@ export const BLUESKY_PROXY_HEADER = { }, } +/** + * The chat service's proxy target, in the `did#service_id` form a lex client's + * `service` option takes. A client constructed with it emits `atproto-proxy: + * ` on every request, which is what routes `chat.bsky.*` calls to + * the chat service. + * + * The DID comes from the env-configurable `CHAT_PROXY_DID` (via + * `EXPO_PUBLIC_CHAT_PROXY_DID`) rather than a hard-coded constant, so the + * target can be retargeted per environment. + * + * This is the client-level equivalent of {@link DM_SERVICE_HEADERS}, which + * carries the same value as a per-call header. + */ +export const CHAT_PROXY_SERVICE: Service = `${CHAT_PROXY_DID}#bsky_chat` + export const DM_SERVICE_HEADERS = { 'atproto-proxy': `${CHAT_PROXY_DID}#bsky_chat`, }