Type Method
aggregate(_:)
Aggregates N secp256k1 public keys into a single MuSig2 aggregate public key via secp256k1_musig_pubkey_agg, sorting keys first with secp256k1_ec_pubkey_sort so the result is order-independent.
- iOS 13.0+
- macCatalyst 13.0+
- macOS 10.15+
- tvOS 13.0+
- visionOS 1.0+
- watchOS 6.0+
static func aggregate(_ pubkeys: [P256K.Schnorr.PublicKey]) throws -> P256K.MuSig.PublicKey
Parameters
-
pubkeys
-
All signers’ P256K.Schnorr.PublicKey values; must contain at least one key.
Return Value
An aggregate P256K.MuSig.PublicKey with an embedded key aggregation cache.
Discussion
The returned P256K.MuSig.PublicKey includes the 197-byte secp256k1_musig_keyagg_cache needed for signing sessions and Taproot tweaking. Different orderings of the same multiset of public keys produce the same aggregate because keys are sorted before aggregation.
Throws
secp256k1Error.underlyingCryptoError if sorting or aggregation fails.