@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
Source
Properties
#apiUrl
private
readonly
#apiUrl:string
Source
#axiosClient
private
readonly
#axiosClient:AxiosInstance
Source
#jwt
private
#jwt:undefined
|string
Source
#privateKey
private
#privateKey:undefined
|CryptoKey
Source
#publicKey
private
#publicKey:undefined
|CryptoKey
Source
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
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
getCryptoPublicKey()
getCryptoPublicKey():
undefined
|CryptoKey
Retrieves the crypto public key.
Returns
undefined
| CryptoKey
The crypto public key.
Source
login()
login(
userMail
):Promise
<WembatActionResponse
<WembatLoginResult
>>
Logs in the user with the specified email address.
Parameters
• userMail: string
The email address of the user.
Returns
Promise
<WembatActionResponse
<WembatLoginResult
>>
A promise that resolves to a WembatActionResponse containing the login result.
Source
onboard()
onboard():
Promise
<WembatActionResponse
<WembatRegisterResult
>>
Returns
Promise
<WembatActionResponse
<WembatRegisterResult
>>
Source
register()
register(
userMail
):Promise
<WembatActionResponse
<WembatRegisterResult
>>
Registers a user with the provided email address.
Parameters
• userMail: string
The email address of the user to register.
Returns
Promise
<WembatActionResponse
<WembatRegisterResult
>>
A Promise that resolves to a WembatActionResponse containing the registration result.
Source
token()
token():
Promise
<WembatActionResponse
<WembatToken
>>
Returns
Promise
<WembatActionResponse
<WembatToken
>>
Source
Generated using typedoc-plugin-markdown and TypeDoc