### Update cggmp24 Dependency in Cargo.toml Source: https://github.com/lfdt-lockness/cggmp21/blob/cggmp24/m/CGGMP21_MIGRATION.md Modify your Cargo.toml file to specify the desired version of the cggmp24 crate. This example shows updating to alpha.2. ```toml [dependencies] cggmp24 = "0.7.0-alpha.2" ``` -------------------------------- ### Verify project compilation and tests Source: https://github.com/lfdt-lockness/cggmp21/blob/cggmp24/m/CGGMP21_MIGRATION.md Clean the build environment and run tests to ensure the migration is successful. ```bash cargo clean cargo test ``` -------------------------------- ### Perform Full Signing in CGGMP24 Source: https://github.com/lfdt-lockness/cggmp21/blob/cggmp24/m/README.md Use this snippet for a complete signing operation. Ensure you have the execution ID, signer index, keygen indexes, and completed key share. The data to be signed must be a digest. ```rust let eid = cggmp24::ExecutionId::new(b"execution id, unique per protocol execution"); let i = /* signer index (0 <= i < min_signers) */; let parties_indexes_at_keygen: [u16; MIN_SIGNERS] = /* parties_indexes_at_keygen[i] is the index the i-th party had at keygen */; let key_share = /* completed key share */; let data_to_sign = cggmp24::DataToSign::digest::(b"data to be signed"); let signature = cggmp24::signing(eid, i, &parties_indexes_at_keygen, &key_share) .sign(&mut OsRng, party, &data_to_sign) .await?; ``` -------------------------------- ### Serialize Integer to Bytes (MSF Order) Source: https://github.com/lfdt-lockness/cggmp21/blob/cggmp24/m/CGGMP21_MIGRATION.md Demonstrates how to serialize an Integer to a byte vector in MSF (Most Significant First) order using the new API. This replaces the previous method that relied on the `rug` crate's `to_digits` function. ```rust let bytes: Vec = integer.to_bytes_msf(); ``` -------------------------------- ### Construct an MpcParty Instance Source: https://github.com/lfdt-lockness/cggmp21/blob/cggmp24/m/README.md This snippet demonstrates how to construct an MpcParty instance using the defined network delivery streams. The 'connected' function initializes the party for interactive protocol execution. ```rust let delivery = (incoming, outgoing); let party = round_based::MpcParty::connected(delivery); ``` -------------------------------- ### Serialize Integer to Bytes (MSF Order) using Rug Source: https://github.com/lfdt-lockness/cggmp21/blob/cggmp24/m/CGGMP21_MIGRATION.md This code snippet shows the previous method of serializing an integer to bytes in MSF order using the `rug` crate. It is provided for comparison with the new API. ```rust let bytes: Vec = integer.to_digits::(rug::integer::Order::Msf); ``` -------------------------------- ### Configure MathJax Rendering Source: https://github.com/lfdt-lockness/cggmp21/blob/cggmp24/m/key-share/katex-header.html Use this JavaScript snippet to initialize MathJax on your page. It configures delimiters for inline and display math, and defines custom macros for common mathematical symbols and notations. Ensure this runs after the DOM is loaded. ```javascript document.addEventListener("DOMContentLoaded", function() { renderMathInElement(document.body, { delimiters: [ {left: "$$\", right: "$$\", display: true}, {left: "\\(\", right: "\\)\", display: false}, {left: "$\", right: "$\", display: false}, {left: "\\[\", right: "\\]\", display: true} ], macros: { "\\Zq": "\\mathbb{Z}\\text{\_}q", "\\G": "\\mathbb{G}", "\\T": "\\mathbb{T}", "\\O": "\\mathcal{O}", "\\P": "\\mathcal{P}", "\\V": "\\mathcal{V}", "\\H": "\\mathcal{H}", "\\?": "\\stackrel{?}{=}", "\\ith": "i^{\\text{th}}", "\\sk": "\\text{sk}" } }); }); ``` -------------------------------- ### Configure CGGMP24 for no_std Compatibility Source: https://github.com/lfdt-lockness/cggmp21/blob/cggmp24/m/README.md To compile CGGMP24 crates for a no_std environment, disable the default 'std' feature and enable 'no_std' along with the 'backend-num-bigint' feature. This is necessary for platforms like wasm32-unknown-unknown. ```toml cggmp24 = { version = "0.7", default-features = false, features = ["no_std", "backend-num-bigint"] } cggmp24-keygen = { version = "0.7", default-features = false } key-share = { version = "0.6", default-features = false } ``` -------------------------------- ### Perform Distributed Key Generation (DKG) with CGGMP24 Source: https://github.com/lfdt-lockness/cggmp21/blob/cggmp24/m/README.md Initiates the Distributed Key Generation protocol to co-share a cryptographic key among multiple signers. Requires agreement on execution ID, participant indices, and the threshold value. The output is an incomplete key share that can be serialized. ```rust use cggmp24::supported_curves::Secp256k1; let eid = cggmp24::ExecutionId::new(b"execution id, unique per protocol execution"); let i = /* signer index (0 <= i < n) */; let n = /* number of signers taking part in key generation */; let t = /* threshold */; let incomplete_key_share = cggmp24::keygen::(eid, i, n) .set_threshold(t) .start(&mut OsRng, party) .await?; ``` -------------------------------- ### Generate Auxiliary Info for CGGMP24 Source: https://github.com/lfdt-lockness/cggmp21/blob/cggmp24/m/README.md Generates auxiliary information required for signing protocols. This process involves generating safe primes and performing zero-knowledge proofs. Ensure the execution ID is unique per protocol execution and that signer indices and the total number of signers are consistent across all participants. ```rust let pregenerated_primes = cggmp24::PregeneratedPrimes::generate(&mut OsRng); let eid = cggmp24::ExecutionId::new(b"execution id, unique per protocol execution"); let i = /* signer index, same as at keygen */; let n = /* number of signers */; let aux_info = cggmp24::aux_info_gen(eid, i, n, pregenerated_primes) .start(&mut OsRng, party) .await?; ``` -------------------------------- ### Automated code refactoring for cggmp24 Source: https://github.com/lfdt-lockness/cggmp21/blob/cggmp24/m/CGGMP21_MIGRATION.md Use sed to perform a project-wide search and replace of cggmp21 references to cggmp24 in Rust source files. ```bash find . -type f -name "*.rs" -exec sed -i -E 's/\bcggmp21\b/cggmp24/g; s/\bcggmp21_keygen\b/cggmp24_keygen/g; s/\bCGGMP21\b/CGGMP24/g' {} + ``` -------------------------------- ### Configure MathJax Rendering Source: https://github.com/lfdt-lockness/cggmp21/blob/cggmp24/m/katex-header.html Use this snippet to initialize MathJax rendering on the DOMContentLoaded event. It defines delimiters for inline and display math and custom macros for common mathematical symbols and notations. ```javascript document.addEventListener("DOMContentLoaded", function() { renderMathInElement(document.body, { delimiters: [ {left: "$$\", right: "$$\", display: true}, {left: "\\(\", right: "\\)\", display: false}, {left: "$\", right: "$\", display: false}, {left: "\\[\". right: "\\]\", display: true} ], macros: { "\\Zq": "\\mathbb{Z}\_q", "\\G": "\\mathbb{G}", "\\T": "\\mathbb{T}", "\\O": "\\mathcal{O}", "\\P": "\\mathcal{P}", "\\V": "\\mathcal{V}", "\\H": "\\mathcal{H}", "\\?": "\\stackrel{?}{=}", "\\ith": "i^{\\text{th}}", "\\sk": "\\text{sk}", } }); }); ``` -------------------------------- ### Update Cargo.toml dependencies for cggmp24 Source: https://github.com/lfdt-lockness/cggmp21/blob/cggmp24/m/CGGMP21_MIGRATION.md Update the project dependencies to use the new cggmp24 crate version. ```toml [dependencies] cggmp24 = "0.7.0-alpha.1" ``` ```toml [dependencies] cggmp24 = "0.7.0-alpha.2" ``` -------------------------------- ### Complete Key Share using Auxiliary Info in CGGMP24 Source: https://github.com/lfdt-lockness/cggmp21/blob/cggmp24/m/README.md Completes an incomplete key share generated during DKG by combining it with pre-generated auxiliary information. This step is necessary to finalize the key share for use in signing protocols. ```rust let key_share = cggmp24::KeyShare::from_parts((incomplete_key_share, aux_info))?; ``` -------------------------------- ### Define Network Streams for MPC Party Source: https://github.com/lfdt-lockness/cggmp21/blob/cggmp24/m/README.md This snippet shows the required async stream and sink types for handling incoming and outgoing protocol messages. The concrete networking implementation is application-specific. ```rust let incoming: impl Stream>>; let outgoing: impl Sink>; ``` -------------------------------- ### Update Dependencies in Cargo.toml Source: https://github.com/lfdt-lockness/cggmp21/blob/cggmp24/m/CGGMP21_MIGRATION.md Update your Cargo.toml file to reflect the new dependency versions if you are using them directly. ```toml [dependencies] generic-ec = "0.5" # only if you're using key-share = "0.7" # them directly ``` -------------------------------- ### Update cggmp24 Dependency to Alpha.4 Source: https://github.com/lfdt-lockness/cggmp21/blob/cggmp24/m/CGGMP21_MIGRATION.md Update the version of the cggmp24 crate in your Cargo.toml to alpha.4. This is the final step in the update process described. ```toml [dependencies] cggmp24 = "0.7.0-alpha.4" ``` -------------------------------- ### Update cggmp24 Dependency to Alpha.3 Source: https://github.com/lfdt-lockness/cggmp21/blob/cggmp24/m/CGGMP21_MIGRATION.md Update the version of the cggmp24 crate in your Cargo.toml to alpha.3. This ensures you are using the latest features and fixes from this release. ```toml [dependencies] cggmp24 = "0.7.0-alpha.3" ``` -------------------------------- ### Commit with Signed-off Flag Source: https://github.com/lfdt-lockness/cggmp21/blob/cggmp24/m/CONTRIBUTING.md Automatically sign off your commits by including the '-s' flag during the commit process. ```bash git commit -s ``` -------------------------------- ### Sign Commits with DCO Source: https://github.com/lfdt-lockness/cggmp21/blob/cggmp24/m/CONTRIBUTING.md Use the '-s' flag with git commit to automatically sign off your commits, certifying compliance with the Developer Certificate of Origin (DCO). ```text Developer Certificate of Origin Version 1.1 Copyright (C) 2004, 2006 The Linux Foundation and its contributors. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Developer's Certificate of Origin 1.1 By making a contribution to this project, I certify that: (a) The contribution was created in whole or in part by me and I have the right to submit it under the open source license indicated in the file; or (b) The contribution is based upon previous work that, to the best of my knowledge, is covered under an appropriate open source license and I have the right under that license to submit that work with modifications, whether created in whole or in part by me, under the same open source license (unless I am permitted to submit under a different license), as indicated in the file; or (c) The contribution was provided directly to me by some other person who certified (a), (b) or (c) and I have not modified it. (d) I understand and agree that this project and the contribution are public and that a record of the contribution (including all personal information I submit with it, including my sign-off) is maintained indefinitely and may be redistributed consistent with this project or the open source license(s) involved. ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.