Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion TechnitiumLibrary.Security.OTP/Authenticator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public class Authenticator
public Authenticator(AuthenticatorKeyUri keyUri)
{
Copy link

Copilot AI Feb 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Authenticator(AuthenticatorKeyUri keyUri) dereferences keyUri before validating it; passing null will still throw a NullReferenceException at keyUri.Type. Consider adding ArgumentNullException.ThrowIfNull(keyUri) at the start (consistent with other constructors like AuthenticatorKeyUri and DomainEndPoint).

Suggested change
{
{
ArgumentNullException.ThrowIfNull(keyUri);

Copilot uses AI. Check for mistakes.
if (!keyUri.Type.Equals("totp", StringComparison.OrdinalIgnoreCase))
throw new NotSupportedException($"The authenticator key URI type '{_keyUri.Type}' is not supported.");
throw new NotSupportedException($"The authenticator key URI type '{keyUri.Type}' is not supported.");

_keyUri = keyUri;
_key = Base32.FromBase32String(_keyUri.Secret);
Expand Down
Loading