Class CompositeArkadeWalletSigner
An IArkadeWalletSigner composed of one or more IDescriptorSigningSources.
For every signing call the composite resolves the first source whose
CanProvideAsync(OutputDescriptor, CancellationToken) returns true and dispatches
the operation to it. Source order is significant — earlier sources take precedence — so
callers should register the cheapest / most-local source first and any fallbacks
(e.g. remote-signer transports) last.
public class CompositeArkadeWalletSigner : IArkadeWalletSigner
- Inheritance
-
CompositeArkadeWalletSigner
- Implements
- Inherited Members
Constructors
CompositeArkadeWalletSigner(params IDescriptorSigningSource[])
public CompositeArkadeWalletSigner(params IDescriptorSigningSource[] sources)
Parameters
sourcesIDescriptorSigningSource[]
CompositeArkadeWalletSigner(IEnumerable<IDescriptorSigningSource>)
public CompositeArkadeWalletSigner(IEnumerable<IDescriptorSigningSource> sources)
Parameters
sourcesIEnumerable<IDescriptorSigningSource>
Methods
GenerateNonces(OutputDescriptor, MusigContext, string, CancellationToken)
Generates a fresh MuSig2 nonce pair for context, retains the
secret half indexed by sessionId, and returns the public half.
Calling twice with the same sessionId (without an intervening
SignMusig(OutputDescriptor, MusigContext, string, CancellationToken) to consume the prior nonce) throws — generating a fresh nonce
on top of an unused one would orphan secret material in the signer's store.
public Task<MusigPubNonce> GenerateNonces(OutputDescriptor descriptor, MusigContext context, string sessionId, CancellationToken cancellationToken = default)
Parameters
descriptorOutputDescriptorThe descriptor identifying the signing key.
contextMusigContextThe MuSig2 context the nonce is generated for.
sessionIdstringA caller-supplied identifier unique to this signing operation. Must match the value later passed to SignMusig(OutputDescriptor, MusigContext, string, CancellationToken). Typically a transaction identifier (txid).
cancellationTokenCancellationTokenCancellation token.
Returns
- Task<MusigPubNonce>
GetPubKey(OutputDescriptor, CancellationToken)
Gets the compressed public key for the given descriptor, preserving parity.
public Task<ECPubKey> GetPubKey(OutputDescriptor descriptor, CancellationToken cancellationToken = default)
Parameters
descriptorOutputDescriptorcancellationTokenCancellationToken
Returns
- Task<ECPubKey>
Sign(OutputDescriptor, uint256, CancellationToken)
Produces a BIP-340 Schnorr signature over hash using the descriptor's private key,
returning the x-only pubkey alongside the signature.
public Task<(ECXOnlyPubKey, SecpSchnorrSignature)> Sign(OutputDescriptor descriptor, uint256 hash, CancellationToken cancellationToken = default)
Parameters
descriptorOutputDescriptorhashuint256cancellationTokenCancellationToken
Returns
- Task<(ECXOnlyPubKey, SecpSchnorrSignature)>
Remarks
The returned x-only pubkey must be the key named by descriptor
(i.e. descriptor.ToXOnlyPubKey()) — not a derived, rotated, or otherwise substituted
key. Signatures are stored in PSBTs keyed by this pubkey, and callers look them back up by
the descriptor's key; pending-tx recovery in particular relies on that to check the wallet
really signed a transaction before it signs the matching checkpoint. A signer returning a
different key makes its own signatures unfindable and gets valid transactions rejected.
SignMusig(OutputDescriptor, MusigContext, string, CancellationToken)
Produces a MuSig2 partial signature for the given context using the descriptor's
private key and the secret nonce generated under the same sessionId
by a prior call to GenerateNonces(OutputDescriptor, MusigContext, string, CancellationToken). The secret nonce is consumed and cannot
be reused for another SignMusig(OutputDescriptor, MusigContext, string, CancellationToken) call (MuSig2 nonce reuse leaks the private
key).
public Task<MusigPartialSignature> SignMusig(OutputDescriptor descriptor, MusigContext context, string sessionId, CancellationToken cancellationToken = default)
Parameters
descriptorOutputDescriptorThe descriptor identifying the signing key.
contextMusigContextThe MuSig2 context (cosigner set + sighash) the nonce was generated for.
sessionIdstringThe same session identifier that was passed to the matching GenerateNonces(OutputDescriptor, MusigContext, string, CancellationToken) call. Typically a transaction identifier (txid) or any other string unique to this signing operation within the signer's scope.
cancellationTokenCancellationTokenCancellation token.
Returns
- Task<MusigPartialSignature>
Exceptions
- InvalidOperationException
No secret nonce is stored for
sessionId— GenerateNonces(OutputDescriptor, MusigContext, string, CancellationToken) was not called for this session on this signer, or the nonce was already consumed.