Updated on 2026-08-14

This commit is contained in:
Tangem 2026-06-23 19:45:31 +04:00
parent c16e04089d
commit 7fdfe487b1
11 changed files with 683 additions and 29 deletions

View file

@ -128,8 +128,13 @@ internal class RetrofitApiBuilder @Inject constructor(
// feature toggle is OFF we skip installing the hooks entirely (avoids wiring up DPoP
// header generation and 401 retry logic on builds where auth isn't live yet).
if (condition && isBackendAuthEnabled.get()) {
addInterceptor(sessionAuthInterceptor.get())
authenticator(sessionAuthenticator.get())
// Resolve the providers lazily, at request time, instead of eagerly here. The session
// authenticator depends (via SessionTokenRefresher) back on AuthApi, so calling `.get()`
// while AuthApi is still being built would recurse into provideAuthApi → applySessionAuth
// → `.get()` → … and overflow the stack. Deferring `.get()` to the first HTTP call lets
// AuthApi finish constructing (and get cached) first, breaking the cycle.
addInterceptor(Interceptor { chain -> sessionAuthInterceptor.get().intercept(chain) })
authenticator { route, response -> sessionAuthenticator.get().authenticate(route, response) }
}
return this

View file

@ -117,6 +117,9 @@ object PreferencesKeys {
val IS_DEVICE_REGISTERED_KEY by lazy { booleanPreferencesKey(name = "isDeviceRegistered") }
/** Base64 `UserWalletId`s already registered with the Tangem Auth Service (`/auth/wallet`). */
val REGISTERED_WALLET_IDS_KEY by lazy { stringSetPreferencesKey(name = "registeredWalletIds") }
val WAS_LOG_FILE_CLEARED by lazy { booleanPreferencesKey(name = "wasLogFileCleared") }
val SEED_FIRST_NOTIFICATION_SHOW_TIME by lazy { longPreferencesKey("seedFirstNotificationTime") }