Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
a216847
feat(settings): add custom section support
OffRange Nov 14, 2026
94ead3b
feat(settings): add top app bar
OffRange Nov 14, 2026
3ae22df
refactor(core-ui): move IconBadge
OffRange Nov 14, 2026
0555398
feat(settings): add account card
OffRange Nov 14, 2026
1abdafe
feat(account): add account page content
OffRange Nov 15, 2026
636849d
refactor(account): use account initials
OffRange Nov 15, 2026
1bab11f
refactor(settings): extract connect to server card
OffRange Nov 17, 2026
06ab4f5
feat(settings): add account ui events
OffRange Nov 17, 2026
a8ea4b1
refactor(account): move account UI
OffRange Nov 17, 2026
4d0e0c3
feat(account): wire up navigation
OffRange Nov 17, 2026
1825089
refactor(core-ui): move Wizard to :core:ui
OffRange Nov 17, 2026
7bd8884
refactor(account): add connect server step
OffRange Nov 18, 2026
00aa1b6
Merge remote-tracking branch 'origin/v2' into feat/android/account
OffRange Nov 18, 2026
c44a281
feat(core-sync): add TokenStore implementation
OffRange Nov 18, 2026
aeeaa7d
feat(core-security): support for different key types
OffRange Nov 19, 2026
6057e04
feat(core-security): add support for signing keys
OffRange Nov 19, 2026
9e7a453
feat(core-sync): add kotlin sync repository
OffRange Nov 19, 2026
3cc80aa
feat(rust): improve errors
OffRange Nov 19, 2026
c6153ac
refactor(core-ui): move SchemeStrippingTransformation
OffRange Nov 19, 2026
a7fbc60
refactor(rust): improve errors
OffRange Nov 19, 2026
a6a87f1
refactor(core-ui): improve SchemeStrippingTransformation
OffRange Nov 19, 2026
dc5ee69
feat(core-sync): classify network failures
OffRange Nov 19, 2026
ab95555
feat(feature-account): check the server while typing
OffRange Nov 19, 2026
a363c8a
feat(feature-account): add choose username UI
OffRange Nov 20, 2026
f1d3a22
feat(rust): expose username validation over uniffi
OffRange Nov 20, 2026
fc11d07
feat(rust): add username sanitizing and typed errors
OffRange Nov 20, 2026
0b454b9
feat(feature-account): validate the username on-device
OffRange Nov 20, 2026
1c83366
refactor(feature-account): cleanup connect server
OffRange Nov 20, 2026
256bdee
feat(feature-account): add confirm password step
OffRange Nov 21, 2026
0504007
refactor(core-identity): extract password verification
OffRange Nov 21, 2026
ce271c7
feat(feature-account): add password verification
OffRange Nov 21, 2026
d7712b9
feat(feature-account): make continue button's label dynamic
OffRange Nov 21, 2026
cdaa46b
feat(core-sync): implement register
OffRange Nov 21, 2026
4dbbfd7
feat(core-sync): add register usecase
OffRange Nov 21, 2026
50e154f
refactor(feature-account): register instead of only verifying the pas…
OffRange Nov 21, 2026
1388df2
feat(core-sync): add user-facing sync error messages
OffRange Nov 21, 2026
6160df1
refactor(feature-account): show server check failures with sync error…
OffRange Nov 21, 2026
11f8b04
feat(feature-account): route register rejections back to the field th…
OffRange Nov 21, 2026
3575416
fix(feature-account): keep server and username checks while the scree…
OffRange Nov 21, 2026
1c8f34b
feat(core-sync): store the server and account with the session
OffRange Nov 22, 2026
f8f1db8
feat(feature-account): add dynamic Account banner
OffRange Nov 22, 2026
75fc19e
refactor(feature-account): fold AccountState into ServerLink
OffRange Nov 22, 2026
001365e
feat(feature-account): add signed in state screen
OffRange Nov 22, 2026
3f4143b
feat(feature-account): wire up logout
OffRange Nov 22, 2026
aebcbe6
feat(feature-account): add device action
OffRange Nov 23, 2026
d3b38a1
refactor(feature-account): fold DevicesState into DeviceSummary
OffRange Nov 23, 2026
78c7246
feat(feature-account): implement device screen
OffRange Nov 24, 2026
e2444af
feat(feature-account): add pull to refresh
OffRange Nov 24, 2026
ec93f05
feat(feature-account): remove devices behind a step-up prompt
OffRange Nov 24, 2026
e42822b
fix(feature-account): clear the step-up password when the prompt ends
OffRange Nov 24, 2026
37badd1
refactor(core-sync): move the step-up dialog next to its gate
OffRange Nov 24, 2026
7c5719a
fix(core-rust): make FakeItemManager safe for concurrent use
OffRange Nov 24, 2026
0226a5b
feat(feature-account): add sign in/sign up chooser
OffRange Nov 25, 2026
a05ee66
feat(feature-account): wire up login
OffRange Nov 26, 2026
c14c9f2
fix(feature-account): keep the secure keyboard on password fields
OffRange Nov 26, 2026
178b921
fix(feature-account): drop a server's rejection once back on the addr…
OffRange Nov 27, 2026
27f1296
fix(core-ui): keep the wizard on its step when back is refused
OffRange Nov 27, 2026
b5fb07e
fix(core-sync): clear the step-up password from undo history
OffRange Nov 27, 2026
db88aa2
fix(core-sync): match the cached client by origin
OffRange Nov 27, 2026
0974e53
fix(keygo-client): log out another server's session on its own server
OffRange Nov 27, 2026
e459527
docs(core-security): say the DPoP key needs an unlocked device
OffRange Nov 27, 2026
0e1fc5c
fix(feature-account): refuse a server address with a path
OffRange Nov 27, 2026
7aefd22
fix(feature-account): keep the request guard when the session locks
OffRange Nov 27, 2026
f99f676
style(core-rust): drop the stray space in a BackupResult import
OffRange Nov 27, 2026
b903612
style: add missing trailing commas on parameter lists
OffRange Nov 27, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,8 @@ Password / Biometric

A scheduled backup runs with no user present, so it cannot reach the ARK the normal way. Scheduling
one therefore escrows a second copy of the ARK, and the export passphrase alongside it, under
Keystore aliases that deliberately do **not** require user authentication (`KeyId.BackupArkKey`,
`KeyId.BackupPassphraseKey`; see `BackupArkUnlocker`).
Keystore aliases that deliberately do **not** require user authentication (`CipherKeyId.BackupArkKey`,
`CipherKeyId.BackupPassphraseKey`; see `BackupArkUnlocker`).

This is the one place the "ARK is never readable without authenticating" rule is relaxed, so it
carries its own rules:
Expand Down
2 changes: 2 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ dependencies {
implementation(projects.core.item)
implementation(projects.core.identity)
implementation(projects.core.ui)
implementation(projects.core.sync)
implementation(projects.feature.auth)
implementation(projects.feature.listScreen)
implementation(projects.feature.credentials)
Expand All @@ -146,6 +147,7 @@ dependencies {
implementation(projects.feature.backup)
implementation(projects.feature.onboarding)
implementation(projects.feature.passwordHealth)
implementation(projects.feature.account)
implementation(projects.legacyMigration)

implementation(libs.androidx.core.splashscreen)
Expand Down
5 changes: 5 additions & 0 deletions app/src/debug/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<application android:networkSecurityConfig="@xml/network_security_config" />
</manifest>
10 changes: 10 additions & 0 deletions app/src/debug/res/xml/network_security_config.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?><!--
Debug builds only: lets a dev build reach a local keygo-server over plain HTTP
(e.g. http://localhost:8000 through `adb reverse`). Staging and release have no config, so
Android's default (cleartext forbidden) applies there. Never move this into src/main.
-->
<network-security-config xmlns:tools="http://schemas.android.com/tools">
<base-config
cleartextTrafficPermitted="true"
tools:ignore="InsecureBaseConfiguration" />
</network-security-config>
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,14 @@ import de.davis.keygo.app.presentation.navigation.keyGoEntryProvider
import de.davis.keygo.app.presentation.navigation.rememberAppNavigationState
import de.davis.keygo.app.presentation.navigation.resolveAppShell
import de.davis.keygo.core.presentation.model.RouteDestination
import de.davis.keygo.core.sync.domain.stepup.StepUpPrompter
import de.davis.keygo.core.ui.composition.LocalIsInSinglePaneMode
import de.davis.keygo.core.ui.navigation.KeyGoNavDisplay
import de.davis.keygo.core.ui.theme.KeyGoTheme
import de.davis.keygo.core.util.domain.snackbar.SnackbarManager
import de.davis.keygo.core.util.presentation.snackbar.LocalSnackbarManager
import de.davis.keygo.core.util.presentation.snackbar.SnackbarHandler
import de.davis.keygo.core.sync.presentation.stepup.StepUpDialogHost
import de.davis.keygo.feature.auth.presentation.AuthRoute
import de.davis.keygo.feature.onboarding.presentation.OnboardingRoute
import de.davis.keygo.feature.totp.presentation.TotpImportDeepLinkMatcher
Expand Down Expand Up @@ -118,6 +120,7 @@ private fun App(
val navigator = remember(navigationState) { AppNavigator(navigationState) }

LockAppWhenSessionEnds(isSessionActive, navigator)
AbandonStepUpWhenSessionEnds(isSessionActive)

LaunchedEffect(requestedTopLevelRoute) {
if (requestedTopLevelRoute == null) return@LaunchedEffect
Expand All @@ -143,6 +146,8 @@ private fun App(

val snackbarHostState = remember { SnackbarHostState() }
SnackbarHandler(snackbarHostState)
// Not over the lock screen.
if (isSessionActive) StepUpDialogHost()

CompositionLocalProvider(LocalIsInSinglePaneMode provides !listPaneVisible) {
KeyGoNavigationWrapper(
Expand Down Expand Up @@ -181,6 +186,15 @@ private fun LockAppWhenSessionEnds(isSessionActive: Boolean, navigator: AppNavig
}
}

/** Cancels a pending step-up when its session ends, so it doesn't run after the next unlock. */
@Composable
private fun AbandonStepUpWhenSessionEnds(isSessionActive: Boolean) {
val stepUpPrompter = koinInject<StepUpPrompter>()
LaunchedEffect(isSessionActive) {
if (!isSessionActive) stepUpPrompter.abandon()
}
}

/**
* Auto-selection is fine beside the list and wrong once the window narrows enough to hand the
* detail the whole screen. Only a change is acted on, so a detail restored after process death
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ import com.mikepenz.aboutlibraries.ui.compose.m3.LibrariesContainer
import de.davis.keygo.R
import de.davis.keygo.core.presentation.model.RouteDestination
import de.davis.keygo.dashboard.presentation.dashboardEntries
import de.davis.keygo.feature.account.presentation.AccountRoute
import de.davis.keygo.feature.account.presentation.ChangePasswordRoute
import de.davis.keygo.feature.account.presentation.ConnectServerRoute
import de.davis.keygo.feature.account.presentation.DevicesRoute
import de.davis.keygo.feature.account.presentation.accountEntries
import de.davis.keygo.feature.auth.presentation.AuthRoute
import de.davis.keygo.feature.auth.presentation.authEntries
import de.davis.keygo.feature.backup.presentation.BackupHubRoute
Expand All @@ -33,7 +38,6 @@ import de.davis.keygo.feature.onboarding.presentation.OnboardingRoute
import de.davis.keygo.feature.onboarding.presentation.onboardingEntries
import de.davis.keygo.feature.password_health.presentation.component.PasswordHealthDetailPlaceholder
import de.davis.keygo.feature.password_health.presentation.passwordHealthEntries
import de.davis.keygo.feature.settings.presentation.ChangePasswordRoute
import de.davis.keygo.feature.settings.presentation.settingsEntries
import de.davis.keygo.feature.totp.presentation.SelectItemForTotpRoute
import de.davis.keygo.feature.totp.presentation.selectItemForTotpEntries
Expand Down Expand Up @@ -98,10 +102,17 @@ fun keyGoEntryProvider(navigator: AppNavigator, hasAccess: Boolean): (NavKey) ->

settingsEntries(
metadata = NavigationOnly,
onOpenChangePassword = { navigator.navigate(ChangePasswordRoute) },
onShowLibraries = { navigator.navigate(RouteDestination.Libraries) },
onOpenBackup = { navigator.navigate(BackupHubRoute) },
onUp = { navigator.goBack() },
onOpenAccount = { navigator.navigate(AccountRoute) },
)

accountEntries(
metadata = WindowOwning,
onOpenChangePassword = { navigator.navigate(ChangePasswordRoute) },
onOpenConnectServer = { navigator.navigate(ConnectServerRoute) },
onOpenDevices = { navigator.navigate(DevicesRoute) },
navigateUp = { navigator.goBack() },
)

backupEntries(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import androidx.navigation3.runtime.NavKey
import de.davis.keygo.core.item.domain.alias.newItemId
import de.davis.keygo.core.item.generated.domain.model.VaultItemType
import de.davis.keygo.core.presentation.model.RouteDestination
import de.davis.keygo.feature.account.presentation.ChangePasswordRoute
import de.davis.keygo.feature.auth.presentation.AuthRoute
import de.davis.keygo.feature.onboarding.presentation.OnboardingRoute
import de.davis.keygo.feature.password_health.presentation.PasswordHealthRoute
import de.davis.keygo.feature.settings.presentation.ChangePasswordRoute
import de.davis.keygo.feature.settings.presentation.SettingsRoute
import de.davis.keygo.feature.totp.presentation.SelectItemForTotpRoute
import de.davis.keygo.feature.totp.presentation.TotpImportRedirect
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import de.davis.keygo.core.security.data.keyStoreManagerErrorFrom
import de.davis.keygo.core.security.domain.KeyStoreManager
import de.davis.keygo.core.security.domain.crypto.model.CryptographicData
import de.davis.keygo.core.security.domain.model.CryptographicMode
import de.davis.keygo.core.security.domain.model.KeyId
import de.davis.keygo.core.security.domain.model.CipherKeyId
import de.davis.keygo.core.security.domain.model.KeyStoreManagerError
import de.davis.keygo.core.util.Result
import de.davis.keygo.core.util.asResult
Expand Down Expand Up @@ -72,7 +72,7 @@ internal class BiometricCryptoImpl(
}

override suspend fun <T> requestWrap(
keyId: KeyId,
keyId: CipherKeyId,
policy: BiometricPolicy,
wrap: (seal: (key: ByteArray) -> CryptographicData) -> T,
): Result<T, BiometricAuthError> = request(
Expand All @@ -89,7 +89,7 @@ internal class BiometricCryptoImpl(
}

override suspend fun requestUnwrap(
keyId: KeyId,
keyId: CipherKeyId,
cryptographicData: CryptographicData,
policy: BiometricPolicy,
): Result<Key, BiometricAuthError> = request(
Expand All @@ -100,7 +100,7 @@ internal class BiometricCryptoImpl(
) { it.unwrap(cryptographicData.data, "AES", Cipher.SECRET_KEY) }

private suspend fun <T> request(
keyId: KeyId,
keyId: CipherKeyId,
policy: BiometricPolicy,
mode: CryptographicMode,
iv: ByteArray? = null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@ package de.davis.keygo.core.biometrics.domain
import de.davis.keygo.core.biometrics.domain.model.BiometricAuthError
import de.davis.keygo.core.biometrics.domain.model.BiometricPolicy
import de.davis.keygo.core.security.domain.crypto.model.CryptographicData
import de.davis.keygo.core.security.domain.model.KeyId
import de.davis.keygo.core.security.domain.model.CipherKeyId
import de.davis.keygo.core.util.Result
import java.security.Key

interface BiometricCrypto {

suspend fun <T> requestWrap(
keyId: KeyId,
keyId: CipherKeyId,
policy: BiometricPolicy = BiometricPolicy.Default,
wrap: (seal: (key: ByteArray) -> CryptographicData) -> T,
): Result<T, BiometricAuthError>

suspend fun requestUnwrap(
keyId: KeyId,
keyId: CipherKeyId,
cryptographicData: CryptographicData,
policy: BiometricPolicy = BiometricPolicy.Default,
): Result<Key, BiometricAuthError>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import de.davis.keygo.core.biometrics.FakeBiometricAvailabilityRepository
import de.davis.keygo.core.biometrics.domain.model.BiometricAuthError
import de.davis.keygo.core.security.crypto.FakeKeyStoreManager
import de.davis.keygo.core.security.domain.crypto.model.CryptographicData
import de.davis.keygo.core.security.domain.model.KeyId
import de.davis.keygo.core.security.domain.model.CipherKeyId
import de.davis.keygo.core.security.domain.model.KeyStoreManagerError
import de.davis.keygo.core.util.assertFailure
import kotlinx.coroutines.ExperimentalCoroutinesApi
Expand Down Expand Up @@ -40,11 +40,11 @@ class BiometricCryptoImplTest {
private fun resumedActivity() = Robolectric.buildActivity(FragmentActivity::class.java).setup()

private suspend fun unwrap() = crypto.requestUnwrap(
keyId = KeyId.BiometricVaultKek,
keyId = CipherKeyId.BiometricVaultKek,
cryptographicData = CryptographicData(data = ByteArray(48), iv = ByteArray(12)),
)

private suspend fun wrap() = crypto.requestWrap(keyId = KeyId.BiometricVaultKek) { seal ->
private suspend fun wrap() = crypto.requestWrap(keyId = CipherKeyId.BiometricVaultKek) { seal ->
seal(ByteArray(32) { 1 })
}

Expand Down Expand Up @@ -167,7 +167,7 @@ class BiometricCryptoImplTest {
var asked = false

val request = async {
crypto.requestWrap(keyId = KeyId.BiometricVaultKek) { seal ->
crypto.requestWrap(keyId = CipherKeyId.BiometricVaultKek) { seal ->
asked = true
seal(ByteArray(32))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import de.davis.keygo.core.security.crypto.FakeKeyStoreManager
import de.davis.keygo.core.security.domain.KeyStoreManager
import de.davis.keygo.core.security.domain.crypto.model.CryptographicData
import de.davis.keygo.core.security.domain.model.CryptographicMode
import de.davis.keygo.core.security.domain.model.KeyId
import de.davis.keygo.core.security.domain.model.CipherKeyId
import de.davis.keygo.core.security.domain.model.KeyStoreManagerError
import de.davis.keygo.core.util.Result
import kotlinx.coroutines.CompletableDeferred
Expand All @@ -21,7 +21,7 @@ class FakeBiometricCrypto(
) : BiometricCrypto {

data class Prompt(
val keyId: KeyId,
val keyId: CipherKeyId,
val mode: CryptographicMode,
val policy: BiometricPolicy,
)
Expand All @@ -35,7 +35,7 @@ class FakeBiometricCrypto(
val unwrapped: MutableList<ByteArray> = mutableListOf()

override suspend fun <T> requestWrap(
keyId: KeyId,
keyId: CipherKeyId,
policy: BiometricPolicy,
wrap: (seal: (key: ByteArray) -> CryptographicData) -> T,
): Result<T, BiometricAuthError> =
Expand All @@ -44,7 +44,7 @@ class FakeBiometricCrypto(
}

override suspend fun requestUnwrap(
keyId: KeyId,
keyId: CipherKeyId,
cryptographicData: CryptographicData,
policy: BiometricPolicy,
): Result<Key, BiometricAuthError> =
Expand All @@ -55,7 +55,7 @@ class FakeBiometricCrypto(
}

private suspend fun <T> prompt(
keyId: KeyId,
keyId: CipherKeyId,
mode: CryptographicMode,
policy: BiometricPolicy,
iv: ByteArray?,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package de.davis.keygo.core.identity.domain.model

sealed interface VerifyPasswordError {

data object ActiveAccountNotFound : VerifyPasswordError
data object IncorrectPassword : VerifyPasswordError
data object KeyDerivationFailed : VerifyPasswordError
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,24 @@ import de.davis.keygo.core.identity.domain.model.Account
import de.davis.keygo.core.identity.domain.model.ChangePasswordError
import de.davis.keygo.core.identity.domain.model.PasswordWrappedArk
import de.davis.keygo.core.identity.domain.model.Reauthentication
import de.davis.keygo.core.identity.domain.model.VerifyPasswordError
import de.davis.keygo.core.identity.domain.repository.AccountRepository
import de.davis.keygo.core.security.domain.Session
import de.davis.keygo.core.security.domain.SessionError
import de.davis.keygo.core.security.domain.crypto.model.CryptographicData
import de.davis.keygo.core.security.domain.model.KeyId
import de.davis.keygo.core.security.domain.model.CipherKeyId
import de.davis.keygo.core.util.Result
import de.davis.keygo.core.util.ResultBinding
import de.davis.keygo.core.util.asResult
import de.davis.keygo.core.util.resultBinding
import de.davisalessandro.keygo.rust.WrappedKeyBlob
import org.koin.core.annotation.Single

@Single
class ChangePasswordUseCase(
private val biometricCrypto: BiometricCrypto,
private val accountRepository: AccountRepository,
private val session: Session,
private val verifyPassword: VerifyPasswordUseCase,
) {

suspend operator fun invoke(
Expand All @@ -35,7 +36,7 @@ class ChangePasswordUseCase(
?: return Result.Failure(ChangePasswordError.ActiveAccountNotFound)

when (reauthentication) {
is Reauthentication.Password -> passwordAuthenticationPath(reauthentication, account)
is Reauthentication.Password -> passwordAuthenticationPath(reauthentication)
is Reauthentication.Biometric -> biometricAuthenticationPath(account)
}

Expand All @@ -60,21 +61,12 @@ class ChangePasswordUseCase(

private suspend fun ResultBinding<ChangePasswordError>.passwordAuthenticationPath(
reauthentication: Reauthentication.Password,
account: Account,
) {
session.verifyPassword(
password = reauthentication.currentPassword,
salt = account.passwordWrappedArk.salt,
wrapped = WrappedKeyBlob(
ciphertext = account.passwordWrappedArk.key,
nonce = account.passwordWrappedArk.keyIV,
),
userId = account.id,
).bind {
verifyPassword(reauthentication.currentPassword).bind {
when (it) {
is SessionError.Derivation -> ChangePasswordError.KeyDerivationFailed
SessionError.Locked -> ChangePasswordError.ActiveAccountNotFound
else -> ChangePasswordError.IncorrectPassword
VerifyPasswordError.ActiveAccountNotFound -> ChangePasswordError.ActiveAccountNotFound
VerifyPasswordError.IncorrectPassword -> ChangePasswordError.IncorrectPassword
VerifyPasswordError.KeyDerivationFailed -> ChangePasswordError.KeyDerivationFailed
}
}
}
Expand All @@ -90,7 +82,7 @@ class ChangePasswordUseCase(

try {
unwrappedArk = biometricCrypto.requestUnwrap(
keyId = KeyId.BiometricVaultKek,
keyId = CipherKeyId.BiometricVaultKek,
cryptographicData = CryptographicData(
data = wrappedKey.key,
iv = wrappedKey.keyIV
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package de.davis.keygo.core.identity.domain.usecase
import de.davis.keygo.core.identity.domain.model.BiometricEnrollmentError
import de.davis.keygo.core.identity.domain.repository.AccountRepository
import de.davis.keygo.core.security.domain.KeyStoreManager
import de.davis.keygo.core.security.domain.model.KeyId
import de.davis.keygo.core.security.domain.model.CipherKeyId
import de.davis.keygo.core.util.asResult
import de.davis.keygo.core.util.resultBinding
import org.koin.core.annotation.Single
Expand All @@ -22,6 +22,6 @@ class DisableBiometricsUseCase(
accountRepository.set(account.copy(biometricWrappedArk = null))
.bind { BiometricEnrollmentError.PersistenceFailed }

keyStoreManager.deleteKey(KeyId.BiometricVaultKek)
keyStoreManager.deleteKey(CipherKeyId.BiometricVaultKek)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import de.davis.keygo.core.identity.domain.model.BiometricEnrollmentError
import de.davis.keygo.core.identity.domain.repository.AccountRepository
import de.davis.keygo.core.security.domain.KeyStoreManager
import de.davis.keygo.core.security.domain.Session
import de.davis.keygo.core.security.domain.model.KeyId
import de.davis.keygo.core.security.domain.model.CipherKeyId
import de.davis.keygo.core.security.domain.useArk
import de.davis.keygo.core.util.asResult
import de.davis.keygo.core.util.resultBinding
Expand All @@ -28,10 +28,10 @@ class EnableBiometricsUseCase(

session.isActive.value.asResult(BiometricEnrollmentError.NoActiveSession).bind()

if (account.biometricWrappedArk == null) keyStoreManager.deleteKey(KeyId.BiometricVaultKek)
if (account.biometricWrappedArk == null) keyStoreManager.deleteKey(CipherKeyId.BiometricVaultKek)

val wrapped = biometricCrypto.requestWrap(
keyId = KeyId.BiometricVaultKek,
keyId = CipherKeyId.BiometricVaultKek,
policy = policy,
) { seal -> session.useArk(seal) }
.bind { BiometricEnrollmentError.BiometricFailed(it) }
Expand Down
Loading