Skip to content

Latest commit

 

History

History
119 lines (81 loc) · 2 KB

ReadMe.md

File metadata and controls

119 lines (81 loc) · 2 KB

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