public string GetCurrentUserLogin() { if (CurrentUser.IsTemporary()) { return(CurrentUser.Login); } var currentUserLogin = GetDefault("CurrentUserLogin"); try { return(WindowsCipherManager.Decrypt( currentUserLogin, "CurrentUserLogin")); } catch (CryptographicException) { SetCurrentUserLogin( currentUserLogin); return(WindowsCipherManager.Decrypt( GetDefault("CurrentUserLogin"), "CurrentUserLogin")); } catch (FormatException) { SetCurrentUserLogin( currentUserLogin); return(WindowsCipherManager.Decrypt( GetDefault("CurrentUserLogin"), "CurrentUserLogin")); } }
public string GetTenorAPIKey() { var tenorApiKey = GetDefault("TenorAPIKey"); if (string.IsNullOrEmpty(tenorApiKey)) { return("TKAGGYAX27OJ"); } try { return(WindowsCipherManager.Decrypt( tenorApiKey, "TenorAPIKey")); } catch (CryptographicException) { SetTenorAPIKey( tenorApiKey); return(WindowsCipherManager.Decrypt( GetDefault("TenorAPIKey"), "TenorAPIKey")); } catch (FormatException) { SetTenorAPIKey( tenorApiKey); return(WindowsCipherManager.Decrypt( GetDefault("TenorAPIKey"), "TenorAPIKey")); } }
public string GetUserRocketPassword(string login) { if (CurrentUser.Login == login && CurrentUser.IsTemporary()) { return(CurrentUser.RocketPassword); } return(WindowsCipherManager.Decrypt( Get(login, "UserRocketPassword"), $"UserRocketPassword-{login}")); }
public string GetUserToken(string login) { if (CurrentUser.Login == login && CurrentUser.IsTemporary()) { return(CurrentUser.Token); } return(WindowsCipherManager.Decrypt( Get(login, "UserToken"), $"UserToken-{login}")); }
public int GetUserId(string login) { if (CurrentUser.Login == login && CurrentUser.IsTemporary()) { return(CurrentUser.Id); } var userId = WindowsCipherManager.Decrypt( Get(login, "UserId"), $"UserId-{login}"); return(!string.IsNullOrEmpty(userId) ? userId.ToInt() : -1); }