public bool ValidateVaultPassword(long vaultId, string password) { if (password == null) { throw new Exception("Nie podano hasła głównego"); } var vault = (from v in PmContext.Vaults where v.Id == vaultId && v.Username == UserResolverService.GetUsername() select new { v.Id, v.MasterPassword, v.MasterSalt } ).First(); return(CryptoService.ValidateHash(password, vault.MasterPassword, vault.MasterSalt)); }
public VaultService(PasswordManagerContext pmContext, UserResolverService userResolverService, ICryptoService cryptoService) { PmContext = pmContext; UserResolverService = userResolverService; CryptoService = cryptoService; }