Skip to content

feat(auth): pass and log wallet name on every login #3849

@davidleomay

Description

@davidleomay

Background

PR #3846 fixed login mail branding by reading dto.wallet from the auth request. This works correctly for wallet-signature login (POST /v1/auth) since the RealUnit app already sends wallet: 'RealUnit'.

Two gaps remain:

1. Email login doesn't send the wallet
For POST /v1/auth/mail, frontends currently don't send wallet. Without it, loginWallet falls back to walletService.getDefault() (DFX), so the login mail branding may be wrong for non-DFX frontends that support email login.

2. Wallet context at login time is never persisted
In doSignIn() and signInByMail(), the wallet from dto.wallet is never stored anywhere for existing users. This is valuable information — knowing which app a user logged in from — and should be logged per login event.

Proposed Solution

Log wallet name in IpLog

IpLog is already the per-login audit trail (IP, country, walletType, linked user/userData). Add a walletName column and populate it from the login request in IpLogService.create().

Call sites in auth.service.ts (doSignIn, signInByMail, completeSignInByMail) should pass dto.wallet through to ipLogService.create().

Frontends

All frontends must send wallet in every auth request where the wallet name is known:

  • POST /v1/auth (wallet-signature login) — RealUnit already does this; other frontends should be verified
  • POST /v1/auth/mail (email login) — needs to be added in frontends that support email login

The wallet field already exists on AuthMailDto and SignInDto/SignUpDto as optional, so this is non-breaking.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions