< Summary

Information
Class: AsiBackbone.Signing.LocalDevelopment.LocalDevelopmentSigningOptions
Assembly: AsiBackbone.Signing.LocalDevelopment
File(s): /home/runner/work/AsiBackbone/AsiBackbone/src/AsiBackbone.Signing.LocalDevelopment/LocalDevelopmentSigningOptions.cs
Line coverage
100%
Covered lines: 23
Uncovered lines: 0
Coverable lines: 23
Total lines: 95
Line coverage: 100%
Branch coverage
75%
Covered branches: 6
Total branches: 8
Branch coverage: 75%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
get_ProviderName()100%11100%
get_KeyId()100%11100%
get_KeyVersion()100%11100%
get_SignatureAlgorithm()100%11100%
get_KeySizeBits()100%11100%
get_ReturnUnsignedOnFailure()100%11100%
Create(...)75%88100%

File(s)

/home/runner/work/AsiBackbone/AsiBackbone/src/AsiBackbone.Signing.LocalDevelopment/LocalDevelopmentSigningOptions.cs

#LineLine coverage
 1namespace AsiBackbone.Signing.LocalDevelopment;
 2
 3/// <summary>
 4/// Configures the local-development signing provider.
 5/// </summary>
 6/// <remarks>
 7/// This provider is intended for local development, samples, and tests. It is not a production managed-key provider and
 8/// </remarks>
 9public sealed class LocalDevelopmentSigningOptions
 10{
 11    /// <summary>
 12    /// Gets the default provider descriptor returned in signing metadata.
 13    /// </summary>
 14    public const string DefaultProviderName = "local-development";
 15
 16    /// <summary>
 17    /// Gets the default local-development key identifier.
 18    /// </summary>
 19    public const string DefaultKeyId = "local-dev-key";
 20
 21    /// <summary>
 22    /// Gets the default local-development key version.
 23    /// </summary>
 24    public const string DefaultKeyVersion = "dev";
 25
 26    /// <summary>
 27    /// Gets the default provider-neutral signature algorithm descriptor.
 28    /// </summary>
 29    public const string DefaultSignatureAlgorithm = "RSASSA-PKCS1-v1_5-SHA256-LOCAL-DEV";
 30
 31    /// <summary>
 32    /// Gets the default RSA key size for generated local-development keys.
 33    /// </summary>
 34    public const int DefaultKeySizeBits = 2048;
 35
 36    /// <summary>
 37    /// Gets or sets the provider descriptor returned in signing metadata.
 38    /// </summary>
 1539    public string ProviderName { get; set; } = DefaultProviderName;
 40
 41    /// <summary>
 42    /// Gets or sets the local-development key identifier returned in signing metadata.
 43    /// </summary>
 2144    public string KeyId { get; set; } = DefaultKeyId;
 45
 46    /// <summary>
 47    /// Gets or sets the local-development key version returned in signing metadata.
 48    /// </summary>
 2149    public string KeyVersion { get; set; } = DefaultKeyVersion;
 50
 51    /// <summary>
 52    /// Gets or sets the signature algorithm descriptor returned in signing metadata.
 53    /// </summary>
 1654    public string SignatureAlgorithm { get; set; } = DefaultSignatureAlgorithm;
 55
 56    /// <summary>
 57    /// Gets or sets the generated RSA key size in bits.
 58    /// </summary>
 1559    public int KeySizeBits { get; set; } = DefaultKeySizeBits;
 60
 61    /// <summary>
 62    /// Gets or sets a value indicating whether signing failures should return unsigned metadata with explicit failure d
 63    /// </summary>
 1064    public bool ReturnUnsignedOnFailure { get; set; } = true;
 65
 66    /// <summary>
 67    /// Creates options for the local-development signing provider.
 68    /// </summary>
 69    public static LocalDevelopmentSigningOptions Create(
 70        string? providerName = null,
 71        string? keyId = null,
 72        string? keyVersion = null,
 73        string? signatureAlgorithm = null,
 74        int keySizeBits = DefaultKeySizeBits,
 75        bool returnUnsignedOnFailure = true)
 76    {
 577        return new LocalDevelopmentSigningOptions
 578        {
 579            ProviderName = string.IsNullOrWhiteSpace(providerName)
 580                ? DefaultProviderName
 581                : providerName.Trim(),
 582            KeyId = string.IsNullOrWhiteSpace(keyId)
 583                ? DefaultKeyId
 584                : keyId.Trim(),
 585            KeyVersion = string.IsNullOrWhiteSpace(keyVersion)
 586                ? DefaultKeyVersion
 587                : keyVersion.Trim(),
 588            SignatureAlgorithm = string.IsNullOrWhiteSpace(signatureAlgorithm)
 589                ? DefaultSignatureAlgorithm
 590                : signatureAlgorithm.Trim(),
 591            KeySizeBits = keySizeBits,
 592            ReturnUnsignedOnFailure = returnUnsignedOnFailure
 593        };
 94    }
 95}