< Summary - Combined Code Coverage

Information
Class: NLightning.Infrastructure.Crypto.Primitives.KeyPair
Assembly: NLightning.Infrastructure
File(s): /home/runner/work/nlightning/nlightning/src/NLightning.Infrastructure/Crypto/Primitives/KeyPair.cs
Tag: 30_15166811759
Line coverage
100%
Covered lines: 9
Uncovered lines: 0
Coverable lines: 9
Total lines: 60
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
get_PrivateKey()100%11100%
get_PublicKey()100%11100%
get_PublicKeyBytes()100%11100%
.ctor(...)100%11100%
Dispose()100%11100%

File(s)

/home/runner/work/nlightning/nlightning/src/NLightning.Infrastructure/Crypto/Primitives/KeyPair.cs

#LineLine coverage
 1using NBitcoin;
 2
 3namespace NLightning.Infrastructure.Crypto.Primitives;
 4
 5/// <summary>
 6/// A secp256k1 private/public key pair.
 7/// </summary>
 8internal sealed class KeyPair : IDisposable
 9{
 10    /// <summary>
 11    /// Gets the private key.
 12    /// </summary>
 13    /// <exception cref="ObjectDisposedException">
 14    /// Thrown if the current instance has already been disposed.
 15    /// </exception>
 42816    public Key PrivateKey { get; }
 17
 18    /// <summary>
 19    /// Gets the public key.
 20    /// </summary>
 21    /// <exception cref="ObjectDisposedException">
 22    /// Thrown if the current instance has already been disposed.
 23    /// </exception>
 30024    public PubKey PublicKey { get; }
 25
 26    /// <summary>
 27    /// Gets the public key bytes.
 28    /// </summary>
 29    /// <exception cref="ObjectDisposedException">
 30    /// Thrown if the current instance has already been disposed.
 31    /// </exception>
 32    public byte[] PublicKeyBytes
 33    {
 34        get
 35        {
 30036            return PublicKey.ToBytes();
 37        }
 38    }
 39
 40    /// <summary>
 41    /// Initializes a new instance of the <see cref="KeyPair"/> class.
 42    /// </summary>
 43    /// <param name="privateKey" cref="Key">The private key.</param>
 44    /// <exception cref="ArgumentNullException">
 45    /// Thrown if the <paramref name="privateKey"/> is null.
 46    /// </exception>
 17247    internal KeyPair(Key privateKey)
 48    {
 17249        PrivateKey = privateKey;
 17250        PublicKey = privateKey.PubKey;
 17251    }
 52
 53    /// <summary>
 54    /// Erases the key pair from the memory.
 55    /// </summary>
 56    public void Dispose()
 57    {
 23658        PrivateKey.Dispose();
 23659    }
 60}