about summary refs log tree commit diff
path: root/src/state/persisted/schema.ts
diff options
context:
space:
mode:
authorEric Bailey <git@esb.lol>2023-12-05 19:59:34 -0600
committerGitHub <noreply@github.com>2023-12-05 19:59:34 -0600
commit3c8036587e28d8fc90e87e4818e3f4e080fbd091 (patch)
tree4ead93f29432f91afd9c7abcac1caa790e303092 /src/state/persisted/schema.ts
parenta915a57b10e9e8a62d769d4de359a916dcf4ceab (diff)
downloadvoidsky-3c8036587e28d8fc90e87e4818e3f4e080fbd091.tar.zst
Improvements to persisted state migration (#2098)
* Fix session email/emailConfirmed types, update usage for safer access

* Handle fallback better, better errors

* Better handling, add test

* Add test for default data

* Remove fallback, not needed, update logs
Diffstat (limited to 'src/state/persisted/schema.ts')
-rw-r--r--src/state/persisted/schema.ts7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/state/persisted/schema.ts b/src/state/persisted/schema.ts
index 71f9bd545..5ed8e01f3 100644
--- a/src/state/persisted/schema.ts
+++ b/src/state/persisted/schema.ts
@@ -2,17 +2,14 @@ import {z} from 'zod'
 import {deviceLocales} from '#/platform/detection'
 
 // only data needed for rendering account page
-// TODO agent.resumeSession requires the following fields
 const accountSchema = z.object({
   service: z.string(),
   did: z.string(),
   handle: z.string(),
-  email: z.string(),
-  emailConfirmed: z.boolean(),
+  email: z.string().optional(),
+  emailConfirmed: z.boolean().optional(),
   refreshJwt: z.string().optional(), // optional because it can expire
   accessJwt: z.string().optional(), // optional because it can expire
-  // displayName: z.string().optional(),
-  // aviUrl: z.string().optional(),
 })
 export type PersistedAccount = z.infer<typeof accountSchema>