< Summary

Information
Class: NostrSure.Domain.Services.OptimizedCryptographicService
Assembly: NostrSure.Domain
File(s): /home/runner/work/NostrSure/NostrSure/NostrSure.Domain/Services/OptimizedCryptographicService.cs
Line coverage
88%
Covered lines: 8
Uncovered lines: 1
Coverable lines: 9
Total lines: 27
Line coverage: 88.8%
Branch coverage
90%
Covered branches: 9
Total branches: 10
Branch coverage: 90%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
VerifySchnorrSignature(...)90%101088.88%

File(s)

/home/runner/work/NostrSure/NostrSure/NostrSure.Domain/Services/OptimizedCryptographicService.cs

#LineLine coverage
 1using NBitcoin.Secp256k1;
 2using NostrSure.Domain.Validation;
 3
 4namespace NostrSure.Domain.Services;
 5
 6/// <summary>
 7/// High-performance cryptographic service optimized for Nostr operations
 8/// </summary>
 9public sealed class OptimizedCryptographicService : ICryptographicService
 10{
 11    public bool VerifySchnorrSignature(ReadOnlySpan<byte> signature, ReadOnlySpan<byte> message, ReadOnlySpan<byte> publ
 11312    {
 13        // Validate input parameters
 11314        if (signature.Length != 64 || message.Length != 32 || publicKey.Length != 32)
 515            return false;
 16
 17        // Create pubkey and signature objects using NBitcoin
 10818        if (!ECXOnlyPubKey.TryCreate(publicKey, out var pubkey))
 219            return false;
 20
 10621        if (!SecpSchnorrSignature.TryCreate(signature, out var sig))
 022            return false;
 23
 24        // Verify signature using BIP-340 standard
 10625        return pubkey.SigVerifyBIP340(sig, message);
 11326    }
 27}