Blockchain Drive uses a wallet-first authentication model. Instead of usernames and passwords, the server issues a one-time nonce that you sign with MetaMask (or any EIP-191-compatible wallet). The server recovers the signer address usingDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/ankit-bista/Final-Project/llms.txt
Use this file to discover all available pages before exploring further.
ethers.verifyMessage and opens a session if it matches. All subsequent requests are authenticated via a session cookie.
Request a nonce
Call
GET /auth/nonce?address=0x… with your wallet address. The server creates or updates your account and returns a human-readable message to sign.Sign with MetaMask
In the browser, call
ethereum.request({ method: 'personal_sign', params: [nonce, address] }) to produce a signature.Verify the signature
POST the address and signature to
POST /auth/verify. The server recovers the signer address, compares it, and sets a session cookie on success.GET /auth/nonce
Returns a one-time message for the wallet to sign. Calling this endpoint a second time with the same address invalidates the previous nonce.Request
Ethereum wallet address (checksummed or lowercase). Normalized to lowercase internally.
Response
A human-readable string containing a random 16-byte hex value. Pass this verbatim to
personal_sign.Errors
| Status | Condition |
|---|---|
400 | address query param is missing or not a string |
500 | Database error while reading or creating the user record |
POST /auth/verify
Verifies the wallet signature and opens an authenticated session. On success the server sets aconnect.sid session cookie.
Request body
The same Ethereum wallet address used to fetch the nonce.
The hex-encoded signature returned by
personal_sign.Response
Always
true on a successful verification.Internal database ID of the authenticated user.
The user’s chosen username, or
null if one has not been set yet.true when the user has never set a username. Redirect to the username setup screen before allowing other actions.Errors
| Status | Condition |
|---|---|
401 | Signature does not match the stored nonce, nonce was never generated, or user not found |
500 | Database error or session save failure |
If the wallet address matches the
MAIN_ADMIN_WALLET environment variable, the account is automatically promoted to the admin role on first sign-in.POST /auth/username
Sets or updates the display username for the authenticated user. Required before most drive operations whenneedsUsername is true.
Request body
3–20 characters. Only ASCII letters, digits, and underscores (
_) are allowed. Leading and trailing whitespace is stripped before validation.Response
Always
true on success.The trimmed, saved username.
Errors
| Status | Condition |
|---|---|
400 | Missing, wrong type, too short (< 3), too long (> 20), or contains invalid characters |
409 | Username is already taken by another account |
POST /auth/encryption-key
Stores the user’s MetaMask encryption public key. This key is returned to other users looking up a share target so they can encrypt file keys for end-to-end encrypted sharing.Request body
The base64-encoded public key exported from MetaMask via
eth_getEncryptionPublicKey. Leading and trailing whitespace is stripped.Response
Always
true on success.POST /auth/logout
Destroys the server-side session. The session cookie is invalidated immediately.Response
Always
true when the session was destroyed successfully.