diff options
author | dan <dan.abramov@gmail.com> | 2024-05-10 00:05:44 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-09 16:05:44 -0700 |
commit | 6e172b6ce359e88b0be3648c9ca92841fd90740d (patch) | |
tree | f930f9be823a5989a2450d4f87ddddbd68ec2458 | |
parent | 55fdbc7399c601a8867ae2517165a16083cef000 (diff) | |
download | voidsky-6e172b6ce359e88b0be3648c9ca92841fd90740d.tar.zst |
[Session] Restore emailAuthFactor and emailConfirmed from last session (#3939)
-rw-r--r-- | src/state/session/agent.ts | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/state/session/agent.ts b/src/state/session/agent.ts index 9dacf543e..024f6e7d1 100644 --- a/src/state/session/agent.ts +++ b/src/state/session/agent.ts @@ -1,5 +1,4 @@ -import {BskyAgent} from '@atproto/api' -import {AtpSessionEvent} from '@atproto-labs/api' +import {AtpSessionData, AtpSessionEvent, BskyAgent} from '@atproto/api' import {networkRetry} from '#/lib/async/retry' import {PUBLIC_BSKY_SERVICE} from '#/lib/constants' @@ -32,11 +31,15 @@ export async function createAgentAndResume( } const gates = tryFetchGates(storedAccount.did, 'prefer-low-latency') const moderation = configureModerationForAccount(agent, storedAccount) - const prevSession = { + const prevSession: AtpSessionData = { + // Sorted in the same property order as when returned by BskyAgent (alphabetical). accessJwt: storedAccount.accessJwt ?? '', - refreshJwt: storedAccount.refreshJwt ?? '', did: storedAccount.did, + email: storedAccount.email, + emailAuthFactor: storedAccount.emailAuthFactor, + emailConfirmed: storedAccount.emailConfirmed, handle: storedAccount.handle, + refreshJwt: storedAccount.refreshJwt ?? '', } if (isSessionExpired(storedAccount)) { await networkRetry(1, () => agent.resumeSession(prevSession)) |