Manage user sessions

By default, AlchemyWebSigner user sessions are cached in localStorage for 15 minutes.

You can customize session length by passing a sessionConfig to your AlchemyWebSigner constructor.

You can check if the user has an active session with the following command:

1import { signer } from "./signer";
2
3// NOTE: this method throws if there is no authenticated user
4// so we return null in the case of an error
5const user = await signer.getAuthDetails().catch(() => null);

If there is an existing session, then your signer is ready for use! If not, see the section above for logging users in.