signIn method

Future<AuthResponse> signIn(
  1. String email,
  2. String password
)

Inicia sesión y persiste el JWT en el almacenamiento seguro.

Lanza una excepción si las credenciales son inválidas.

Implementation

Future<AuthResponse> signIn(String email, String password) async {
  try {
    final response = await _authRepository.login(email, password);
    // Solo guardamos el token: el rol y demás claims ya van dentro del JWT
    await _storage.write(key: _keyToken, value: response.token);
    return response;
  } catch (e) {
    rethrow;
  }
}