Add `ValueCommitTrapdoor::from_bytes` constructor

This commit is contained in:
Tomas Krnak 2022-08-11 12:24:15 +02:00 committed by Daira Hopwood
parent 591c4b89b9
commit d428aa3143
1 changed files with 5 additions and 0 deletions

View File

@ -218,6 +218,11 @@ impl ValueCommitTrapdoor {
pub(crate) fn inner(&self) -> pallas::Scalar {
self.0
}
/// Constructs `ValueCommitTrapdoor` from the byte reprsentation of a scalar
pub fn from_bytes(bytes: [u8; 32]) -> CtOption<Self> {
pallas::Scalar::from_repr(bytes).map(ValueCommitTrapdoor)
}
}
impl Add<&ValueCommitTrapdoor> for ValueCommitTrapdoor {