< Summary - Heimdall API

Information
Class: ArturRios.Heimdall.Domain.Entities.PendingRegistration
Assembly: ArturRios.Heimdall.Domain
File(s): /home/runner/work/heimdall-api/heimdall-api/src/Domain/ArturRios.Heimdall.Domain/Entities/PendingRegistration.cs
Line coverage
100%
Covered lines: 11
Uncovered lines: 0
Coverable lines: 11
Total lines: 64
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage
100%
Covered methods: 11
Fully covered methods: 11
Total methods: 11
Method coverage: 100%
Full method coverage: 100%

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
get_PublicId()100%11100%
get_ScopeId()100%11100%
get_Name()100%11100%
get_Email()100%11100%
get_PasswordHash()100%11100%
get_Salt()100%11100%
get_TokenHash()100%11100%
get_ExpiresAt()100%11100%
get_CreatedAt()100%11100%
get_FailedAttempts()100%11100%
get_Scope()100%11100%

File(s)

/home/runner/work/heimdall-api/heimdall-api/src/Domain/ArturRios.Heimdall.Domain/Entities/PendingRegistration.cs

#LineLine coverage
 1using System.ComponentModel.DataAnnotations;
 2using ArturRios.Data.Relational.Core.Entities;
 3
 4namespace ArturRios.Heimdall.Domain.Entities;
 5
 6/// <summary>
 7///     A self-registration (UC-47) waiting for its address to be confirmed. Not a person: nothing can
 8///     sign in with it, which is what keeps register-then-sign-in from revealing whether an address is
 9///     taken. Confirming it through the emailed link (UC-14) creates the verified <c>User</c> and
 10///     removes it; an unconfirmed one expires and is purged with the other single-use tokens (NFR-19).
 11/// </summary>
 12public class PendingRegistration : Entity<long>
 13{
 14    /// <summary>
 15    ///     The confirmation-guess budget (FR-SR-09): the login lockout threshold, so a leaked link admits
 16    ///     no more guesses at the sign-up password than the account itself would. Spent by
 17    ///     <c>PendingRegistrationConfirmer</c>; what is left is reported by the UC-49 listing.
 18    /// </summary>
 19    public const int MaxConfirmationGuesses = 10;
 20
 21    /// <summary>
 22    ///     The live registrations one address may have in one scope at a time (FR-SR-13). Each is a
 23    ///     confirmation mail to the address, so this bounds the mail registering can send it: a request
 24    ///     beyond it creates and mails nothing, and answers exactly as any other does (AF-47b).
 25    /// </summary>
 26    public const int MaxLivePerAddress = 3;
 27
 28    /// <summary>
 29    ///     The administrative reference (UC-49, UC-50): how a scope's owners name this registration to
 30    ///     discard it. Random, so it discloses nothing about the registrant or how many registrations
 31    ///     exist. The registrant never sees it; their reference is still the mailed token.
 32    /// </summary>
 22833    public Guid PublicId { get; set; } = Guid.NewGuid();
 34
 35    /// <summary>Foreign key to the scope registered into (internal Id).</summary>
 16836    public long ScopeId { get; set; }
 37
 38    [MaxLength(200)]
 28839    public string Name { get; set; } = string.Empty;
 40
 31841    public string Email { get; set; } = string.Empty;
 42
 43    /// <summary>The password hash computed on the request path; the plaintext was never stored.</summary>
 31544    public byte[] PasswordHash { get; set; } = [];
 45
 31546    public byte[] Salt { get; set; } = [];
 47
 48    /// <summary>SHA-256 of the mailed token, as lowercase hex, through <c>SingleUseTokenHash</c>.</summary>
 49    [MaxLength(64)]
 31050    public string TokenHash { get; set; } = string.Empty;
 51
 22652    public DateTime ExpiresAt { get; set; }
 53
 15054    public DateTime CreatedAt { get; set; }
 55
 56    /// <summary>
 57    ///     Wrong confirmation passwords presented with this registration's token. The row is discarded when
 58    ///     the count reaches the login lockout threshold, so a leaked link cannot be used to guess the
 59    ///     sign-up password without limit.
 60    /// </summary>
 24261    public int FailedAttempts { get; set; }
 62
 6263    public Scope Scope { get; set; } = null!;
 64}