< Summary - Heimdall API

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

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
get_PersonId()100%11100%
get_TokenHash()100%11100%
get_ExpiresAt()100%11100%
get_Used()100%11100%
get_Person()100%11100%

File(s)

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

#LineLine coverage
 1using System.ComponentModel.DataAnnotations;
 2using ArturRios.Data.Relational.Core.Entities;
 3
 4namespace ArturRios.Heimdall.Domain.Entities;
 5
 6/// <summary>
 7///     A time-limited, single-use token issued for a password reset. Never addressed by its
 8///     internal <see cref="Entity{TKey}.Id" />; the caller-facing reference is the random token string
 9///     delivered by email, so it has no <c>PublicId</c>.
 10/// </summary>
 11public class PasswordResetToken : Entity<long>, IPersonToken
 12{
 13    /// <summary>Foreign key to the associated <see cref="Person" /> (internal Id). Required.</summary>
 18914    public long PersonId { get; set; }
 15
 16    /// <summary>
 17    ///     SHA-256 of the token that was emailed, as lowercase hex. The token itself is never stored: it replaces a
 18    ///     password, so a reader of this table would otherwise be able to complete a reset for any
 19    ///     account holding a live one (Threat Model TH-14). Written and compared through
 20    ///     <c>SingleUseTokenHash</c>.
 21    /// </summary>
 22    [MaxLength(64)]
 33523    public string TokenHash { get; set; } = string.Empty;
 24
 25    /// <summary>Expiration timestamp, after which the token is rejected.</summary>
 21426    public DateTime ExpiresAt { get; set; }
 27
 28    /// <summary>Whether the token has already been consumed.</summary>
 21629    public bool Used { get; set; }
 30
 31    // Navigation properties
 32
 33    /// <summary>The person this token was issued for.</summary>
 11534    public Person Person { get; set; } = null!;
 35}