Map<String, dynamic> toJson() { return { 'state': state.value, if (totpProviderConfig != null) 'totpProviderConfig': totpProviderConfig!.toJson(), }; }