Using the useJustAuth Hook

Overview

The useJustAuth hook provides access to all authentication-related functionality in your component.

How to Use

  1. Import the hook:

    import { useJustAuth } from 'just-tron-auth';
  2. Destructure the necessary values and functions:

    const {
       isAuthenticated,
       userEmail,
       userAddress,
       openAuthModal,
       logout,
       signMessage,
       signTransaction,
       exportPrivateKey
    } = useJustAuth();

Returned Values

  • isAuthenticated (boolean): Indicates if the user is logged in.

  • userEmail (string): The email of the authenticated user.

  • userAddress (string): The address of the authenticated user.

  • openAuthModal (function): Function to open the authentication modal.

  • logout (function): Function to log out the user.

  • signMessage (function): Function to sign a message.

  • signTransaction (function): Function to sign a Tron transaction.

  • exportPrivateKey (function): Function to export the user’s private key.

Last updated