refactor: expose public_inputs_from_pks function as public

This commit is contained in:
Youngjoon Lee
2026-08-19 21:26:24 +09:00
parent 8586db87d9
commit c8a8fcd2ec
3 changed files with 9 additions and 4 deletions
+1 -1
View File
@@ -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,
},
};
+3 -1
View File
@@ -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;
+5 -2
View File
@@ -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()));
}