Identity Vault is not supported in the browser for a number of reasons, the primary among them being that the browser does not have a secure location for storing data like actual mobile devices do. You might encounter this the first time you attempt to run your application in browser after adding identity vault, and you see a big error
cordova is not defined. Ideally, we'd like to continue development using our browser tools to maintain the speed of web development. To accomplish this, Identity Vault provides a special
BrowserVault class that can be used.
BrowserVault is a special class that implements all the same methods as the standard vault, however, most methods that would require native interaction, such as Biometrics, are merely stubbed out and do nothing. This
BrowserVault stores all data using localstorage.
The BrowserVault does not provide secure data storage in the browser! It uses localstorage and emulates the behavior of Identity Vault to provide compatibility.
The Browser Vault should be used conditionally based on platform your application is running on. The examples below use Capacitor as the native bridge, however the same is possible with Cordova.
All vault methods should exhibit the same behavior, allowing your application to run as expected regardless of the platform you are running on.