+#[derive(Clone)]
+#[repr(C)]
+/// Represents a tweaked X-only public key as required for BIP 340 (Taproot).
+pub struct TweakedPublicKey {
+ /// The bytes of the public key X coordinate
+ pub x_coordinate: [u8; 32],
+}
+impl TweakedPublicKey {
+ pub(crate) fn from_rust(pk: &BitcoinTweakedPublicKey) -> Self {
+ Self {
+ x_coordinate: pk.serialize(),
+ }
+ }
+ pub(crate) fn into_rust(&self) -> BitcoinTweakedPublicKey {
+ let xonly_key = XOnlyPublicKey::from_slice(&self.x_coordinate).unwrap();
+ BitcoinTweakedPublicKey::dangerous_assume_tweaked(xonly_key)
+ }
+}
+