Skip to content
create-bsv-app
3 / 9

Log in with a proof

Logging in means proving to the server that you hold the identity key. Your wallet signs a one-time proof for the action login; the server checks the signature and learns who you are.

The client side is already done: App.tsx calls login() from the generated useWalletLogin() hook. It fetches the server's identity, asks the wallet for a proof, and posts it to POST /api/login.

Your task#

Try Log in in the preview first. It fails with login failed: 404, and the Server panel shows why: there's no route.

Then, in server/src/index.ts, import loginRoute from ./bsv/loginRoute.js and mount it:

ts
app.post('/api/login', loginRoute(serverWallet))

Log in again. Watch the Wallet panel: one createSignature call. That's the whole login.

Your task

  • Log in successfully