From 6d23db4e3b450e3afbd5d20a7e86975e74c1b354 Mon Sep 17 00:00:00 2001 From: Samuel Newman Date: Tue, 4 Aug 2026 10:50:12 +0300 Subject: [PATCH] brand the persisted account did as DidString Co-Authored-By: Claude Fable 5 --- src/state/persisted/schema.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/state/persisted/schema.ts b/src/state/persisted/schema.ts index 9b86360765..e8310a113b 100644 --- a/src/state/persisted/schema.ts +++ b/src/state/persisted/schema.ts @@ -1,3 +1,4 @@ +import {type DidString} from '@atproto/syntax' import {z} from 'zod' import {deviceLanguageCodes, deviceLocales} from '#/locale/deviceLocales' @@ -13,7 +14,12 @@ const externalEmbedOptions = ['show', 'hide'] as const */ const accountSchema = z.object({ service: z.string(), - did: z.string(), + /* + * Branded at the type level only. The runtime check stays a bare `z.string()` + * so already-persisted accounts can never fail validation over the brand, + * which would log the user out on upgrade. + */ + did: z.string() as unknown as z.ZodType, handle: z.string(), email: z.string().optional(), emailConfirmed: z.boolean().optional(),