Expose blst internals (#6829)

This commit is contained in:
Daniel Knopik
2025-02-24 04:39:20 +01:00
committed by GitHub
parent 01df433dfd
commit 60964fc7b5
6 changed files with 101 additions and 6 deletions

View File

@@ -61,6 +61,11 @@ where
GenericPublicKey::from_point(self.point.public_key())
}
/// Returns a reference to the underlying BLS point.
pub fn point(&self) -> &Sec {
&self.point
}
/// Serialize `self` as compressed bytes.
///
/// ## Note
@@ -89,3 +94,20 @@ where
}
}
}
impl<Sig, Pub, Sec> GenericSecretKey<Sig, Pub, Sec>
where
Sig: TSignature<Pub>,
Pub: TPublicKey,
Sec: TSecretKey<Sig, Pub> + Clone,
{
/// Instantiates `Self` from a `point`.
/// Takes a reference, as moves might accidentally leave behind key material
pub fn from_point(point: &Sec) -> Self {
Self {
point: point.clone(),
_phantom_signature: PhantomData,
_phantom_public_key: PhantomData,
}
}
}