Based on the awesome work of SimpleWebAuthn
This client library can be used to authenticate users and encrypt data locally via the largeBlob extension of webauthn.
git clone https://github.com/lmarschall/wembat.git
cd ./backend
# create .env from .env.template
docker compose up -d --build && docker compose logs -f
npm install @wembat/client
import { WembatClient } from "@wembat/client";
const wembatClient = new WembatClient("http://localhost:8080");
The following function must be triggered by a user interaction, like a button click for example.
async function register() {
const registerResponse = await wembatClient.register(uId);
if (registerResponse.success) {
const verified = registerResponse.result;
}
}
The following function must be triggered by a user interaction, like a button click for example.
async function login() {
const loginResponse = await wembatClient.login(uId);
if (loginResponse.success) {
const loginResult = loginResponse.result;
if (loginResult.verified) {
const token = loginResult.jwt;
}
}
}