diff --git a/src/HaveIBeenPwned.Client.Abstractions/Models/PwnedPassword.cs b/src/HaveIBeenPwned.Client.Abstractions/Models/PwnedPassword.cs
index 95b9582..6eafbec 100644
--- a/src/HaveIBeenPwned.Client.Abstractions/Models/PwnedPassword.cs
+++ b/src/HaveIBeenPwned.Client.Abstractions/Models/PwnedPassword.cs
@@ -3,13 +3,36 @@
namespace HaveIBeenPwned.Client.Abstractions;
-///
-public record PwnedPassword(
- string? PlainTextPassword,
- bool? IsPwned = default,
- long PwnedCount = -1,
- string? HashedPassword = default)
+///
+/// An object used to represent the plain-text password, and corresponding
+/// hashed password. As well as whether the password is considered "pwned",
+/// and if so, how many times.
+///
+public record class PwnedPassword
{
+ ///
+ /// The plain text password used for the lookup.
+ ///
+ public string? PlainTextPassword { get; set; }
+
+ ///
+ /// Whether or not the current
+ /// instance is considered to be "pwned".
+ ///
+ public bool? IsPwned { get; set; }
+
+ ///
+ /// When is true, this will be a non-zero number.
+ /// It represents the number of times the given
+ /// has been found in the "have i been pwned" passwords database.
+ ///
+ public long PwnedCount { get; set; }
+
+ ///
+ /// The hashed representation of the given .
+ ///
+ public string? HashedPassword { get; set; }
+
internal bool IsInvalid() =>
PlainTextPassword is null or { Length: 0 };
}
diff --git a/src/HaveIBeenPwned.Client/DefaultPwnedClient.Passwords.cs b/src/HaveIBeenPwned.Client/DefaultPwnedClient.Passwords.cs
index 03b3a47..20c6c02 100644
--- a/src/HaveIBeenPwned.Client/DefaultPwnedClient.Passwords.cs
+++ b/src/HaveIBeenPwned.Client/DefaultPwnedClient.Passwords.cs
@@ -14,7 +14,11 @@ async Task IPwnedPasswordsClient.GetPwnedPasswordAsync(string pla
"The plainTextPassword cannot be either null, or empty.", nameof(plainTextPassword));
}
- var pwnedPassword = new PwnedPassword(plainTextPassword);
+ var pwnedPassword = new PwnedPassword()
+ {
+ PlainTextPassword = plainTextPassword
+ };
+
if (pwnedPassword.IsInvalid())
{
return pwnedPassword;
diff --git a/tests/HaveIBeenPwned.Client.AbstractionsTests/Models/PwnedPasswordTests.cs b/tests/HaveIBeenPwned.Client.AbstractionsTests/Models/PwnedPasswordTests.cs
index 2a83e05..48f6cf5 100644
--- a/tests/HaveIBeenPwned.Client.AbstractionsTests/Models/PwnedPasswordTests.cs
+++ b/tests/HaveIBeenPwned.Client.AbstractionsTests/Models/PwnedPasswordTests.cs
@@ -18,7 +18,7 @@ public class PwnedPasswordTests
public void PwnedPassword_Returns_CorrectValidityState_WhenConstructed(
string value, bool expected)
{
- PwnedPassword pwnedPassword = new(value);
+ PwnedPassword pwnedPassword = new() { PlainTextPassword = value };
Assert.Equal(expected, pwnedPassword.IsInvalid());
}
}
diff --git a/tests/HaveIBeenPwned.ClientTests/DefaultPwnedClientTests.cs b/tests/HaveIBeenPwned.ClientTests/DefaultPwnedClientTests.cs
index 0298d8b..e6afc3d 100644
--- a/tests/HaveIBeenPwned.ClientTests/DefaultPwnedClientTests.cs
+++ b/tests/HaveIBeenPwned.ClientTests/DefaultPwnedClientTests.cs
@@ -98,8 +98,9 @@ public static IEnumerable