Skip to content

lmarschall/wembat

Repository files navigation

Wembat

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.

Start Wembat Backend

git clone https://github.com/lmarschall/wembat.git

cd ./backend

# create .env from .env.template

docker compose up -d --build && docker compose logs -f

Install Wembat Client

npm install @wembat/client

Create Wembat Client

import { WembatClient } from "@wembat/client";

const wembatClient = new WembatClient("http://localhost:8080");

Register User

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;
  }
}

Login User

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;
    }
  }
}

About

Wembat library enables developers to authenticate users and encrypt data via the largeBlob extension of WebAuthn.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published