diff --git a/dotnet/src/webdriver/VirtualAuth/Credential.cs b/dotnet/src/webdriver/VirtualAuth/Credential.cs index 57dbcbe76ff45..af3e09cc94e41 100644 --- a/dotnet/src/webdriver/VirtualAuth/Credential.cs +++ b/dotnet/src/webdriver/VirtualAuth/Credential.cs @@ -34,11 +34,11 @@ public sealed class Credential private readonly byte[] id; private readonly byte[]? userHandle; - private Credential(byte[] id, bool isResidentCredential, string rpId, string privateKey, byte[]? userHandle, int signCount) + private Credential(byte[] id, bool isResidentCredential, string? rpId, string privateKey, byte[]? userHandle, int signCount) { this.id = id ?? throw new ArgumentNullException(nameof(id)); this.IsResidentCredential = isResidentCredential; - this.RpId = rpId ?? throw new ArgumentNullException(nameof(rpId)); + this.RpId = rpId; this.PrivateKey = privateKey ?? throw new ArgumentNullException(nameof(privateKey)); this.userHandle = userHandle; this.SignCount = signCount; @@ -52,7 +52,7 @@ private Credential(byte[] id, bool isResidentCredential, string rpId, string pri /// The private Key for the credentials. /// The signature counter for the credentials. /// The created instance of the Credential class. - /// If , , or are . + /// If or are . public static Credential CreateNonResidentCredential(byte[] id, string rpId, string privateKey, int signCount) { return new Credential(id, false, rpId, privateKey, null, signCount); @@ -67,7 +67,7 @@ public static Credential CreateNonResidentCredential(byte[] id, string rpId, str /// The user handle associated to the credential. /// The signature counter for the credentials. /// The created instance of the Credential class. - /// If , , or are . + /// If or are . public static Credential CreateResidentCredential(byte[] id, string rpId, string privateKey, byte[] userHandle, int signCount) { return new Credential(id, true, rpId, privateKey, userHandle, signCount); @@ -86,7 +86,7 @@ public static Credential CreateResidentCredential(byte[] id, string rpId, string /// /// Gets the ID of the relying party of this credential. /// - public string RpId { get; } + public string? RpId { get; } /// /// Gets the private key of the credential. @@ -130,7 +130,10 @@ public Dictionary ToDictionary() toReturn["credentialId"] = Base64UrlEncoder.Encode(this.id); toReturn["isResidentCredential"] = this.IsResidentCredential; - toReturn["rpId"] = this.RpId; + if (this.RpId is not null) + { + toReturn["rpId"] = this.RpId; + } toReturn["privateKey"] = this.PrivateKey; toReturn["signCount"] = this.SignCount; if (this.userHandle is not null) diff --git a/dotnet/test/common/VirtualAuthn/VirtualAuthenticatorTest.cs b/dotnet/test/common/VirtualAuthn/VirtualAuthenticatorTest.cs index fdfa743d4a51f..7723150b6640f 100644 --- a/dotnet/test/common/VirtualAuthn/VirtualAuthenticatorTest.cs +++ b/dotnet/test/common/VirtualAuthn/VirtualAuthenticatorTest.cs @@ -479,7 +479,7 @@ public void ShouldRemoveAllCredentials() [IgnoreBrowser(Selenium.Browser.IE, "IE does not support Virtual Authenticator")] [IgnoreBrowser(Selenium.Browser.Firefox, "Firefox does not support Virtual Authenticator")] [IgnoreBrowser(Selenium.Browser.Safari, "Safari does not support Virtual Authenticator")] - public void testSetUserVerified() + public void TestSetUserVerified() { CreateRKEnabledCTAP2Authenticator();