public async Task <EmailVerification> GetEmailVerificationObjAsync(string code) { return(await Task.Factory.StartNew(() => { var encryptedText = CryptoGraphy.ConvertBase64UrlToObject <string>(code); return JsonConvert.DeserializeObject <EmailVerification>(encryptedText); })); }
/// <summary> /// Hashes the password. /// </summary> /// <param name="password">The password.</param> /// <returns> /// String Value /// </returns> public async Task <string> GetHashPassword(string password) { return(await Task.Factory.StartNew(() => { if (password == null) { throw new ArgumentNullException(nameof(password)); } return CryptoGraphy.HashPasswordInternal(password); })); }
public async Task <string> GetEmailVerificationCodeAsync(IApplicationUser applicationUser) { return(await Task.Factory.StartNew(() => { return CryptoGraphy.EncryptObject( new EmailVerification { UserId = applicationUser.UserId.ToString(), Email = applicationUser.Email, SecurityStamp = applicationUser.SecurityStamp, ExpiryHour = DateTime.UtcNow }); })); }
public async Task <string> GetEmailVerificationCodeAsync(IApplicationUser applicationUser) { return(await Task.Factory.StartNew(() => { var jsonObj = JsonConvert.SerializeObject(new EmailVerification { UserId = applicationUser.UserId.ToString(), Email = applicationUser.Email, ExpiryHour = DateTime.UtcNow.AddHours(24) }); return CryptoGraphy.ConvertToBase64Url(jsonObj); })); }
/// <summary> /// Verifies the hashed password. /// </summary> /// <param name="hashedPassword">The hashed password.</param> /// <param name="password">The password.</param> /// <returns> /// String Value /// </returns> public async Task <bool> VerifyHashedPassword(string hashedPassword, string password) { return(await Task.Factory.StartNew(() => { if (hashedPassword == null) { throw new ArgumentNullException(nameof(hashedPassword)); } if (password == null) { throw new ArgumentNullException(nameof(password)); } return CryptoGraphy.VerifyHashedPasswordInternal(hashedPassword, password); })); }