示例#1
0
        public static void UpdateUser(string password)
        {
            ValidatePassword(password);

            var encryptionSalt = CrossSecureStorage.Current.GetValue(EncryptionSalt);
            var serializedUser = JsonConvert.SerializeObject(UserService.CurrentUser);
            var encryptedUser  = UserDataEncryption.Encrypt(serializedUser, password, encryptionSalt);

            CrossSecureStorage.Current.SetValue(CurrentUser, encryptedUser);
        }
示例#2
0
        public static void StoreUser(User user, string password)
        {
            if (!user.StoreSeed)
            {
                return;
            }

            var passwordHash   = UserDataEncryption.Hash(password);
            var encryptionSalt = Seed.Random().Value;

            CrossSecureStorage.Current.SetValue(PasswordHash, passwordHash);
            CrossSecureStorage.Current.SetValue(EncryptionSalt, encryptionSalt);

            var serializedUser = JsonConvert.SerializeObject(user);
            var encryptedUser  = UserDataEncryption.Encrypt(serializedUser, password, encryptionSalt);

            CrossSecureStorage.Current.SetValue(CurrentUser, encryptedUser);
        }