@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
privatereadonly#apiUrl:string
Source
#axiosClient
privatereadonly#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
link()
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
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
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
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
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
Generated using typedoc-plugin-markdown and TypeDoc