import { AeonSigner } from "@aeon-protocol/aeon-sdk";
// Assuming AeonSigner is initialized correctly as `signer`
// Assuming `hashedMessagesFromPreparePhase` are obtained from a prior MPC setup step
interface SignWithUserShareResponse {
signature_b64: string;
message: string;
}
async function contributeToMpcSigning(
signer: AeonSigner,
hashedMessagesFromPreparePhase: string[],
mpcScheme: string
) {
try {
console.log(`Contributing to MPC signing for scheme: ${mpcScheme}...`);
const response: SignWithUserShareResponse = await signer.signWithUserShare(
hashedMessagesFromPreparePhase,
mpcScheme
);
console.log("MPC signing share generated successfully!");
console.log(` Signature Share (Base64): ${response.signature_b64}`);
console.log(` Message: ${response.message}`);
// The response.signature_b64 would now be communicated to the MPC
// coordination service ("ika") or other protocol participants.
} catch (error) {
console.error(
"Failed to contribute to MPC signing with user share:",
error
);
// Handle errors related to invalid parameters, MPC protocol issues, or local key share problems
}
}