Skip to content

@wembat/client / WembatClient

Class: WembatClient ​

Represents a client for interacting with the Wembat API.

Constructors ​

new WembatClient(applicationToken) ​

new WembatClient(applicationToken): WembatClient

Creates an instance of WembatClient.

Parameters ​

• applicationToken: string

Returns ​

WembatClient

Source ​

index.ts:29

Properties ​

#apiUrl ​

private readonly #apiUrl: string

Source ​

index.ts:19


#axiosClient ​

private readonly #axiosClient: AxiosInstance

Source ​

index.ts:20


#jwt ​

private #jwt: undefined | string

Source ​

index.ts:21


#privateKey ​

private #privateKey: undefined | CryptoKey

Source ​

index.ts:23


#publicKey ​

private #publicKey: undefined | CryptoKey

Source ​

index.ts:22

Methods ​

decrypt() ​

decrypt(wembatMessage, publicKey): Promise<WembatActionResponse<WembatMessage>>

Decrypts a Wembat message using the provided public key.

Parameters ​

• wembatMessage: WembatMessage

The Wembat message to decrypt.

• publicKey: CryptoKey

The public key used for decryption.

Returns ​

Promise<WembatActionResponse<WembatMessage>>

A promise that resolves to a WembatActionResponse containing the decrypted Wembat message.

Source ​

index.ts:73


encrypt() ​

encrypt(wembatMessage, publicKey): Promise<WembatActionResponse<WembatMessage>>

Encrypts a Wembat message using the provided public key.

Parameters ​

• wembatMessage: WembatMessage

The Wembat message to encrypt.

• publicKey: CryptoKey

The public key to use for encryption.

Returns ​

Promise<WembatActionResponse<WembatMessage>>

A promise that resolves to a WembatActionResponse containing the encrypted Wembat message.

Source ​

index.ts:62


getCryptoPublicKey() ​

getCryptoPublicKey(): undefined | CryptoKey

Retrieves the crypto public key.

Returns ​

undefined | CryptoKey

The crypto public key.

Source ​

index.ts:130


link(): Promise<WembatActionResponse<WembatRegisterResult>>

Links the new user device to the active wembat session.

Returns ​

Promise<WembatActionResponse<WembatRegisterResult>>

A promise that resolves to a WembatActionResponse containing the link result.

Source ​

index.ts:114


login() ​

login(userMail, autoLogin): Promise<WembatActionResponse<WembatLoginResult>>

Logs in the user with the specified email address.

Parameters ​

• userMail: string

The email address of the user.

• autoLogin: boolean= false

Returns ​

Promise<WembatActionResponse<WembatLoginResult>>

A promise that resolves to a WembatActionResponse containing the login result.

Source ​

index.ts:92


onboard() ​

onboard(): Promise<WembatActionResponse<WembatRegisterResult>>

Onboards the new user device linked to the active wembat session.

Returns ​

Promise<WembatActionResponse<WembatRegisterResult>>

A promise that resolves to a WembatActionResponse containing the onboard result.

Source ​

index.ts:106


register() ​

register(userMail, autoRegister): Promise<WembatActionResponse<WembatRegisterResult>>

Registers a user device with the provided email address.

Parameters ​

• userMail: string

The email address of the user to register.

• autoRegister: boolean= false

Returns ​

Promise<WembatActionResponse<WembatRegisterResult>>

A Promise that resolves to a WembatActionResponse containing the registration result.

Source ​

index.ts:83


token() ​

token(): Promise<WembatActionResponse<WembatToken>>

Retrieves the token for the current session.

Returns ​

Promise<WembatActionResponse<WembatToken>>

A promise that resolves to a WembatActionResponse containing the token.

Source ​

index.ts:122


Generated using typedoc-plugin-markdown and TypeDoc