useSessionKeyClient
This hook initializes and returns a session key client using the provided API key, session data, and private key.
Returns:
Usage Example:
import { useSessionKeyClient } from "path/to/hook";
const Component = () => {
const { data: sessionKeyClient, error, isPending, isSuccess, isError } =
useSessionKeyClient({
apiKey: "YOUR_API_KEY",
sessionData: ...,
privateKey: ...,
});
if (isPending) return <p>Initializing session client...</p>;
if (isError) return <p>Error: {error?.message}</p>;
return (
<div>
{isSuccess && <p>Session Key Client Initialized!</p>}
{/* Example usage */}
<button
onClick={() => {
if (sessionKeyClient) {
// Call methods on the session key client
console.log("Session Key Client:", sessionKeyClient);
}
}}
>
Use Session Key Client
</button>
</div>
);
};How It Works:
Error Handling:
Customization:
Last updated