@lesto/identity
v0.1.7
Published
Lesto's batteries-included auth: users on the SQL DB, register/verify/login/reset flows composed from @lesto/auth + @lesto/db + @lesto/migrate + @lesto/mail + @lesto/csrf.
Downloads
338
Readme
@lesto/identity
Batteries-included auth — register / verify / login / reset on your SQL database.
Part of Lesto, the batteries-included, agent-native fullstack framework.
bun add @lesto/identityimport { createIdentity } from "@lesto/identity";
const identity = createIdentity({
db,
secret: env.LESTO_AUTH_SECRET,
mailer: { sendVerificationEmail, sendPasswordResetEmail },
verificationUrl: (token) => `https://app.com/verify?token=${token}`,
resetUrl: (token) => `https://app.com/reset?token=${token}`,
});
await identity.register("[email protected]", "correct horse battery staple");
await identity.verifyEmail(tokenFromLink);
const { session } = identity.login("[email protected]", "correct horse battery staple");Composes @lesto/auth (scrypt hashing, store-backed sessions, signed tokens),
@lesto/db + @lesto/migrate (the users schema), and @lesto/csrf. Mail is
injected as an interface, so the package stays decoupled from any one transport.
