mirror of
https://github.com/logos-co/nomos-node.git
synced 2026-08-31 03:21:15 +00:00
refactor: expose public_inputs_from_pks function as public
This commit is contained in:
@@ -16,7 +16,7 @@ pub use crate::keys::{
|
||||
},
|
||||
zk::{
|
||||
MAX_ZK_SIGNING_KEYS, PublicKey as ZkPublicKey, PublicKeys as ZkPublicKeys,
|
||||
Signature as ZkSignature, UnsecuredZkKey, ZkKey,
|
||||
Signature as ZkSignature, UnsecuredZkKey, ZkKey, public_inputs_from_pks,
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
@@ -13,7 +13,9 @@ use crate::keys::{errors::KeyError, secured_key::SecuredKey};
|
||||
mod private;
|
||||
pub use self::private::SecretKey as UnsecuredZkKey;
|
||||
mod public;
|
||||
pub use self::public::{MAX_ZK_SIGNING_KEYS, PublicKey, PublicKeys};
|
||||
pub use self::public::{
|
||||
MAX_ZK_SIGNING_KEYS, PublicKey, PublicKeys, inputs_from_pks as public_inputs_from_pks,
|
||||
};
|
||||
mod signature;
|
||||
pub use self::signature::Signature;
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ impl PublicKey {
|
||||
|
||||
#[must_use]
|
||||
pub fn verify_multi(pks: &[Self], data: &Fr, signature: &Signature) -> bool {
|
||||
let inputs = match try_from_pks((*data).into(), pks) {
|
||||
let inputs = match inputs_from_pks((*data).into(), pks) {
|
||||
Ok(inputs) => inputs,
|
||||
Err(e) => {
|
||||
error!(target: LOG_TARGET, "Error building verifier inputs: {e:?}");
|
||||
@@ -74,7 +74,10 @@ impl From<Fr> for PublicKey {
|
||||
}
|
||||
}
|
||||
|
||||
fn try_from_pks(msg: Groth16Input, pks: &[PublicKey]) -> Result<ZkSignVerifierInputs, ZkSignError> {
|
||||
pub fn inputs_from_pks(
|
||||
msg: Groth16Input,
|
||||
pks: &[PublicKey],
|
||||
) -> Result<ZkSignVerifierInputs, ZkSignError> {
|
||||
if pks.len() > MAX_ZK_SIGNING_KEYS {
|
||||
return Err(ZkSignError::TooManyKeys(pks.len()));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user