Example #1
0
        /// <summary>
        /// Gets the account for the specified key.
        /// </summary>
        /// <returns>The account with Item1 as username and Item2 as password.</returns>
        /// <param name="service">ISecureStorageService instance.</param>
        /// <param name="key">Key.</param>
        public static Tuple <string, string> GetAccount(this ISecureStorageService service, string key)
        {
            var record = service.Get(key);

            if (string.IsNullOrWhiteSpace(record))
            {
                return(null);
            }

            var account = record.Split(new char[] { ';' }, 2);

            if (int.TryParse(account[0], out int usernameLength))
            {
                var credentials = account.ElementAtOrDefault(1);

                if (string.IsNullOrWhiteSpace(credentials))
                {
                    return(null);
                }

                var username = credentials.Substring(0, usernameLength);
                var password = credentials.Substring(usernameLength, credentials.Length - usernameLength);

                return(new Tuple <string, string>(username, password));
            }

            return(null);
        }
 public AuthService(
     ISecureStorageService secureStorage,
     ITokenService tokenService,
     ISettings settings,
     IAppSettingsService appSettingsService,
     ICryptoService cryptoService,
     IConnectApiRepository connectApiRepository,
     IAccountsApiRepository accountsApiRepository,
     IAppIdService appIdService,
     IDeviceInfoService deviceInfoService,
     IDeviceApiRepository deviceApiRepository,
     IGoogleAnalyticsService googleAnalyticsService)
 {
     _secureStorage          = secureStorage;
     _tokenService           = tokenService;
     _settings               = settings;
     _appSettingsService     = appSettingsService;
     _cryptoService          = cryptoService;
     _connectApiRepository   = connectApiRepository;
     _accountsApiRepository  = accountsApiRepository;
     _appIdService           = appIdService;
     _deviceInfoService      = deviceInfoService;
     _deviceApiRepository    = deviceApiRepository;
     _googleAnalyticsService = googleAnalyticsService;
 }
 public TestPushNotificationsClientService(
     ISecureStorageService secureStorageService,
     IAnalyticsService analyticsService,
     IPushNotificationTapHandler pushNotificationTapHandler)
     : base(analyticsService, secureStorageService, pushNotificationTapHandler)
 {
 }
Example #4
0
 public CryptoService(
     ISecureStorageService secureStorage,
     IKeyDerivationService keyDerivationService)
 {
     _secureStorage        = secureStorage;
     _keyDerivationService = keyDerivationService;
 }
 public RegistrationService(IRepository <User> repositoryService,
                            ICryptoService cryptoService,
                            ISecureStorageService secureStorageService)
 {
     _repositoryService    = repositoryService;
     _cryptoService        = cryptoService;
     _secureStorageService = secureStorageService;
 }
Example #6
0
 public AccountService(
     IAccountApiService accountApiService,
     ISecureStorageService secureStorageService)
 {
     _accountApiService    = accountApiService;
     _secureStorageService = secureStorageService;
     Account = new Account();
 }
Example #7
0
 public AssetManagementService(
     IAssetUncompression assetUncompression,
     IDirectory directory,
     ISecureStorageService secureStorageService)
 {
     _assetUncompression   = assetUncompression;
     _directory            = directory;
     _secureStorageService = secureStorageService;
 }
 protected BasePushNotificationsClientService(
     IAnalyticsService analyticsService,
     ISecureStorageService secureStorageService,
     IPushNotificationTapHandler pushNotificationTapHandler)
 {
     AnalyticsService            = analyticsService;
     _secureStorageService       = secureStorageService;
     _pushNotificationTapHandler = pushNotificationTapHandler;
 }
Example #9
0
 public ExposureDataRepository(
     ISecureStorageService secureStorageService,
     IDateTimeUtility dateTimeUtility,
     ILoggerService loggerService
     )
 {
     _secureStorageService = secureStorageService;
     _dateTimeUtility      = dateTimeUtility;
     _loggerService        = loggerService;
 }
Example #10
0
        public ExposureNotificationService(ILoggerService loggerService, IHttpClientService httpClientService, ISecureStorageService secureStorageService, IPreferencesService preferencesService, IApplicationPropertyService applicationPropertyService)
        {
            this.loggerService              = loggerService;
            this.httpClientService          = httpClientService;
            this.secureStorageService       = secureStorageService;
            this.preferencesService         = preferencesService;
            this.applicationPropertyService = applicationPropertyService;

            _ = GetExposureNotificationConfig();
        }
 public UserService(
     IBricksetApiService bricksetApiService,
     IBricksetUserRepository bricksetUserRepository,
     ISecureStorageService secureStorageService,
     IUserSynchronizationService userSynchronizationService)
 {
     _bricksetApiService         = bricksetApiService;
     _bricksetUserRepository     = bricksetUserRepository;
     _secureStorageService       = secureStorageService;
     _userSynchronizationService = userSynchronizationService;
 }
 public OnboardingService(
     ISecureStorageService secureStorageService,
     IRegistrationService registrationService,
     IApiKeyService apiKeyService,
     IDeviceInformationService deviceInformationService)
 {
     _secureStorageService     = secureStorageService;
     _registrationService      = registrationService;
     _apiKeyService            = apiKeyService;
     _deviceInformationService = deviceInformationService;
 }
Example #13
0
 public AuthService(
     ISecureStorageService secureStorage,
     ISettings settings,
     ICryptoService cryptoService,
     IAuthApiRepository authApiRepository)
 {
     _secureStorage     = secureStorage;
     _settings          = settings;
     _cryptoService     = cryptoService;
     _authApiRepository = authApiRepository;
 }
 public RegisterViewModel(
     IAccountService accountService,
     IUserDialogs userDialogs,
     IMvxNavigationService navigationService,
     ISecureStorageService secureStorageService)
 {
     _accountService       = accountService;
     _userDialogs          = userDialogs;
     _navigationService    = navigationService;
     _secureStorageService = secureStorageService;
 }
        protected BasePushNotificationsClientService(
            IAnalyticsService analyticsService,
            ISecureStorageService secureStorageService,
            IPushNotificationTapHandler pushNotificationTapHandler)
        {
            AnalyticsService            = analyticsService;
            _secureStorageService       = secureStorageService;
            _pushNotificationTapHandler = pushNotificationTapHandler;

            NewNotificationEvent += HandleNewForegroundNotification;
        }
Example #16
0
 public Migrator_1_2_2(
     IApplicationPropertyService applicationPropertyService,
     IPreferencesService preferencesService,
     ISecureStorageService secureStorageService,
     ILoggerService loggerService
     )
 {
     _applicationPropertyService = applicationPropertyService;
     _preferencesService         = preferencesService;
     _secureStorageService       = secureStorageService;
     _loggerService = loggerService;
 }
Example #17
0
 public AuthService(
     ISecureStorageService secureStorage,
     ITokenService tokenService,
     ISettings settings,
     ICryptoService cryptoService,
     IConnectApiRepository connectApiRepository)
 {
     _secureStorage        = secureStorage;
     _tokenService         = tokenService;
     _settings             = settings;
     _cryptoService        = cryptoService;
     _connectApiRepository = connectApiRepository;
 }
 public UserSynchronizationService(
     IBricksetUserRepository bricksetUserRepository,
     IOnboardingService onboardingService,
     IUserSynchronizer userSynchronizer,
     ISecureStorageService secureStorageService,
     IMessageHub messageHub)
 {
     _bricksetUserRepository = bricksetUserRepository;
     _onboardingService      = onboardingService;
     _userSynchronizer       = userSynchronizer;
     _secureStorageService   = secureStorageService;
     _messageHub             = messageHub;
 }
        public LoginViewModel(
            IAccountService accountService,
            IMvxNavigationService navigationService,
            ISecureStorageService secureStorageService,
            IUserDialogs userDialogs)
        {
            _accountService    = accountService;
            _navigationService = navigationService;
            _userDialogs       = userDialogs;

            //TODO ta bort sen
            UserName = "******";
            Password = "******";
        }
        public AndroidKeyStoreStorageService(ISettings settings)
        {
            _oldAndroid = Build.VERSION.SdkInt < BuildVersionCodes.M;
            _rsaMode    = _oldAndroid ? "RSA/ECB/PKCS1Padding" : "RSA/ECB/OAEPWithSHA-1AndMGF1Padding";

            _oldKeyStorageService = new KeyStoreStorageService(new char[] { });
            _settings             = settings;

            _keyStore = KeyStore.GetInstance(AndroidKeyStore);
            _keyStore.Load(null);

            GenerateStoreKey();
            GenerateAesKey();
        }
Example #21
0
 public MigrationService(
     IMigrationProcessService platformMigrationProcessService,
     IApplicationPropertyService applicationPropertyService,
     IPreferencesService preferencesService,
     ISecureStorageService secureStorageService,
     IEssentialsService essentialsService,
     ILoggerService loggerService
     )
 {
     _platformMigrationProcessService = platformMigrationProcessService;
     _applicationPropertyService      = applicationPropertyService;
     _preferencesService   = preferencesService;
     _secureStorageService = secureStorageService;
     _essentialsService    = essentialsService;
     _loggerService        = loggerService;
 }
        public ShoppingCartViewModel(INavigationService navigationService,
                                     IShoppingCartService shoppingCartService,
                                     IPageDialogService pageDialogService,
                                     IAuthenticationService authenticationService,
                                     ISecureStorageService secureStorageService,
                                     ICryptoService cryptoService)
            : base(navigationService)
        {
            _shoppingCartService   = shoppingCartService;
            _pageDialogService     = pageDialogService;
            _authenticationService = authenticationService;
            _secureStorageService  = secureStorageService;
            _cryptoService         = cryptoService;
            Title = UiText.SHOPPING_CART_PAGE_MAIN_TITLE;
            var _dogs = shoppingCartService.ShoppingCartDogList;

            DogList    = new ObservableCollection <Dog>(_dogs);
            TotalPrice = _shoppingCartService.TotalPrice;
        }
Example #23
0
        public InitialViewModel(ISecureStorageService secureStorageService)
        {
            _secureStorageService = secureStorageService;

            WeekCalendarTest           = new Week();
            WeekCalendarTest.Sunday    = new Day(true);
            WeekCalendarTest.Monday    = new Day(false);
            WeekCalendarTest.Tuesday   = new Day(true);
            WeekCalendarTest.Wednesday = new Day(true);
            WeekCalendarTest.Thursday  = new Day(false);
            WeekCalendarTest.Friday    = new Day();
            WeekCalendarTest.Saturday  = new Day();

            YearCalendarTest = new List <Week>();
            YearCalendarTest.Add(WeekCalendarTest);
            for (int i = 0; i < 52; ++i)
            {
                YearCalendarTest.Add(WeekCalendarTest);
            }
        }
Example #24
0
        public BaseViewModel(
            INavigationService navigationService,
            IContext context,
            IDialogService userDialog,
            IMessageService messageService,
            ISecureStorageService secureStorageService)
        {
            this.NavigationService = navigationService;
            this.Context           = context;
            this.DialogService     = userDialog;
            this.MessageService    = messageService;

            if (DeviceInfo.Platform == DevicePlatform.Unknown)
            {
                return;
            }

            this.IsNotInternet = Connectivity.NetworkAccess != NetworkAccess.Internet;

            Connectivity.ConnectivityChanged += Connectivity_ConnectivityChanged;
        }
Example #25
0
        public HttpDataService(ILoggerService loggerService, IHttpClientService httpClientService, ISecureStorageService secureStorageService, IApplicationPropertyService applicationPropertyService)
        {
            this.loggerService              = loggerService;
            this.secureStorageService       = secureStorageService;
            this.applicationPropertyService = applicationPropertyService;

            // Create API key based client.
            apiClient             = httpClientService.Create();
            apiClient.BaseAddress = new Uri(AppSettings.Instance.ApiUrlBase);
            apiClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
            apiClient.DefaultRequestHeaders.Add("x-functions-key", AppSettings.Instance.ApiSecret);
            apiClient.DefaultRequestHeaders.Add("x-api-key", AppSettings.Instance.ApiKey);

            // Create client.
            httpClient             = httpClientService.Create();
            httpClient.BaseAddress = new Uri(AppSettings.Instance.ApiUrlBase);
            httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
            httpClient.DefaultRequestHeaders.Add("x-functions-key", AppSettings.Instance.ApiSecret);

            // Create download client.
            downloadClient = httpClientService.Create();
        }
Example #26
0
 private void StartSettings()
 {
     secureStorageService = ViewModelLocator.Current.Resolve <ISecureStorageService>();
     liteDbService        = ViewModelLocator.Current.Resolve <ILiteDbService>();
     navigationService    = ViewModelLocator.Current.Resolve <INavigationService>();
 }
Example #27
0
        /// <summary>
        /// Set the specified key and username/password pair.
        /// </summary>
        /// <param name="service">ISecureStorageService instance.</param>
        /// <param name="key">Key.</param>
        /// <param name="username">Username.</param>
        /// <param name="password">Password.</param>
        /// <param name="requireBiometricAuth">If set to <c>true</c> require biometric auth.</param>
        public static void SetAccount(this ISecureStorageService service, string key, string username, string password, bool requireBiometricAuth = false)
        {
            var account = $"{username.Length};{username}{password}";

            service.Set(key, account, requireBiometricAuth);
        }
Example #28
0
 public AccountApiService(ISecureStorageService secureStorageService) : base(secureStorageService)
 {
 }
Example #29
0
 public FactService(IRestService restService, ISecureStorageService secureStorageService, IBackgroundService backgroundService)
 {
     _restService          = restService;
     _secureStorageService = secureStorageService;
     _backgroundService    = backgroundService;
 }
Example #30
0
 public TokenService(ISecureStorageService secureStorage)
 {
     _secureStorage = secureStorage;
 }