remove: get_bls_signing_bytes
MODIFY
signer-npm/src/lib.rs
signer-npm/src/lib.rs
@@ -996,17 +996,3 @@ pub fn get_cid(message: JsValue) -> Result<String, JsValue> {
Ok(result)
}
-
-#[wasm_bindgen(js_name = getBlsSigningBytes)]
-pub fn get_bls_signing_bytes(unsigned_message: JsValue) -> Result<Vec<u8>, JsValue> {
- set_panic_hook();
-
- let unsigned_message_api: UnsignedMessageAPI = unsigned_message
- .into_serde()
- .map_err(|e| JsValue::from(format!("Error parsing parameters: {}", e)))?;
-
- let result = filecoin_signer::get_bls_signing_bytes(unsigned_message_api)
- .map_err(|e| JsValue::from(format!("Error getting the cid: {}", e)))?;
-
- Ok(result)
-}

MODIFY
signer/src/lib.rs
signer/src/lib.rs
@@ -445,7 +445,9 @@ fn verify_bls_signature(
let sig = bls_signatures::Signature::from_bytes(signature.as_ref())?;
- let signing_bytes = get_bls_signing_bytes(message)?;
+ let message = UnsignedMessage::try_from(&message)?;
+ let signing_bytes = message.to_signing_bytes();
+
let result = pk.verify(sig, signing_bytes);
Ok(result)
@@ -1254,18 +1256,3 @@ pub fn get_cid(message_api: MessageTxAPI) -> Result<String, SignerError> {
}
}
}
-
-/// Return the bytes to sign of an unsigned message
-///
-/// # Arguments
-///
-/// * `unsigned_message_api` - The unsigned message;
-pub fn get_bls_signing_bytes(
- unsigned_message_api: UnsignedMessageAPI,
-) -> Result<Vec<u8>, SignerError> {
- let unsigned_message = UnsignedMessage::try_from(&unsigned_message_api)?;
-
- let bytes = unsigned_message.to_signing_bytes();
-
- Ok(bytes)
-}

remove: get_bls_signing_bytes