Blisache-client
blisache-client is a wasm artifact exposing the API as simple javascript functions to be called. It can be imported in your project like this :
import * as blisache from "blisache-client";
Here are the prototypes of the exposed functions :
function register(login: string, name: string): Promise<any>;
register() initiates a new registration to the API, prompts the authenticator for a new key, and registers the created key to the API. Thats mean we create a new account or new user.
function authenticate(login?: string | null): Promise<any>;
authenticate() initiates a new authentication to the API, prompts the authenticator for an already registered key and authenticates the user to the API.
function credential_list(login?: string | null): Promise<any>;
credential_list() authenticates the user with authenticate() and retreives the credentials registered to the API for that user.
function credential_add(login: string, name: string): Promise<any>;
credential_add() authenticates the user with authenticate() and registers a new key for that user using register().
function credential_revoke(login?: string | null, credential_id: bigint): Promise<any>;
credential_revoke() authenticates the user with authenticate() and unregisters the user’s target credential.
The login is the account name. It is often set as the email address of the user. It is sent to the API and anonymised for storage.
The name is the name of the user. It is stored in the authenticator and used as display name. It is not sent to the API.
login and name are mandatory in registration-related endpoints.
In authentication-related endpoints login is optional. If login present, a server-side credential search is performed. When login is absent, a discoverable resident key (passkey) is selected for the ceremony with possible user prompt.
Each of these functions returns a SignedResponse. This is a data object containing a message and its associated signature. The message is the json response from the API serialized as a bytes array. The signature is the signature of the message signed from Blisache servers also serialized as a bytes array. A SignedResponse wraps success and error responses from the API and should be sent to your backend for further processing.