rememberSecureVault
Returns the lifecycle VaultState of a process-wide SecureVault for the given config.
The first call for a given VaultConfig.namespace starts a background pre-warm (Keystore handshake on Android, Keychain probe on iOS). Subsequent calls — from any composable, on any thread, at any point in the process — return the same host, so the warm-up cost is paid exactly once.
The returned State is collected from a kotlinx.coroutines.flow.StateFlow; it is safe to use inside LaunchedEffect, derivedStateOf, etc.
@Composable
fun AppRoot() {
val state by rememberSecureVault("com.acme.auth")
when (val s = state) {
VaultState.Initializing -> SplashScreen()
is VaultState.Failed -> ErrorScreen(s.reason)
is VaultState.Ready -> ProvideSecureVault(s.vault) { HomeScreen() }
}
}Content copied to clipboard
Since
0.1.0
fun rememberSecureVault(namespace: String, accessibility: <Error class: unknown class> = Accessibility.AfterFirstUnlock): State<VaultState>
Convenience overload — equivalent to rememberSecureVault(VaultConfig(namespace, accessibility)).
Since
0.1.0