Skip to content

Commit

Permalink
PAS-207: XML Comments (#55)
Browse files Browse the repository at this point in the history
* Added xml comments for AliasPointer.

* Added XML comments for Credential
---------

Co-authored-by: Oleksii Holub <[email protected]>
Co-authored-by: Anders Åberg <[email protected]>
  • Loading branch information
3 people authored Oct 27, 2023
1 parent 51d75ee commit d4890a1
Show file tree
Hide file tree
Showing 2 changed files with 85 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/Passwordless/Models/AliasPointer.cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,35 @@
namespace Passwordless;

/// <summary>
/// Alias used for asserting a user.
/// </summary>
public class AliasPointer
{
/// <summary>
/// Initialize the instance of <see cref="AliasPointer"/>
/// </summary>
/// <param name="userId">Identifier for the user</param>
/// <param name="alias">Hashed alias for the user</param>
/// <param name="plaintext">Plaintext value of the alias if stored</param>
public AliasPointer(string userId, string alias, string plaintext)
{
UserId = userId;
Alias = alias;
Plaintext = plaintext;
}

/// <summary>
/// Identifier for the user
/// </summary>
public string UserId { get; }

/// <summary>
/// Hashed value of the user's alias
/// </summary>
public string Alias { get; }

/// <summary>
/// Plaintext value of user's alias.
/// </summary>
public string Plaintext { get; }
}
65 changes: 65 additions & 0 deletions src/Passwordless/Models/Credential.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
namespace Passwordless;

/// <summary>
/// The passkey credential stored by Passwordless
/// <see href="https://www.w3.org/TR/webauthn-2/#public-key-credential"/>
/// </summary>
public class Credential
{
/// <summary>
/// Initializes an instance of <see cref="Credential"/>
/// </summary>
public Credential(CredentialDescriptor descriptor, byte[] publicKey, byte[] userHandle, uint signatureCounter,
string attestationFmt, DateTime createdAt, Guid aaGuid, DateTime lastUsedAt, string rpid,
string origin, string country, string device, string nickname, string userId)
Expand All @@ -22,18 +29,76 @@ public Credential(CredentialDescriptor descriptor, byte[] publicKey, byte[] user
UserId = userId;
}

/// <summary>
/// Descriptor of the credential as defined by the WebAuthn specification
/// <see href="https://w3c.github.io/webauthn/#enumdef-publickeycredentialtype" />
/// </summary>
public CredentialDescriptor Descriptor { get; }

/// <summary>
/// Public key of the passkey pair.
/// </summary>
public byte[] PublicKey { get; }

/// <summary>
/// Byte array of user identifier
/// </summary>
public byte[] UserHandle { get; }

/// <summary>
/// WebAuthn SignatureCounter, used for anti forgery.
/// </summary>
public uint SignatureCounter { get; }

/// <summary>
/// Attestation Statement format used to create credential
/// </summary>
public string AttestationFmt { get; }

/// <summary>
/// When the credential was created
/// </summary>
public DateTime CreatedAt { get; }

/// <summary>
/// The AAGUID of the authenticator. Can be used to identify the make and model of the authenticator.
/// <see href="https://www.w3.org/TR/webauthn/#aaguid"/>
/// </summary>
public Guid AaGuid { get; }

/// <summary>
/// Last time credential was used
/// </summary>
public DateTime LastUsedAt { get; }

/// <summary>
/// Relying Party identifier
/// <see href="https://w3c.github.io/webauthn/#dom-publickeycredentialcreationoptions-rp"/>
/// </summary>
public string RPID { get; }

/// <summary>
/// Domain credential was created for
/// </summary>
public string Origin { get; }

/// <summary>
/// Optional country credential was created in
/// </summary>
public string Country { get; }

/// <summary>
/// Device the credential was created on
/// </summary>
public string Device { get; }

/// <summary>
/// Friendly name for credential.
/// </summary>
public string Nickname { get; }

/// <summary>
/// Identifier for the user
/// </summary>
public string UserId { get; }
}

0 comments on commit d4890a1

Please sign in to comment.