Skip to content

Commit

Permalink
updated 'local-data-lock' dependency, which now uses/exports a separa…
Browse files Browse the repository at this point in the history
…te check for 'user verification'
  • Loading branch information
getify committed Dec 18, 2024
1 parent 7383a8e commit 2461263
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 7 deletions.
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,12 +151,14 @@ The [**@lo-fi/local-vault** npm package](https://npmjs.com/package/@lo-fi/local-

## `WebAuthn` Supported?

To check if `WebAuthn` API and functionality is supported on the device, consult the `supportsWebAuthn` exported boolean:
To check if `WebAuthn` API and functionality is supported on the device, consult the `supportsWebAuthn` exported boolean.

Additionally, **Local Vault** (via **Local Data Lock** dependency) requires the authenticator to support ["user verification"](https://developer.mozilla.org/en-US/docs/Web/API/PublicKeyCredential/isUserVerifyingPlatformAuthenticatorAvailable_static). Thus, a separate exported boolean called `supportsWAUserVerification` should also be checked:

```js
import { supportsWebAuthn } from "..";
import { supportsWebAuthn, supportsWAUserVerification } from "..";

if (supportsWebAuthn) {
if (supportsWebAuthn && supportsWAUserVerification) {
// welcome to the future, without passwords!
}
else {
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@lo-fi/local-vault",
"description": "Store key-value data encrypted (biometric passkey protected), locally in the client",
"version": "0.16.1",
"version": "0.17.0",
"exports": {
".": "./dist/bundlers/lv.mjs",
"./adapter/idb": "./dist/bundlers/adapter.idb.mjs",
Expand Down Expand Up @@ -34,7 +34,7 @@
},
"dependencies": {
"@byojs/storage": "~0.11.1",
"@lo-fi/local-data-lock": "~0.14.3"
"@lo-fi/local-data-lock": "~0.15.1"
},
"devDependencies": {
"micromatch": "~4.0.5",
Expand Down
3 changes: 3 additions & 0 deletions src/lv.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {
supportsWebAuthn,
supportsWAUserVerification,
toBase64String,
fromBase64String,
getLockKey,
Expand All @@ -25,6 +26,7 @@ var vaultEntryCache = new WeakMap();
export {
// re-export Local-Data-Lock members:
supportsWebAuthn,
supportsWAUserVerification,
listLocalIdentities,
removeLocalAccount,
toBase64String,
Expand All @@ -40,6 +42,7 @@ export {
var publicAPI = {
// re-export Local-Data-Lock members:
supportsWebAuthn,
supportsWAUserVerification,
listLocalIdentities,
removeLocalAccount,
toBase64String,
Expand Down
8 changes: 6 additions & 2 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import "local-vault/src/adapter/opfs";
import "local-vault/src/adapter/opfs-worker";
import {
supportsWebAuthn,
supportsWAUserVerification,
rawStorage,
connect,
removeAll,
Expand Down Expand Up @@ -953,8 +954,11 @@ function sortKeys(vals) {
}

async function checkWebAuthnSupport() {
if (!supportsWebAuthn) {
showError("Sorry, but this device doesn't seem to support the proper passkey functionality.");
if (!(
supportsWebAuthn &&
supportsWAUserVerification
)) {
showError("Sorry, but this device doesn't seem to support the proper passkey functionality (including user-verification).");
return false;
}
}

0 comments on commit 2461263

Please sign in to comment.