This commit adds a new type called `SerializedKey`.
A serialized type is useful when using public keys as map keys. This is
because functionally identical public keys can have different internal
representations. These differences would cause the map to treat them as
different keys.
* Updated the `ecdsa.ParseDERSignature` to include the MaxSigLen constant, which defines the maximum length of a DER encoded signature.
* The MaxSigLen constant is set to 72 bytes, as per the explanation in the comment.
* A new test case has been added to test the functionality with a long signature.
* The test case checks if signatures longer than the specified maximum length are properly handled.
* The test ensures that signatures exceeding the maximum length are correctly identified as invalid.
Previously the early nonce generation option was not being respected
when creating the context, with the WithKnownSigners option being
used. This commit fixes that.
The doc formatting changes introduced in the recent go version is
increasing the diff for all of the new commits. Formatting it all in
this commit will help the readability of future PRs by reducing the
diff.
In this commit, we fix the `BenchmarkPartialVerify` test. When we moved
to musig 1.0, we stopped requiring the input as an x-only key. So we
need to remove the round trip serialization to force the key to be
x-only.
This is a fix similar to https://github.com/btcsuite/btcd/pull/1905.
We'll always make a copy of the key in the local scope before passing it
around elsewhere. Depending on the parity of the public key, the private
key itself might need to be negated.
A similar test is added here that fails without the patch to the
signature.go file.
This commit adds a check that the public key of the private key
that is passed to the Sign function is included in the slice of public
keys.
Reference ea47d52e2d
The two _concrete_ changes between version 0.4.0 (where we are before
this commit), and version 0.7.0 are:
1. Variable length messages are now allowed, this comes with a new 8
byte prefix for the messages.
* Our implementation was already using a `[]byte` for the
message/hash, so no extra API changes are needed here.
2. The serialization for a blank message and a normal message (for
nonce gen) is now distinct. A single byte is added (either 0 or 1)
to indicate if a message was passed into nonce generation.
In this commit, we enable early nonce generation, allowing callers to
obtain generated nonces before the total set of signers is actually
known. This type of nonce generation is useful for contexts like LN
funding when we want to minimize the round trips and send nonces before
we know the pubkey of the other party.