SecureVault
Android actual for the top-level SecureVault factory.
Convenience overload — equivalent to SecureVault(VaultConfig(namespace, accessibility)).
Since
0.2.0
Builds a SecureVault for the given config.
Canonical entry point as of 0.2.0. The call site is identical on every supported platform — no Context, no factory, no two-step dance:
// commonMain — works on Android and iOS:
val vault = SecureVault(VaultConfig(namespace = "com.acme.auth"))Android initialisation
The Android backend needs an Application Context. By default that context is captured automatically by an androidx.startup Initializer registered in the library's AndroidManifest.xml, so most consumers do not need to do anything. If you have intentionally disabled the auto-initialisation hook, call SecureVault.initialize(context) once from Application.onCreate() before the first SecureVault(...) call.
Threading
Construction itself is cheap. The first interaction with the returned vault (e.g. keys(), get(...)) may block briefly while the platform derives or unwraps the master key — Android Keystore on first launch is typically the slowest. Issue one read on a background dispatcher during app start-up if you need to keep the UI thread free.
Multiple calls with the same VaultConfig.namespace return independent instances that address the same underlying storage.
Since
0.2.0
iOS actual for the top-level SecureVault factory. The Keychain is a process-wide singleton, so no platform handle is required.