connect

To interact with the user's account in Rabet, you must first connect to it.

For connecting to the user account, you must send a connection request to the user. If the user confirms, you will receive the user account public key; otherwise, you will receive a rejected error.

rabet.connect();
if (!window.rabet) {
console.error('Rabet is not installed');
return;
}
rabet.connect()
.then(result => console.log(`User active public key is: ${result.publicKey}`))
.catch(error => console.error(`Error: ${error}`));

Example of the message that the user will receive when calling the connect function:

This verification process is done only once, and when the user connects to your website, you will immediately receive the user's account public key.

Try to put a connect button for the user to call the connect function and until the answer to one request is not specified, don't call another connect request.

If the user has disabled the extension privacy mode option, there is no need to confirm the user and you will receive the account public key immediately after the call connect function.