< Summary

Information
Class: NostrSure.Domain.Entities.Pubkey
Assembly: NostrSure.Domain
File(s): /home/runner/work/NostrSure/NostrSure/NostrSure.Domain/Entities/Pubkey.cs
Line coverage
88%
Covered lines: 16
Uncovered lines: 2
Coverable lines: 18
Total lines: 30
Line coverage: 88.8%
Branch coverage
60%
Covered branches: 12
Total branches: 20
Branch coverage: 60%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
get_Value()100%11100%
.ctor(...)50%2283.33%
get_IsValid()50%44100%
IsValidHex(...)64.28%141487.5%

File(s)

/home/runner/work/NostrSure/NostrSure/NostrSure.Domain/Entities/Pubkey.cs

#LineLine coverage
 1namespace NostrSure.Domain.Entities;
 2
 3public sealed class Pubkey
 4{
 4345    public string Value { get; }
 6
 2397    public Pubkey(string value)
 2398    {
 2399        if (string.IsNullOrWhiteSpace(value))
 010            throw new ArgumentException("Pubkey cannot be empty.", nameof(value));
 23911        Value = value;
 23912    }
 13
 14    /// <summary>
 15    /// Validates that the pubkey is a valid 32-byte hex string (64 characters).
 16    /// </summary>
 1117    public bool IsValid => !string.IsNullOrEmpty(Value) &&
 1118                          Value.Length == 64 &&
 1119                          IsValidHex(Value);
 20
 21    private static bool IsValidHex(string hex)
 1122    {
 144123        foreach (char c in hex)
 70424        {
 70425            if (!((c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F')))
 026                return false;
 70427        }
 1128        return true;
 1129    }
 30}