[SDK] Validate and brand the persisted account did (#11387)

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Samuel Newman
2026-08-13 22:26:22 +03:00
committed by GitHub
parent 9fe0084874
commit 3677c98873
46 changed files with 154 additions and 205 deletions
+5 -5
View File
@@ -39,11 +39,7 @@ export function Provider({children}: React.PropsWithChildren<{}>) {
return undefined
}
return {
/*
* `did`/`hiddenPosts` come from persisted storage typed as plain
* `string`, so brand them to the SDK's `DidString`/`AtUriString` slots.
*/
userDid: userDid as ModerationOpts['userDid'],
userDid,
prefs: {
...moderationPrefs,
labelers: moderationPrefs.labelers.length
@@ -52,6 +48,10 @@ export function Provider({children}: React.PropsWithChildren<{}>) {
did,
labels: DEFAULT_LOGGED_OUT_LABEL_PREFERENCES,
})),
/*
* `hiddenPosts` comes from persisted storage typed as plain `string`,
* so brand it to the SDK's `AtUriString` slot.
*/
hiddenPosts: (hiddenPosts ||
[]) as ModerationOpts['prefs']['hiddenPosts'],
},