useSessionKeySigner
This hook returns a session key signer based on the provided session data and private key. The signer is used to interact with smart sessions and execute permissioned actions.
Returns:
Usage Example:
import { useSessionKeySigner } from "path/to/hook";
const Component = () => {
const { data: sessionKeySigner, error, isPending, isSuccess, isError } =
useSessionKeySigner({
sessionData: { permissionIds: [...], action: "...", sessions: [...] },
privateKey: "0xYOUR_PRIVATE_KEY",
});
if (isPending) return <p>Initializing session key signer...</p>;
if (isError) return <p>Error: {error?.message}</p>;
return (
<div>
{isSuccess && <p>Session Key Signer Initialized!</p>}
<button
onClick={() => {
if (sessionKeySigner) {
// Example usage: signing an operation
console.log("Session Key Signer:", sessionKeySigner);
}
}}
>
Use Session Key Signer
</button>
</div>
);
};How It Works:
Error Handling:
Customization:
Last updated