| 21 | } |
| 22 | |
| 23 | pub fn generate_n_of_n_public_key(n_of_n_public_keys: &[PublicKey]) -> (PublicKey, XOnlyPublicKey) { |
| 24 | let public_keys: Vec<Point> = n_of_n_public_keys |
| 25 | .iter() |
| 26 | .map(|&public_key| public_key.inner.into()) |
| 27 | .collect(); |
| 28 | |
| 29 | let key_agg_context = KeyAggContext::new(public_keys).unwrap(); |
| 30 | let aggregated_key: Secp256k1PublicKey = key_agg_context.aggregated_pubkey(); |
| 31 | |
| 32 | let n_of_n_public_key = PublicKey::from(aggregated_key); |
| 33 | let n_of_n_taproot_public_key = XOnlyPublicKey::from(n_of_n_public_key); |
| 34 | |
| 35 | (n_of_n_public_key, n_of_n_taproot_public_key) |
| 36 | } |