using Microsoft.AspNetCore.Identity;
using OmsorgCore.Application.Abstractions;

namespace OmsorgCore.Infrastructure.Security;

/// <summary>
/// Nutzt den bewährten ASP.NET Core Identity Password-Hasher (PBKDF2) statt eigener Krypto-Logik.
/// </summary>
public class PasswordHasher : IPasswordHasher
{
    private readonly PasswordHasher<object> _inner = new();

    public string Hash(string plainPassword)
        => _inner.HashPassword(new object(), plainPassword);

    public bool Verify(string plainPassword, string hash)
        => _inner.VerifyHashedPassword(new object(), hash, plainPassword) != PasswordVerificationResult.Failed;
}
