Skip to content
Open
Show file tree
Hide file tree
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 Src/Fido2.Development/DevelopmentInMemoryStore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public Task<List<Fido2User>> GetUsersByCredentialIdAsync(byte[] credentialId, Ca
var cred = _storedCredentials.FirstOrDefault(c => c.Descriptor.Id.AsSpan().SequenceEqual(credentialId));

if (cred is null)
return Task.FromResult(new List<Fido2User>());
return Task.FromResult<List<Fido2User>>([]);

return Task.FromResult(_storedUsers.Where(u => u.Value.Id.SequenceEqual(cred.UserId)).Select(u => u.Value).ToList());
}
Expand Down
4 changes: 2 additions & 2 deletions Src/Fido2.Models/AssertionOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public class AssertionOptions
/// This OPTIONAL member contains a list of PublicKeyCredentialDescriptor objects representing public key credentials acceptable to the caller, in descending order of the caller’s preference(the first item in the list is the most preferred credential, and so on down the list)
/// </summary>
[JsonPropertyName("allowCredentials")]
public IReadOnlyList<PublicKeyCredentialDescriptor> AllowCredentials { get; set; } = Array.Empty<PublicKeyCredentialDescriptor>();
public IReadOnlyList<PublicKeyCredentialDescriptor> AllowCredentials { get; set; } = [];

/// <summary>
/// This member describes the Relying Party's requirements regarding user verification for the get() operation.
Expand All @@ -54,7 +54,7 @@ public class AssertionOptions
/// This OPTIONAL member contains zero or more elements from <see cref="PublicKeyCredentialHint"/> to guide the user agent in interacting with the user. Note that the elements have type DOMString despite being taken from that enumeration.
/// </summary>
[JsonPropertyName("hints")]
public IReadOnlyList<PublicKeyCredentialHint> Hints { get; set; } = Array.Empty<PublicKeyCredentialHint>();
public IReadOnlyList<PublicKeyCredentialHint> Hints { get; set; } = [];

/// <summary>
/// This OPTIONAL member contains additional parameters requesting additional processing by the client and authenticator.
Expand Down
2 changes: 1 addition & 1 deletion Src/Fido2.Models/Converters/EnumNameMapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public static IEnumerable<string> GetNames()

private static FrozenDictionary<TEnum, string> GetIdToNameMap()
{
var items = new List<KeyValuePair<TEnum, string>>();
List<KeyValuePair<TEnum, string>> items = [];

foreach (var field in typeof(TEnum).GetFields(BindingFlags.Public | BindingFlags.Static))
{
Expand Down
10 changes: 5 additions & 5 deletions Src/Fido2.Models/CredentialCreateOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public sealed class CredentialCreateOptions

#nullable enable

private IReadOnlyList<PublicKeyCredentialHint> _hints = Array.Empty<PublicKeyCredentialHint>();
private IReadOnlyList<PublicKeyCredentialHint> _hints = [];

/// <summary>
/// Guides the user agent in interacting with the user. This OPTIONAL member contains zero or more elements from <see cref="PublicKeyCredentialHint" />.
Expand Down Expand Up @@ -126,8 +126,8 @@ public static CredentialCreateOptions Create(
AttestationConveyancePreference attestationConveyancePreference,
IReadOnlyList<PublicKeyCredentialDescriptor> excludeCredentials,
AuthenticationExtensionsClientInputs? extensions,
IReadOnlyList<PubKeyCredParam> pubKeyCredParams)

IReadOnlyList<PubKeyCredParam> pubKeyCredParams)
{
return new CredentialCreateOptions
{
Expand Down Expand Up @@ -184,8 +184,8 @@ public sealed class PubKeyCredParam(
public static readonly PubKeyCredParam PS384 = new(COSE.Algorithm.PS384);
public static readonly PubKeyCredParam PS512 = new(COSE.Algorithm.PS512);
public static readonly PubKeyCredParam Ed25519 = new(COSE.Algorithm.EdDSA);
public static readonly PubKeyCredParam RS1 = new(COSE.Algorithm.RS1);

public static readonly PubKeyCredParam RS1 = new(COSE.Algorithm.RS1);
/// <summary>
/// The default algorithms supported by the library
/// </summary>
Expand Down
2 changes: 1 addition & 1 deletion Src/Fido2/Asn1Element.cs
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ public static Asn1Element Decode(ReadOnlyMemory<byte> data)

private static List<Asn1Element> ReadElements(AsnReader reader)
{
var elements = new List<Asn1Element>();
List<Asn1Element> elements = [];

while (reader.HasData)
{
Expand Down
2 changes: 1 addition & 1 deletion Src/Fido2/AttestationFormat/FidoU2f.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ .. publicKeyU2F

// 7. Optionally, inspect x5c and consult externally provided knowledge to determine whether attStmt conveys a Basic or AttCA attestation

var trustPath = new X509Certificate2[1] { attCert };
X509Certificate2[] trustPath = [attCert];

return new(new VerifyAttestationResult(AttestationType.AttCa, trustPath));
}
Expand Down
2 changes: 1 addition & 1 deletion Src/Fido2/Cbor/CborArray.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ public sealed class CborArray : CborObject, IEnumerable<CborObject>
{
public CborArray()
{
Values = new List<CborObject>();
Values = [];
}

public CborArray(List<CborObject> values)
Expand Down
2 changes: 1 addition & 1 deletion Src/Fido2/Cbor/CborObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ private static CborArray ReadArray(CborReader reader)

var items = count != null
? new List<CborObject>(count.Value)
: new List<CborObject>();
: [];

while (!(reader.PeekState() is CborReaderState.EndArray or CborReaderState.Finished))
{
Expand Down
2 changes: 1 addition & 1 deletion Src/Fido2/GetAssertionOptionsParams.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public sealed class GetAssertionOptionsParams
///
/// The list is ordered in descending order of preference: the first item in the list is the most preferred credential, and the last is the least preferred.
/// </summary>
public IReadOnlyList<PublicKeyCredentialDescriptor> AllowedCredentials { get; init; } = Array.Empty<PublicKeyCredentialDescriptor>();
public IReadOnlyList<PublicKeyCredentialDescriptor> AllowedCredentials { get; init; } = [];

/// <summary>
/// This OPTIONAL member specifies the Relying Party's requirements regarding user verification for the get() operation. The value SHOULD be a member of UserVerificationRequirement but client platforms MUST ignore unknown values, treating an unknown value as if the member does not exist. Eligible authenticators are filtered to only those capable of satisfying this requirement.
Expand Down
2 changes: 1 addition & 1 deletion Src/Fido2/Metadata/ConformanceMetadataRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public async Task<MetadataBLOBPayload> GetBLOBAsync(CancellationToken cancellati
Entries = []
};

var entries = new List<MetadataBLOBPayloadEntry>();
List<MetadataBLOBPayloadEntry> entries = [];

foreach (var blobUrl in conformanceEndpoints)
{
Expand Down
3 changes: 1 addition & 2 deletions Src/Fido2/RequestNewCredentialParams.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ public sealed class RequestNewCredentialParams
/// <summary>
/// The Relying Party SHOULD use this OPTIONAL member to list any existing credentials mapped to this user account (as identified by user.id). This ensures that the new credential is not created on an authenticator that already contains a credential mapped to this user account. If it would be, the client is requested to instead guide the user to use a different authenticator, or return an error if that fails.
/// </summary>
public IReadOnlyList<PublicKeyCredentialDescriptor> ExcludeCredentials { get; init; } =
Array.Empty<PublicKeyCredentialDescriptor>();
public IReadOnlyList<PublicKeyCredentialDescriptor> ExcludeCredentials { get; init; } = [];

/// <summary>
/// The Relying Party MAY use this OPTIONAL member to specify capabilities and settings that the authenticator MUST or SHOULD satisfy to participate in the create() operation. See § 5.4.4 Authenticator Selection Criteria (dictionary AuthenticatorSelectionCriteria).
Expand Down
Loading