import { useWallet } from '@hermis/solana-headless-react';
function SignInButton() {
const { signIn } = useWallet();
const handleSignIn = async () => {
try {
const { account, signedMessage, signature } = await signIn({
domain: window.location.host,
statement: 'Sign in to MyDApp',
uri: window.location.origin,
});
// Verify signature on your backend using:
// - account.address (user's public key)
// - signedMessage (the message that was signed)
// - signature (the cryptographic signature)
// Then create a session token or JWT
console.log('Signed in:', account.address);
} catch (error) {
console.error('Sign in failed:', error);
}
};
return <button onClick={handleSignIn}>Sign In</button>;
}