+#[repr(C)]
+#[derive(Clone)]
+/// Represents a scalar value between zero and the secp256k1 curve order, in big endian.
+pub struct BigEndianScalar {
+ /// The bytes of the scalar value.
+ pub big_endian_bytes: [u8; 32],
+}
+impl BigEndianScalar {
+ pub(crate) fn from_rust(scalar: &SecpScalar) -> Self {
+ Self { big_endian_bytes: scalar.to_be_bytes() }
+ }
+ pub(crate) fn into_rust(&self) -> SecpScalar {
+ SecpScalar::from_be_bytes(self.big_endian_bytes).expect("Scalar greater than the curve order")
+ }
+}
+