diff --git a/src/keys.rs b/src/keys.rs index 7fe52c8..bfa040b 100644 --- a/src/keys.rs +++ b/src/keys.rs @@ -42,7 +42,7 @@ impl_serialization_traits!(DiffieHellmanPublicKey); impl DiffieHellmanPublicKey { /// Instantiates a new [`DiffieHellmanPublicKey`] key. - pub fn new(key: C::G) -> Self { + pub const fn new(key: C::G) -> Self { Self { key, _phantom: PhantomData, @@ -204,7 +204,7 @@ impl IndividualSigningKey { /// This can be useful for single parties owning a public key for /// Schnorr signatures outside of an ICE-FROST context and who would /// like to reshare its corresponding secret key to a set of participants. - pub fn from_single_key(key: ::ScalarField) -> Self { + pub const fn from_single_key(key: ::ScalarField) -> Self { Self { index: 1, key } } @@ -236,7 +236,7 @@ impl_serialization_traits!(GroupVerifyingKey); impl GroupVerifyingKey { /// Instantiates a new [`GroupVerifyingKey`] key. - pub fn new(key: C::G) -> Self { + pub const fn new(key: C::G) -> Self { Self { key, _phantom: PhantomData, diff --git a/src/sign/precomputation.rs b/src/sign/precomputation.rs index 2e7de3b..7500618 100644 --- a/src/sign/precomputation.rs +++ b/src/sign/precomputation.rs @@ -135,7 +135,7 @@ impl PartialEq for CommitmentShare { impl CommitmentShare { /// Publish the public commitments in this [`CommitmentShare`]. - pub fn publish(&self) -> (C::G, C::G) { + pub const fn publish(&self) -> (C::G, C::G) { (self.hiding.commit, self.binding.commit) } } diff --git a/src/sign/signature.rs b/src/sign/signature.rs index 6b104bb..e7e412d 100644 --- a/src/sign/signature.rs +++ b/src/sign/signature.rs @@ -78,7 +78,7 @@ impl_serialization_traits!(ThresholdSignature); struct BindingFactors(pub(crate) BTreeMap>); impl BindingFactors { - pub fn new() -> Self { + pub const fn new() -> Self { Self(BTreeMap::new()) } } @@ -103,7 +103,7 @@ impl DerefMut for BindingFactors { pub(crate) struct PartialThresholdSignatures(pub(crate) BTreeMap>); impl PartialThresholdSignatures { - pub fn new() -> Self { + pub const fn new() -> Self { Self(BTreeMap::new()) } } @@ -128,7 +128,7 @@ impl DerefMut for PartialThresholdSignatures { pub(crate) struct IndividualPublicKeys(pub(crate) BTreeMap); impl IndividualPublicKeys { - pub fn new() -> Self { + pub const fn new() -> Self { Self(BTreeMap::new()) } }