diff --git a/.github/workflows/cosigner.yml b/.github/workflows/cosigner.yml index 323ab591..147aa7b5 100644 --- a/.github/workflows/cosigner.yml +++ b/.github/workflows/cosigner.yml @@ -23,10 +23,7 @@ jobs: - name: Install Rust toolchain uses: dtolnay/rust-toolchain@stable with: - targets: wasm32-wasip1 - - - name: Install cargo-component - run: cargo install cargo-component + targets: wasm32-wasip2 - name: Cache cargo registry & build uses: actions/cache@v4 @@ -38,13 +35,13 @@ jobs: key: cosigner-${{ hashFiles('cosigner/Cargo.lock', 'crates/threshold/Cargo.toml', 'crates/ark/Cargo.toml') }} - name: Build cosigner WASM - run: cd cosigner && cargo component build --release + run: cd cosigner && cargo build --release --target wasm32-wasip2 - name: Upload WASM artifact uses: actions/upload-artifact@v4 with: name: cosigner-wasm - path: cosigner/target/wasm32-wasip1/release/cosigner.wasm + path: cosigner/target/wasm32-wasip2/release/cosigner.wasm retention-days: 90 release: diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index a8958029..73bd374c 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -19,14 +19,11 @@ jobs: - name: Install Rust toolchain uses: dtolnay/rust-toolchain@stable with: - targets: wasm32-wasip1 + targets: wasm32-wasip2 - name: Install protoc run: sudo apt-get update && sudo apt-get install -y protobuf-compiler - - name: Install cargo-component - run: cargo install cargo-component - - name: Cache cargo uses: actions/cache@v4 with: @@ -43,7 +40,7 @@ jobs: - name: Build all run: | cargo build --release --manifest-path ffi/Cargo.toml - (cd cosigner && cargo component build --release) + (cd cosigner && cargo build --release --target wasm32-wasip2) cargo build --release --manifest-path cosigner-runtime/Cargo.toml cargo build --release --manifest-path e2e/signer-server/Cargo.toml @@ -54,7 +51,7 @@ jobs: retention-days: 1 path: | ffi/target/release/libmpcwallet_ffi.so - cosigner/target/wasm32-wasip1/release/cosigner.wasm + cosigner/target/wasm32-wasip2/release/cosigner.wasm cosigner-runtime/target/release/cosigner-runtime e2e/signer-server/target/release/signer-server diff --git a/.github/workflows/flutter-integration.yml b/.github/workflows/flutter-integration.yml index 58db51e6..def15abc 100644 --- a/.github/workflows/flutter-integration.yml +++ b/.github/workflows/flutter-integration.yml @@ -27,14 +27,11 @@ jobs: - name: Install Rust toolchain uses: dtolnay/rust-toolchain@stable with: - targets: wasm32-wasip1,x86_64-linux-android + targets: wasm32-wasip2,x86_64-linux-android - name: Install protoc run: sudo apt-get update && sudo apt-get install -y protobuf-compiler - - name: Install cargo-component - run: cargo install cargo-component - - name: Cache cargo uses: actions/cache@v4 with: @@ -75,7 +72,7 @@ jobs: - name: Build MPCWallet host binaries run: | cargo build --release --manifest-path cosigner-runtime/Cargo.toml - (cd cosigner && cargo component build --release) + (cd cosigner && cargo build --release --target wasm32-wasip2) cargo build --release --manifest-path e2e/signer-server/Cargo.toml - name: Build FFI for Android x86_64 @@ -124,7 +121,7 @@ jobs: ASP_URL: http://127.0.0.1:7070 run: | nohup cosigner-runtime/target/release/cosigner-runtime \ - --wasm cosigner/target/wasm32-wasip1/release/cosigner.wasm \ + --wasm cosigner/target/wasm32-wasip2/release/cosigner.wasm \ --port 7074 > /tmp/cosigner-runtime.log 2>&1 & sleep 3 curl -sS http://127.0.0.1:7074/health || curl -sS http://127.0.0.1:7074/ || true diff --git a/.vscode/settings.json b/.vscode/settings.json index 5a1443b5..9ac4292d 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,5 +1,6 @@ { "rust-analyzer.linkedProjects": [ + "cosigner/Cargo.toml", "cosigner-runtime/Cargo.toml", "crates/threshold/Cargo.toml", "crates/ark/Cargo.toml", diff --git a/Makefile b/Makefile index 860c8f4b..3bd22b12 100644 --- a/Makefile +++ b/Makefile @@ -102,7 +102,7 @@ software: regtest-up bitcoin-init adb-reverse cosigner-build runtime-build ffi-b export ELECTRUM_URL=127.0.0.1 ELECTRUM_PORT=50001 \ BITCOIN_RPC_USER=admin1 BITCOIN_RPC_PASSWORD=123; \ cd cosigner-runtime && cargo run --release --bin cosigner-runtime -- \ - --wasm ../cosigner/target/wasm32-wasip1/release/cosigner.wasm \ + --wasm ../cosigner/target/wasm32-wasip2/release/cosigner.wasm \ --port 7074' # 3b) Start regtest + arkd for SOFTWARE signer (no USB device required) — Ark enabled @@ -144,7 +144,7 @@ software-ark: cosigner-build runtime-build ffi-build ffi-android ASP_URL=http://127.0.0.1:7070 \ FCM_SERVICE_ACCOUNT_JSON="$$(cat $${FCM_SA_FILE:-$$HOME/Downloads/vtxos-key.json} 2>/dev/null)"; \ cd cosigner-runtime && cargo run --release --bin cosigner-runtime -- \ - --wasm ../cosigner/target/wasm32-wasip1/release/cosigner.wasm \ + --wasm ../cosigner/target/wasm32-wasip2/release/cosigner.wasm \ --port 7074' # 4) Start regtest for hardware device (no Ark) — server runs in foreground @@ -161,7 +161,7 @@ hardware: regtest-up bitcoin-init adb-reverse cosigner-build runtime-build ffi-b export ELECTRUM_URL=127.0.0.1 ELECTRUM_PORT=50001 \ BITCOIN_RPC_USER=admin1 BITCOIN_RPC_PASSWORD=123; \ cd cosigner-runtime && cargo run --release --bin cosigner-runtime -- \ - --wasm ../cosigner/target/wasm32-wasip1/release/cosigner.wasm \ + --wasm ../cosigner/target/wasm32-wasip2/release/cosigner.wasm \ --port 7074' # 5) Start regtest for hardware device with Ark — server runs in foreground @@ -189,7 +189,7 @@ hardware-ark: cosigner-build runtime-build ffi-build ffi-android BITCOIN_RPC_USER=admin1 BITCOIN_RPC_PASSWORD=123 \ ASP_URL=http://127.0.0.1:7070; \ cd cosigner-runtime && cargo run --release --bin cosigner-runtime -- \ - --wasm ../cosigner/target/wasm32-wasip1/release/cosigner.wasm \ + --wasm ../cosigner/target/wasm32-wasip2/release/cosigner.wasm \ --port 7074' # 5) Stop everything (server, signer, mine loop, Docker) @@ -337,8 +337,8 @@ threshold-ffi-test: ffi-test # Server & cosigner cosigner-build: @echo "Building cosigner WASM component..." - cd cosigner && cargo component build --release - @echo "Built: cosigner/target/wasm32-wasip1/release/cosigner.wasm" + cd cosigner && cargo build --release --target wasm32-wasip2 + @echo "Built: cosigner/target/wasm32-wasip2/release/cosigner.wasm" runtime-build: @echo "Building server..." @@ -391,7 +391,7 @@ runtime-run: cosigner-build runtime-build export BITCOIN_RPC_USER=admin1 && \ export BITCOIN_RPC_PASSWORD=123 && \ cd cosigner-runtime && cargo run --release --bin cosigner-runtime -- \ - --wasm ../cosigner/target/wasm32-wasip1/release/cosigner.wasm \ + --wasm ../cosigner/target/wasm32-wasip2/release/cosigner.wasm \ --port 7074 & @sleep 2 @echo "MPC Wallet Server running in background." @@ -485,7 +485,7 @@ signet-hardware-ark: cosigner-build runtime-build ffi-build ffi-android export BITCOIN_NETWORK=signet && \ export ASP_URL=$(MUTINYNET_ASP_URL) && \ cd cosigner-runtime && cargo run --release --bin cosigner-runtime -- \ - --wasm ../cosigner/target/wasm32-wasip1/release/cosigner.wasm \ + --wasm ../cosigner/target/wasm32-wasip2/release/cosigner.wasm \ --port 7074 signet-down: @@ -538,7 +538,7 @@ integration-test-ci-ark: runtime-stop signer-stop arkd-up bitcoin-init arkd-init BITCOIN_RPC_USER=admin1 BITCOIN_RPC_PASSWORD=123 \ ASP_URL=http://127.0.0.1:7070 && \ cd cosigner-runtime && cargo run --release --bin cosigner-runtime -- \ - --wasm ../cosigner/target/wasm32-wasip1/release/cosigner.wasm \ + --wasm ../cosigner/target/wasm32-wasip2/release/cosigner.wasm \ --port 7074 & @sleep 5 cd app && flutter pub get && \ diff --git a/README.md b/README.md index c635db34..17161a6d 100644 --- a/README.md +++ b/README.md @@ -91,7 +91,7 @@ Handlers run inside `spawn_blocking` so CPU-bound WASM work (FROST round1, DKG p ### Inner layer: WASM sandbox per user -Threshold cryptography (FROST, DKG, Schnorr verify, Taproot tweaking) lives entirely inside [`cosigner/`](cosigner/), a WASI Component Model crate compiled to `wasm32-wasip1`. The Rust runtime never sees raw secret shares — only opaque session handles into the WASM linear memory. +Threshold cryptography (FROST, DKG, Schnorr verify, Taproot tweaking) lives entirely inside [`cosigner/`](cosigner/), a WASI Component Model crate compiled to `wasm32-wasip2`. The Rust runtime never sees raw secret shares — only opaque session handles into the WASM linear memory. Each user actor instantiates the cosigner component into a fresh `wasmtime::Store`: @@ -200,7 +200,7 @@ High-level Dart API that orchestrates the full MPC protocol: drives DKG, signing ### Threshold library ([crates/threshold/](crates/threshold/)) -`#![no_std]` Rust implementation of FROST over secp256k1. Includes the full 3-round DKG, Pedersen VSS, nonce commitments, signature share computation, Lagrange interpolation, Taproot key tweaking, and key refresh. Compiles for four targets: native Rust, `wasm32-wasip1` (cosigner WASM), `thumbv8m.main-none-eabihf` (HW signer Secure world), and Dart FFI. +`#![no_std]` Rust implementation of FROST over secp256k1. Includes the full 3-round DKG, Pedersen VSS, nonce commitments, signature share computation, Lagrange interpolation, Taproot key tweaking, and key refresh. Compiles for four targets: native Rust, `wasm32-wasip2` (cosigner WASM), `thumbv8m.main-none-eabihf` (HW signer Secure world), and Dart FFI. ## Build & Run @@ -215,12 +215,11 @@ High-level Dart API that orchestrates the full MPC protocol: drives DKG, signing ```bash # Rust targets the runtime + cosigner need -rustup target add wasm32-wasip1 # cosigner WASM +rustup target add wasm32-wasip2 # cosigner WASM rustup target add aarch64-linux-android # FFI for Android arm64 rustup target add thumbv8m.main-none-eabihf # HW signer (only if needed) rustup toolchain install nightly # TrustZone CMSE features (HW signer only) -cargo install cargo-component # WASI component building cargo install probe-rs-tools # only for HW signer flashing ``` diff --git a/cosigner-runtime/src/config.rs b/cosigner-runtime/src/config.rs index 414c7b24..5f980e39 100644 --- a/cosigner-runtime/src/config.rs +++ b/cosigner-runtime/src/config.rs @@ -68,7 +68,7 @@ impl ServerConfig { .unwrap_or_else(|_| "http://127.0.0.1:8080".to_string()), enclave_mgmt_token: env::var("ENCLAVE_RUNTIME_TOKEN").unwrap_or_default(), cosigner_wasm_path: env::var("COSIGNER_WASM_PATH").unwrap_or_else(|_| { - "../cosigner/target/wasm32-wasip1/release/cosigner.wasm".to_string() + "../cosigner/target/wasm32-wasip2/release/cosigner.wasm".to_string() }), auto_settle_safety_margin_secs: env::var("AUTO_SETTLE_SAFETY_MARGIN_SECS") .ok() diff --git a/cosigner-runtime/tests/isolation_test.rs b/cosigner-runtime/tests/isolation_test.rs index f5c083f8..0ff1c149 100644 --- a/cosigner-runtime/tests/isolation_test.rs +++ b/cosigner-runtime/tests/isolation_test.rs @@ -35,7 +35,7 @@ fn wasm_path() -> PathBuf { manifest_dir .parent() .unwrap() - .join("cosigner/target/wasm32-wasip1/release/cosigner.wasm") + .join("cosigner/target/wasm32-wasip2/release/cosigner.wasm") } fn create_instance( diff --git a/cosigner/.cargo/config.toml b/cosigner/.cargo/config.toml new file mode 100644 index 00000000..32452a07 --- /dev/null +++ b/cosigner/.cargo/config.toml @@ -0,0 +1,5 @@ +# The cosigner is a WASI Component Model crate. Building for wasm32-wasip2 lets +# rustc emit the component directly via wasm-component-ld — no `cargo component` +# step. Setting the target here also drives rust-analyzer's analysis of this crate. +[build] +target = "wasm32-wasip2" diff --git a/cosigner/Cargo.lock b/cosigner/Cargo.lock index 076d9e5b..a2c36c56 100644 --- a/cosigner/Cargo.lock +++ b/cosigner/Cargo.lock @@ -88,7 +88,6 @@ dependencies = [ "serde_json", "threshold", "wit-bindgen", - "wit-bindgen-rt", ] [[package]] diff --git a/cosigner/Cargo.toml b/cosigner/Cargo.toml index 24f17294..f5f3b92c 100644 --- a/cosigner/Cargo.toml +++ b/cosigner/Cargo.toml @@ -10,13 +10,6 @@ crate-type = ["cdylib"] threshold = { path = "../crates/threshold", features = ["std"] } ark = { path = "../crates/ark", features = ["std"] } wit-bindgen = "0.41" -wit-bindgen-rt = "0.41" serde_json = "1" rand = "0.8" k256 = { version = "0.13", features = ["arithmetic"] } - -[package.metadata.component] -package = "component:threshold" - -[package.metadata.component.target] -world = "threshold-world" diff --git a/cosigner/src/ark_ops.rs b/cosigner/src/ark_ops.rs index 1cba744c..9feb2f86 100644 --- a/cosigner/src/ark_ops.rs +++ b/cosigner/src/ark_ops.rs @@ -1,6 +1,6 @@ //! Ark protocol WASM operations. -use crate::bindings::exports::component::threshold::types::ThresholdError; +use crate::exports::component::threshold::types::ThresholdError; use crate::convert; pub fn ark_default_vtxo_script_pubkey( diff --git a/cosigner/src/auth_ops.rs b/cosigner/src/auth_ops.rs index 37ca7f5b..34a414d0 100644 --- a/cosigner/src/auth_ops.rs +++ b/cosigner/src/auth_ops.rs @@ -2,7 +2,7 @@ use threshold::auth; -use crate::bindings::exports::component::threshold::types::ThresholdError; +use crate::exports::component::threshold::types::ThresholdError; use crate::convert; pub fn verify_schnorr_signature( diff --git a/cosigner/src/bindings.rs b/cosigner/src/bindings.rs deleted file mode 100644 index f919a110..00000000 --- a/cosigner/src/bindings.rs +++ /dev/null @@ -1,8490 +0,0 @@ -// Generated by `wit-bindgen` 0.41.0. DO NOT EDIT! -// Options used: -// * runtime_path: "wit_bindgen_rt" -#[rustfmt::skip] -#[allow(dead_code, clippy::all)] -pub mod exports { - pub mod component { - pub mod threshold { - #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)] - pub mod types { - #[used] - #[doc(hidden)] - static __FORCE_SECTION_REF: fn() = super::super::super::super::__link_custom_section_describing_imports; - use super::super::super::super::_rt; - /// Error type for threshold operations. - #[derive(Clone)] - pub enum ThresholdError { - InvalidInput(_rt::String), - CryptoError(_rt::String), - SerializationError(_rt::String), - } - impl ::core::fmt::Debug for ThresholdError { - fn fmt( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - match self { - ThresholdError::InvalidInput(e) => { - f.debug_tuple("ThresholdError::InvalidInput") - .field(e) - .finish() - } - ThresholdError::CryptoError(e) => { - f.debug_tuple("ThresholdError::CryptoError") - .field(e) - .finish() - } - ThresholdError::SerializationError(e) => { - f.debug_tuple("ThresholdError::SerializationError") - .field(e) - .finish() - } - } - } - } - impl ::core::fmt::Display for ThresholdError { - fn fmt( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - write!(f, "{:?}", self) - } - } - impl std::error::Error for ThresholdError {} - /// Opaque handle for DKG round 1 secret state. - #[derive(Debug)] - #[repr(transparent)] - pub struct Round1Secret { - handle: _rt::Resource, - } - type _Round1SecretRep = Option; - impl Round1Secret { - /// Creates a new resource from the specified representation. - /// - /// This function will create a new resource handle by moving `val` onto - /// the heap and then passing that heap pointer to the component model to - /// create a handle. The owned handle is then returned as `Round1Secret`. - pub fn new(val: T) -> Self { - Self::type_guard::(); - let val: _Round1SecretRep = Some(val); - let ptr: *mut _Round1SecretRep = _rt::Box::into_raw( - _rt::Box::new(val), - ); - unsafe { Self::from_handle(T::_resource_new(ptr.cast())) } - } - /// Gets access to the underlying `T` which represents this resource. - pub fn get(&self) -> &T { - let ptr = unsafe { &*self.as_ptr::() }; - ptr.as_ref().unwrap() - } - /// Gets mutable access to the underlying `T` which represents this - /// resource. - pub fn get_mut(&mut self) -> &mut T { - let ptr = unsafe { &mut *self.as_ptr::() }; - ptr.as_mut().unwrap() - } - /// Consumes this resource and returns the underlying `T`. - pub fn into_inner(self) -> T { - let ptr = unsafe { &mut *self.as_ptr::() }; - ptr.take().unwrap() - } - #[doc(hidden)] - pub unsafe fn from_handle(handle: u32) -> Self { - Self { - handle: unsafe { _rt::Resource::from_handle(handle) }, - } - } - #[doc(hidden)] - pub fn take_handle(&self) -> u32 { - _rt::Resource::take_handle(&self.handle) - } - #[doc(hidden)] - pub fn handle(&self) -> u32 { - _rt::Resource::handle(&self.handle) - } - #[doc(hidden)] - fn type_guard() { - use core::any::TypeId; - static mut LAST_TYPE: Option = None; - unsafe { - assert!(! cfg!(target_feature = "atomics")); - let id = TypeId::of::(); - match LAST_TYPE { - Some(ty) => { - assert!( - ty == id, "cannot use two types with this resource type" - ) - } - None => LAST_TYPE = Some(id), - } - } - } - #[doc(hidden)] - pub unsafe fn dtor(handle: *mut u8) { - Self::type_guard::(); - let _ = unsafe { - _rt::Box::from_raw(handle as *mut _Round1SecretRep) - }; - } - fn as_ptr(&self) -> *mut _Round1SecretRep { - Round1Secret::type_guard::(); - T::_resource_rep(self.handle()).cast() - } - } - /// A borrowed version of [`Round1Secret`] which represents a borrowed value - /// with the lifetime `'a`. - #[derive(Debug)] - #[repr(transparent)] - pub struct Round1SecretBorrow<'a> { - rep: *mut u8, - _marker: core::marker::PhantomData<&'a Round1Secret>, - } - impl<'a> Round1SecretBorrow<'a> { - #[doc(hidden)] - pub unsafe fn lift(rep: usize) -> Self { - Self { - rep: rep as *mut u8, - _marker: core::marker::PhantomData, - } - } - /// Gets access to the underlying `T` in this resource. - pub fn get(&self) -> &T { - let ptr = unsafe { &mut *self.as_ptr::() }; - ptr.as_ref().unwrap() - } - fn as_ptr(&self) -> *mut _Round1SecretRep { - Round1Secret::type_guard::(); - self.rep.cast() - } - } - unsafe impl _rt::WasmResource for Round1Secret { - #[inline] - unsafe fn drop(_handle: u32) { - #[cfg(not(target_arch = "wasm32"))] - unreachable!(); - #[cfg(target_arch = "wasm32")] - { - #[link( - wasm_import_module = "[export]component:threshold/types@0.1.0" - )] - unsafe extern "C" { - #[link_name = "[resource-drop]round1-secret"] - fn drop(_: u32); - } - unsafe { drop(_handle) }; - } - } - } - /// Opaque handle for DKG round 2 secret state. - #[derive(Debug)] - #[repr(transparent)] - pub struct Round2Secret { - handle: _rt::Resource, - } - type _Round2SecretRep = Option; - impl Round2Secret { - /// Creates a new resource from the specified representation. - /// - /// This function will create a new resource handle by moving `val` onto - /// the heap and then passing that heap pointer to the component model to - /// create a handle. The owned handle is then returned as `Round2Secret`. - pub fn new(val: T) -> Self { - Self::type_guard::(); - let val: _Round2SecretRep = Some(val); - let ptr: *mut _Round2SecretRep = _rt::Box::into_raw( - _rt::Box::new(val), - ); - unsafe { Self::from_handle(T::_resource_new(ptr.cast())) } - } - /// Gets access to the underlying `T` which represents this resource. - pub fn get(&self) -> &T { - let ptr = unsafe { &*self.as_ptr::() }; - ptr.as_ref().unwrap() - } - /// Gets mutable access to the underlying `T` which represents this - /// resource. - pub fn get_mut(&mut self) -> &mut T { - let ptr = unsafe { &mut *self.as_ptr::() }; - ptr.as_mut().unwrap() - } - /// Consumes this resource and returns the underlying `T`. - pub fn into_inner(self) -> T { - let ptr = unsafe { &mut *self.as_ptr::() }; - ptr.take().unwrap() - } - #[doc(hidden)] - pub unsafe fn from_handle(handle: u32) -> Self { - Self { - handle: unsafe { _rt::Resource::from_handle(handle) }, - } - } - #[doc(hidden)] - pub fn take_handle(&self) -> u32 { - _rt::Resource::take_handle(&self.handle) - } - #[doc(hidden)] - pub fn handle(&self) -> u32 { - _rt::Resource::handle(&self.handle) - } - #[doc(hidden)] - fn type_guard() { - use core::any::TypeId; - static mut LAST_TYPE: Option = None; - unsafe { - assert!(! cfg!(target_feature = "atomics")); - let id = TypeId::of::(); - match LAST_TYPE { - Some(ty) => { - assert!( - ty == id, "cannot use two types with this resource type" - ) - } - None => LAST_TYPE = Some(id), - } - } - } - #[doc(hidden)] - pub unsafe fn dtor(handle: *mut u8) { - Self::type_guard::(); - let _ = unsafe { - _rt::Box::from_raw(handle as *mut _Round2SecretRep) - }; - } - fn as_ptr(&self) -> *mut _Round2SecretRep { - Round2Secret::type_guard::(); - T::_resource_rep(self.handle()).cast() - } - } - /// A borrowed version of [`Round2Secret`] which represents a borrowed value - /// with the lifetime `'a`. - #[derive(Debug)] - #[repr(transparent)] - pub struct Round2SecretBorrow<'a> { - rep: *mut u8, - _marker: core::marker::PhantomData<&'a Round2Secret>, - } - impl<'a> Round2SecretBorrow<'a> { - #[doc(hidden)] - pub unsafe fn lift(rep: usize) -> Self { - Self { - rep: rep as *mut u8, - _marker: core::marker::PhantomData, - } - } - /// Gets access to the underlying `T` in this resource. - pub fn get(&self) -> &T { - let ptr = unsafe { &mut *self.as_ptr::() }; - ptr.as_ref().unwrap() - } - fn as_ptr(&self) -> *mut _Round2SecretRep { - Round2Secret::type_guard::(); - self.rep.cast() - } - } - unsafe impl _rt::WasmResource for Round2Secret { - #[inline] - unsafe fn drop(_handle: u32) { - #[cfg(not(target_arch = "wasm32"))] - unreachable!(); - #[cfg(target_arch = "wasm32")] - { - #[link( - wasm_import_module = "[export]component:threshold/types@0.1.0" - )] - unsafe extern "C" { - #[link_name = "[resource-drop]round2-secret"] - fn drop(_: u32); - } - unsafe { drop(_handle) }; - } - } - } - /// Opaque handle for a signing nonce (single-use). - #[derive(Debug)] - #[repr(transparent)] - pub struct SigningNonce { - handle: _rt::Resource, - } - type _SigningNonceRep = Option; - impl SigningNonce { - /// Creates a new resource from the specified representation. - /// - /// This function will create a new resource handle by moving `val` onto - /// the heap and then passing that heap pointer to the component model to - /// create a handle. The owned handle is then returned as `SigningNonce`. - pub fn new(val: T) -> Self { - Self::type_guard::(); - let val: _SigningNonceRep = Some(val); - let ptr: *mut _SigningNonceRep = _rt::Box::into_raw( - _rt::Box::new(val), - ); - unsafe { Self::from_handle(T::_resource_new(ptr.cast())) } - } - /// Gets access to the underlying `T` which represents this resource. - pub fn get(&self) -> &T { - let ptr = unsafe { &*self.as_ptr::() }; - ptr.as_ref().unwrap() - } - /// Gets mutable access to the underlying `T` which represents this - /// resource. - pub fn get_mut(&mut self) -> &mut T { - let ptr = unsafe { &mut *self.as_ptr::() }; - ptr.as_mut().unwrap() - } - /// Consumes this resource and returns the underlying `T`. - pub fn into_inner(self) -> T { - let ptr = unsafe { &mut *self.as_ptr::() }; - ptr.take().unwrap() - } - #[doc(hidden)] - pub unsafe fn from_handle(handle: u32) -> Self { - Self { - handle: unsafe { _rt::Resource::from_handle(handle) }, - } - } - #[doc(hidden)] - pub fn take_handle(&self) -> u32 { - _rt::Resource::take_handle(&self.handle) - } - #[doc(hidden)] - pub fn handle(&self) -> u32 { - _rt::Resource::handle(&self.handle) - } - #[doc(hidden)] - fn type_guard() { - use core::any::TypeId; - static mut LAST_TYPE: Option = None; - unsafe { - assert!(! cfg!(target_feature = "atomics")); - let id = TypeId::of::(); - match LAST_TYPE { - Some(ty) => { - assert!( - ty == id, "cannot use two types with this resource type" - ) - } - None => LAST_TYPE = Some(id), - } - } - } - #[doc(hidden)] - pub unsafe fn dtor(handle: *mut u8) { - Self::type_guard::(); - let _ = unsafe { - _rt::Box::from_raw(handle as *mut _SigningNonceRep) - }; - } - fn as_ptr(&self) -> *mut _SigningNonceRep { - SigningNonce::type_guard::(); - T::_resource_rep(self.handle()).cast() - } - } - /// A borrowed version of [`SigningNonce`] which represents a borrowed value - /// with the lifetime `'a`. - #[derive(Debug)] - #[repr(transparent)] - pub struct SigningNonceBorrow<'a> { - rep: *mut u8, - _marker: core::marker::PhantomData<&'a SigningNonce>, - } - impl<'a> SigningNonceBorrow<'a> { - #[doc(hidden)] - pub unsafe fn lift(rep: usize) -> Self { - Self { - rep: rep as *mut u8, - _marker: core::marker::PhantomData, - } - } - /// Gets access to the underlying `T` in this resource. - pub fn get(&self) -> &T { - let ptr = unsafe { &mut *self.as_ptr::() }; - ptr.as_ref().unwrap() - } - fn as_ptr(&self) -> *mut _SigningNonceRep { - SigningNonce::type_guard::(); - self.rep.cast() - } - } - unsafe impl _rt::WasmResource for SigningNonce { - #[inline] - unsafe fn drop(_handle: u32) { - #[cfg(not(target_arch = "wasm32"))] - unreachable!(); - #[cfg(target_arch = "wasm32")] - { - #[link( - wasm_import_module = "[export]component:threshold/types@0.1.0" - )] - unsafe extern "C" { - #[link_name = "[resource-drop]signing-nonce"] - fn drop(_: u32); - } - unsafe { drop(_handle) }; - } - } - } - /// ----------------------------------------------------------------------- - /// Session state resources — all user data lives in WASM linear memory - /// ----------------------------------------------------------------------- - /// DKG session state: round packages, identifiers, server state, relay. - #[derive(Debug)] - #[repr(transparent)] - pub struct DkgSession { - handle: _rt::Resource, - } - type _DkgSessionRep = Option; - impl DkgSession { - /// Creates a new resource from the specified representation. - /// - /// This function will create a new resource handle by moving `val` onto - /// the heap and then passing that heap pointer to the component model to - /// create a handle. The owned handle is then returned as `DkgSession`. - pub fn new(val: T) -> Self { - Self::type_guard::(); - let val: _DkgSessionRep = Some(val); - let ptr: *mut _DkgSessionRep = _rt::Box::into_raw( - _rt::Box::new(val), - ); - unsafe { Self::from_handle(T::_resource_new(ptr.cast())) } - } - /// Gets access to the underlying `T` which represents this resource. - pub fn get(&self) -> &T { - let ptr = unsafe { &*self.as_ptr::() }; - ptr.as_ref().unwrap() - } - /// Gets mutable access to the underlying `T` which represents this - /// resource. - pub fn get_mut(&mut self) -> &mut T { - let ptr = unsafe { &mut *self.as_ptr::() }; - ptr.as_mut().unwrap() - } - /// Consumes this resource and returns the underlying `T`. - pub fn into_inner(self) -> T { - let ptr = unsafe { &mut *self.as_ptr::() }; - ptr.take().unwrap() - } - #[doc(hidden)] - pub unsafe fn from_handle(handle: u32) -> Self { - Self { - handle: unsafe { _rt::Resource::from_handle(handle) }, - } - } - #[doc(hidden)] - pub fn take_handle(&self) -> u32 { - _rt::Resource::take_handle(&self.handle) - } - #[doc(hidden)] - pub fn handle(&self) -> u32 { - _rt::Resource::handle(&self.handle) - } - #[doc(hidden)] - fn type_guard() { - use core::any::TypeId; - static mut LAST_TYPE: Option = None; - unsafe { - assert!(! cfg!(target_feature = "atomics")); - let id = TypeId::of::(); - match LAST_TYPE { - Some(ty) => { - assert!( - ty == id, "cannot use two types with this resource type" - ) - } - None => LAST_TYPE = Some(id), - } - } - } - #[doc(hidden)] - pub unsafe fn dtor(handle: *mut u8) { - Self::type_guard::(); - let _ = unsafe { - _rt::Box::from_raw(handle as *mut _DkgSessionRep) - }; - } - fn as_ptr(&self) -> *mut _DkgSessionRep { - DkgSession::type_guard::(); - T::_resource_rep(self.handle()).cast() - } - } - /// A borrowed version of [`DkgSession`] which represents a borrowed value - /// with the lifetime `'a`. - #[derive(Debug)] - #[repr(transparent)] - pub struct DkgSessionBorrow<'a> { - rep: *mut u8, - _marker: core::marker::PhantomData<&'a DkgSession>, - } - impl<'a> DkgSessionBorrow<'a> { - #[doc(hidden)] - pub unsafe fn lift(rep: usize) -> Self { - Self { - rep: rep as *mut u8, - _marker: core::marker::PhantomData, - } - } - /// Gets access to the underlying `T` in this resource. - pub fn get(&self) -> &T { - let ptr = unsafe { &mut *self.as_ptr::() }; - ptr.as_ref().unwrap() - } - fn as_ptr(&self) -> *mut _DkgSessionRep { - DkgSession::type_guard::(); - self.rep.cast() - } - } - unsafe impl _rt::WasmResource for DkgSession { - #[inline] - unsafe fn drop(_handle: u32) { - #[cfg(not(target_arch = "wasm32"))] - unreachable!(); - #[cfg(target_arch = "wasm32")] - { - #[link( - wasm_import_module = "[export]component:threshold/types@0.1.0" - )] - unsafe extern "C" { - #[link_name = "[resource-drop]dkg-session"] - fn drop(_: u32); - } - unsafe { drop(_handle) }; - } - } - } - /// Signing session state: commitments, shares, message, policy metadata. - #[derive(Debug)] - #[repr(transparent)] - pub struct SigningSession { - handle: _rt::Resource, - } - type _SigningSessionRep = Option; - impl SigningSession { - /// Creates a new resource from the specified representation. - /// - /// This function will create a new resource handle by moving `val` onto - /// the heap and then passing that heap pointer to the component model to - /// create a handle. The owned handle is then returned as `SigningSession`. - pub fn new(val: T) -> Self { - Self::type_guard::(); - let val: _SigningSessionRep = Some(val); - let ptr: *mut _SigningSessionRep = _rt::Box::into_raw( - _rt::Box::new(val), - ); - unsafe { Self::from_handle(T::_resource_new(ptr.cast())) } - } - /// Gets access to the underlying `T` which represents this resource. - pub fn get(&self) -> &T { - let ptr = unsafe { &*self.as_ptr::() }; - ptr.as_ref().unwrap() - } - /// Gets mutable access to the underlying `T` which represents this - /// resource. - pub fn get_mut(&mut self) -> &mut T { - let ptr = unsafe { &mut *self.as_ptr::() }; - ptr.as_mut().unwrap() - } - /// Consumes this resource and returns the underlying `T`. - pub fn into_inner(self) -> T { - let ptr = unsafe { &mut *self.as_ptr::() }; - ptr.take().unwrap() - } - #[doc(hidden)] - pub unsafe fn from_handle(handle: u32) -> Self { - Self { - handle: unsafe { _rt::Resource::from_handle(handle) }, - } - } - #[doc(hidden)] - pub fn take_handle(&self) -> u32 { - _rt::Resource::take_handle(&self.handle) - } - #[doc(hidden)] - pub fn handle(&self) -> u32 { - _rt::Resource::handle(&self.handle) - } - #[doc(hidden)] - fn type_guard() { - use core::any::TypeId; - static mut LAST_TYPE: Option = None; - unsafe { - assert!(! cfg!(target_feature = "atomics")); - let id = TypeId::of::(); - match LAST_TYPE { - Some(ty) => { - assert!( - ty == id, "cannot use two types with this resource type" - ) - } - None => LAST_TYPE = Some(id), - } - } - } - #[doc(hidden)] - pub unsafe fn dtor(handle: *mut u8) { - Self::type_guard::(); - let _ = unsafe { - _rt::Box::from_raw(handle as *mut _SigningSessionRep) - }; - } - fn as_ptr( - &self, - ) -> *mut _SigningSessionRep { - SigningSession::type_guard::(); - T::_resource_rep(self.handle()).cast() - } - } - /// A borrowed version of [`SigningSession`] which represents a borrowed value - /// with the lifetime `'a`. - #[derive(Debug)] - #[repr(transparent)] - pub struct SigningSessionBorrow<'a> { - rep: *mut u8, - _marker: core::marker::PhantomData<&'a SigningSession>, - } - impl<'a> SigningSessionBorrow<'a> { - #[doc(hidden)] - pub unsafe fn lift(rep: usize) -> Self { - Self { - rep: rep as *mut u8, - _marker: core::marker::PhantomData, - } - } - /// Gets access to the underlying `T` in this resource. - pub fn get(&self) -> &T { - let ptr = unsafe { &mut *self.as_ptr::() }; - ptr.as_ref().unwrap() - } - fn as_ptr(&self) -> *mut _SigningSessionRep { - SigningSession::type_guard::(); - self.rep.cast() - } - } - unsafe impl _rt::WasmResource for SigningSession { - #[inline] - unsafe fn drop(_handle: u32) { - #[cfg(not(target_arch = "wasm32"))] - unreachable!(); - #[cfg(target_arch = "wasm32")] - { - #[link( - wasm_import_module = "[export]component:threshold/types@0.1.0" - )] - unsafe extern "C" { - #[link_name = "[resource-drop]signing-session"] - fn drop(_: u32); - } - unsafe { drop(_handle) }; - } - } - } - /// Refresh (re-DKG) session state: round packages, relay, policy metadata. - #[derive(Debug)] - #[repr(transparent)] - pub struct RefreshSession { - handle: _rt::Resource, - } - type _RefreshSessionRep = Option; - impl RefreshSession { - /// Creates a new resource from the specified representation. - /// - /// This function will create a new resource handle by moving `val` onto - /// the heap and then passing that heap pointer to the component model to - /// create a handle. The owned handle is then returned as `RefreshSession`. - pub fn new(val: T) -> Self { - Self::type_guard::(); - let val: _RefreshSessionRep = Some(val); - let ptr: *mut _RefreshSessionRep = _rt::Box::into_raw( - _rt::Box::new(val), - ); - unsafe { Self::from_handle(T::_resource_new(ptr.cast())) } - } - /// Gets access to the underlying `T` which represents this resource. - pub fn get(&self) -> &T { - let ptr = unsafe { &*self.as_ptr::() }; - ptr.as_ref().unwrap() - } - /// Gets mutable access to the underlying `T` which represents this - /// resource. - pub fn get_mut(&mut self) -> &mut T { - let ptr = unsafe { &mut *self.as_ptr::() }; - ptr.as_mut().unwrap() - } - /// Consumes this resource and returns the underlying `T`. - pub fn into_inner(self) -> T { - let ptr = unsafe { &mut *self.as_ptr::() }; - ptr.take().unwrap() - } - #[doc(hidden)] - pub unsafe fn from_handle(handle: u32) -> Self { - Self { - handle: unsafe { _rt::Resource::from_handle(handle) }, - } - } - #[doc(hidden)] - pub fn take_handle(&self) -> u32 { - _rt::Resource::take_handle(&self.handle) - } - #[doc(hidden)] - pub fn handle(&self) -> u32 { - _rt::Resource::handle(&self.handle) - } - #[doc(hidden)] - fn type_guard() { - use core::any::TypeId; - static mut LAST_TYPE: Option = None; - unsafe { - assert!(! cfg!(target_feature = "atomics")); - let id = TypeId::of::(); - match LAST_TYPE { - Some(ty) => { - assert!( - ty == id, "cannot use two types with this resource type" - ) - } - None => LAST_TYPE = Some(id), - } - } - } - #[doc(hidden)] - pub unsafe fn dtor(handle: *mut u8) { - Self::type_guard::(); - let _ = unsafe { - _rt::Box::from_raw(handle as *mut _RefreshSessionRep) - }; - } - fn as_ptr( - &self, - ) -> *mut _RefreshSessionRep { - RefreshSession::type_guard::(); - T::_resource_rep(self.handle()).cast() - } - } - /// A borrowed version of [`RefreshSession`] which represents a borrowed value - /// with the lifetime `'a`. - #[derive(Debug)] - #[repr(transparent)] - pub struct RefreshSessionBorrow<'a> { - rep: *mut u8, - _marker: core::marker::PhantomData<&'a RefreshSession>, - } - impl<'a> RefreshSessionBorrow<'a> { - #[doc(hidden)] - pub unsafe fn lift(rep: usize) -> Self { - Self { - rep: rep as *mut u8, - _marker: core::marker::PhantomData, - } - } - /// Gets access to the underlying `T` in this resource. - pub fn get(&self) -> &T { - let ptr = unsafe { &mut *self.as_ptr::() }; - ptr.as_ref().unwrap() - } - fn as_ptr(&self) -> *mut _RefreshSessionRep { - RefreshSession::type_guard::(); - self.rep.cast() - } - } - unsafe impl _rt::WasmResource for RefreshSession { - #[inline] - unsafe fn drop(_handle: u32) { - #[cfg(not(target_arch = "wasm32"))] - unreachable!(); - #[cfg(target_arch = "wasm32")] - { - #[link( - wasm_import_module = "[export]component:threshold/types@0.1.0" - )] - unsafe extern "C" { - #[link_name = "[resource-drop]refresh-session"] - fn drop(_: u32); - } - unsafe { drop(_handle) }; - } - } - } - /// Opaque handle for an auth signer (reusable). - #[derive(Debug)] - #[repr(transparent)] - pub struct AuthSigner { - handle: _rt::Resource, - } - type _AuthSignerRep = Option; - impl AuthSigner { - /// Creates a new resource from the specified representation. - /// - /// This function will create a new resource handle by moving `val` onto - /// the heap and then passing that heap pointer to the component model to - /// create a handle. The owned handle is then returned as `AuthSigner`. - pub fn new(val: T) -> Self { - Self::type_guard::(); - let val: _AuthSignerRep = Some(val); - let ptr: *mut _AuthSignerRep = _rt::Box::into_raw( - _rt::Box::new(val), - ); - unsafe { Self::from_handle(T::_resource_new(ptr.cast())) } - } - /// Gets access to the underlying `T` which represents this resource. - pub fn get(&self) -> &T { - let ptr = unsafe { &*self.as_ptr::() }; - ptr.as_ref().unwrap() - } - /// Gets mutable access to the underlying `T` which represents this - /// resource. - pub fn get_mut(&mut self) -> &mut T { - let ptr = unsafe { &mut *self.as_ptr::() }; - ptr.as_mut().unwrap() - } - /// Consumes this resource and returns the underlying `T`. - pub fn into_inner(self) -> T { - let ptr = unsafe { &mut *self.as_ptr::() }; - ptr.take().unwrap() - } - #[doc(hidden)] - pub unsafe fn from_handle(handle: u32) -> Self { - Self { - handle: unsafe { _rt::Resource::from_handle(handle) }, - } - } - #[doc(hidden)] - pub fn take_handle(&self) -> u32 { - _rt::Resource::take_handle(&self.handle) - } - #[doc(hidden)] - pub fn handle(&self) -> u32 { - _rt::Resource::handle(&self.handle) - } - #[doc(hidden)] - fn type_guard() { - use core::any::TypeId; - static mut LAST_TYPE: Option = None; - unsafe { - assert!(! cfg!(target_feature = "atomics")); - let id = TypeId::of::(); - match LAST_TYPE { - Some(ty) => { - assert!( - ty == id, "cannot use two types with this resource type" - ) - } - None => LAST_TYPE = Some(id), - } - } - } - #[doc(hidden)] - pub unsafe fn dtor(handle: *mut u8) { - Self::type_guard::(); - let _ = unsafe { - _rt::Box::from_raw(handle as *mut _AuthSignerRep) - }; - } - fn as_ptr(&self) -> *mut _AuthSignerRep { - AuthSigner::type_guard::(); - T::_resource_rep(self.handle()).cast() - } - } - /// A borrowed version of [`AuthSigner`] which represents a borrowed value - /// with the lifetime `'a`. - #[derive(Debug)] - #[repr(transparent)] - pub struct AuthSignerBorrow<'a> { - rep: *mut u8, - _marker: core::marker::PhantomData<&'a AuthSigner>, - } - impl<'a> AuthSignerBorrow<'a> { - #[doc(hidden)] - pub unsafe fn lift(rep: usize) -> Self { - Self { - rep: rep as *mut u8, - _marker: core::marker::PhantomData, - } - } - /// Gets access to the underlying `T` in this resource. - pub fn get(&self) -> &T { - let ptr = unsafe { &mut *self.as_ptr::() }; - ptr.as_ref().unwrap() - } - fn as_ptr(&self) -> *mut _AuthSignerRep { - AuthSigner::type_guard::(); - self.rep.cast() - } - } - unsafe impl _rt::WasmResource for AuthSigner { - #[inline] - unsafe fn drop(_handle: u32) { - #[cfg(not(target_arch = "wasm32"))] - unreachable!(); - #[cfg(target_arch = "wasm32")] - { - #[link( - wasm_import_module = "[export]component:threshold/types@0.1.0" - )] - unsafe extern "C" { - #[link_name = "[resource-drop]auth-signer"] - fn drop(_: u32); - } - unsafe { drop(_handle) }; - } - } - } - /// DKG round 1 output. - pub struct DkgRound1Output { - pub round1_package_json: _rt::String, - pub secret: Round1Secret, - } - impl ::core::fmt::Debug for DkgRound1Output { - fn fmt( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.debug_struct("DkgRound1Output") - .field("round1-package-json", &self.round1_package_json) - .field("secret", &self.secret) - .finish() - } - } - /// DKG refresh round 1 output (includes coefficients for polynomial eval). - pub struct DkgRefreshRound1Output { - pub round1_package_json: _rt::String, - pub coefficients_json: _rt::String, - pub secret: Round1Secret, - } - impl ::core::fmt::Debug for DkgRefreshRound1Output { - fn fmt( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.debug_struct("DkgRefreshRound1Output") - .field("round1-package-json", &self.round1_package_json) - .field("coefficients-json", &self.coefficients_json) - .field("secret", &self.secret) - .finish() - } - } - /// DKG round 2 output. - pub struct DkgRound2Output { - pub round2_packages_json: _rt::String, - pub secret: Round2Secret, - } - impl ::core::fmt::Debug for DkgRound2Output { - fn fmt( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.debug_struct("DkgRound2Output") - .field("round2-packages-json", &self.round2_packages_json) - .field("secret", &self.secret) - .finish() - } - } - /// DKG round 3 output (final keys). - #[derive(Clone)] - pub struct DkgRound3Output { - pub key_package_json: _rt::String, - pub public_key_package_json: _rt::String, - } - impl ::core::fmt::Debug for DkgRound3Output { - fn fmt( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.debug_struct("DkgRound3Output") - .field("key-package-json", &self.key_package_json) - .field( - "public-key-package-json", - &self.public_key_package_json, - ) - .finish() - } - } - /// Nonce generation output. - pub struct NonceOutput { - pub commitments_json: _rt::String, - pub nonce: SigningNonce, - } - impl ::core::fmt::Debug for NonceOutput { - fn fmt( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.debug_struct("NonceOutput") - .field("commitments-json", &self.commitments_json) - .field("nonce", &self.nonce) - .finish() - } - } - /// Threshold cryptography operations. - #[derive(Debug)] - #[repr(transparent)] - pub struct ThresholdSession { - handle: _rt::Resource, - } - type _ThresholdSessionRep = Option; - impl ThresholdSession { - /// Creates a new resource from the specified representation. - /// - /// This function will create a new resource handle by moving `val` onto - /// the heap and then passing that heap pointer to the component model to - /// create a handle. The owned handle is then returned as `ThresholdSession`. - pub fn new(val: T) -> Self { - Self::type_guard::(); - let val: _ThresholdSessionRep = Some(val); - let ptr: *mut _ThresholdSessionRep = _rt::Box::into_raw( - _rt::Box::new(val), - ); - unsafe { Self::from_handle(T::_resource_new(ptr.cast())) } - } - /// Gets access to the underlying `T` which represents this resource. - pub fn get(&self) -> &T { - let ptr = unsafe { &*self.as_ptr::() }; - ptr.as_ref().unwrap() - } - /// Gets mutable access to the underlying `T` which represents this - /// resource. - pub fn get_mut(&mut self) -> &mut T { - let ptr = unsafe { &mut *self.as_ptr::() }; - ptr.as_mut().unwrap() - } - /// Consumes this resource and returns the underlying `T`. - pub fn into_inner(self) -> T { - let ptr = unsafe { &mut *self.as_ptr::() }; - ptr.take().unwrap() - } - #[doc(hidden)] - pub unsafe fn from_handle(handle: u32) -> Self { - Self { - handle: unsafe { _rt::Resource::from_handle(handle) }, - } - } - #[doc(hidden)] - pub fn take_handle(&self) -> u32 { - _rt::Resource::take_handle(&self.handle) - } - #[doc(hidden)] - pub fn handle(&self) -> u32 { - _rt::Resource::handle(&self.handle) - } - #[doc(hidden)] - fn type_guard() { - use core::any::TypeId; - static mut LAST_TYPE: Option = None; - unsafe { - assert!(! cfg!(target_feature = "atomics")); - let id = TypeId::of::(); - match LAST_TYPE { - Some(ty) => { - assert!( - ty == id, "cannot use two types with this resource type" - ) - } - None => LAST_TYPE = Some(id), - } - } - } - #[doc(hidden)] - pub unsafe fn dtor(handle: *mut u8) { - Self::type_guard::(); - let _ = unsafe { - _rt::Box::from_raw(handle as *mut _ThresholdSessionRep) - }; - } - fn as_ptr( - &self, - ) -> *mut _ThresholdSessionRep { - ThresholdSession::type_guard::(); - T::_resource_rep(self.handle()).cast() - } - } - /// A borrowed version of [`ThresholdSession`] which represents a borrowed value - /// with the lifetime `'a`. - #[derive(Debug)] - #[repr(transparent)] - pub struct ThresholdSessionBorrow<'a> { - rep: *mut u8, - _marker: core::marker::PhantomData<&'a ThresholdSession>, - } - impl<'a> ThresholdSessionBorrow<'a> { - #[doc(hidden)] - pub unsafe fn lift(rep: usize) -> Self { - Self { - rep: rep as *mut u8, - _marker: core::marker::PhantomData, - } - } - /// Gets access to the underlying `T` in this resource. - pub fn get(&self) -> &T { - let ptr = unsafe { &mut *self.as_ptr::() }; - ptr.as_ref().unwrap() - } - fn as_ptr(&self) -> *mut _ThresholdSessionRep { - ThresholdSession::type_guard::(); - self.rep.cast() - } - } - unsafe impl _rt::WasmResource for ThresholdSession { - #[inline] - unsafe fn drop(_handle: u32) { - #[cfg(not(target_arch = "wasm32"))] - unreachable!(); - #[cfg(target_arch = "wasm32")] - { - #[link( - wasm_import_module = "[export]component:threshold/types@0.1.0" - )] - unsafe extern "C" { - #[link_name = "[resource-drop]threshold-session"] - fn drop(_: u32); - } - unsafe { drop(_handle) }; - } - } - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn _export_constructor_dkg_session_cabi() -> i32 { - #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); - let result0 = DkgSession::new(T::new()); - (result0).take_handle() as i32 - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn _export_method_dkg_session_reset_cabi( - arg0: *mut u8, - ) { - #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); - T::reset( - unsafe { DkgSessionBorrow::lift(arg0 as u32 as usize) }.get(), - ); - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn _export_method_dkg_session_insert_round1_package_cabi< - T: GuestDkgSession, - >( - arg0: *mut u8, - arg1: *mut u8, - arg2: usize, - arg3: *mut u8, - arg4: usize, - ) { - #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); - let len0 = arg2; - let bytes0 = _rt::Vec::from_raw_parts(arg1.cast(), len0, len0); - let len1 = arg4; - let bytes1 = _rt::Vec::from_raw_parts(arg3.cast(), len1, len1); - T::insert_round1_package( - unsafe { DkgSessionBorrow::lift(arg0 as u32 as usize) }.get(), - _rt::string_lift(bytes0), - _rt::string_lift(bytes1), - ); - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn _export_method_dkg_session_insert_receiver_identifier_cabi< - T: GuestDkgSession, - >(arg0: *mut u8, arg1: *mut u8, arg2: usize) { - #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); - let len0 = arg2; - let bytes0 = _rt::Vec::from_raw_parts(arg1.cast(), len0, len0); - T::insert_receiver_identifier( - unsafe { DkgSessionBorrow::lift(arg0 as u32 as usize) }.get(), - _rt::string_lift(bytes0), - ); - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn _export_method_dkg_session_total_participants_cabi< - T: GuestDkgSession, - >(arg0: *mut u8) -> i32 { - #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); - let result0 = T::total_participants( - unsafe { DkgSessionBorrow::lift(arg0 as u32 as usize) }.get(), - ); - _rt::as_i32(result0) - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn _export_method_dkg_session_is_receiver_cabi< - T: GuestDkgSession, - >(arg0: *mut u8, arg1: *mut u8, arg2: usize) -> i32 { - #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); - let len0 = arg2; - let bytes0 = _rt::Vec::from_raw_parts(arg1.cast(), len0, len0); - let result1 = T::is_receiver( - unsafe { DkgSessionBorrow::lift(arg0 as u32 as usize) }.get(), - _rt::string_lift(bytes0), - ); - match result1 { - true => 1, - false => 0, - } - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn _export_method_dkg_session_get_round1_packages_json_cabi< - T: GuestDkgSession, - >(arg0: *mut u8) -> *mut u8 { - #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); - let result0 = T::get_round1_packages_json( - unsafe { DkgSessionBorrow::lift(arg0 as u32 as usize) }.get(), - ); - let ptr1 = (&raw mut _RET_AREA.0).cast::(); - let vec2 = (result0.into_bytes()).into_boxed_slice(); - let ptr2 = vec2.as_ptr().cast::(); - let len2 = vec2.len(); - ::core::mem::forget(vec2); - *ptr1.add(::core::mem::size_of::<*const u8>()).cast::() = len2; - *ptr1.add(0).cast::<*mut u8>() = ptr2.cast_mut(); - ptr1 - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn __post_return_method_dkg_session_get_round1_packages_json< - T: GuestDkgSession, - >(arg0: *mut u8) { - let l0 = *arg0.add(0).cast::<*mut u8>(); - let l1 = *arg0 - .add(::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l0, l1, 1); - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn _export_method_dkg_session_get_round1_packages_excluding_json_cabi< - T: GuestDkgSession, - >(arg0: *mut u8, arg1: *mut u8, arg2: usize) -> *mut u8 { - #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); - let len0 = arg2; - let bytes0 = _rt::Vec::from_raw_parts(arg1.cast(), len0, len0); - let result1 = T::get_round1_packages_excluding_json( - unsafe { DkgSessionBorrow::lift(arg0 as u32 as usize) }.get(), - _rt::string_lift(bytes0), - ); - let ptr2 = (&raw mut _RET_AREA.0).cast::(); - let vec3 = (result1.into_bytes()).into_boxed_slice(); - let ptr3 = vec3.as_ptr().cast::(); - let len3 = vec3.len(); - ::core::mem::forget(vec3); - *ptr2.add(::core::mem::size_of::<*const u8>()).cast::() = len3; - *ptr2.add(0).cast::<*mut u8>() = ptr3.cast_mut(); - ptr2 - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn __post_return_method_dkg_session_get_round1_packages_excluding_json< - T: GuestDkgSession, - >(arg0: *mut u8) { - let l0 = *arg0.add(0).cast::<*mut u8>(); - let l1 = *arg0 - .add(::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l0, l1, 1); - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn _export_method_dkg_session_get_receiver_ids_json_cabi< - T: GuestDkgSession, - >(arg0: *mut u8) -> *mut u8 { - #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); - let result0 = T::get_receiver_ids_json( - unsafe { DkgSessionBorrow::lift(arg0 as u32 as usize) }.get(), - ); - let ptr1 = (&raw mut _RET_AREA.0).cast::(); - let vec2 = (result0.into_bytes()).into_boxed_slice(); - let ptr2 = vec2.as_ptr().cast::(); - let len2 = vec2.len(); - ::core::mem::forget(vec2); - *ptr1.add(::core::mem::size_of::<*const u8>()).cast::() = len2; - *ptr1.add(0).cast::<*mut u8>() = ptr2.cast_mut(); - ptr1 - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn __post_return_method_dkg_session_get_receiver_ids_json< - T: GuestDkgSession, - >(arg0: *mut u8) { - let l0 = *arg0.add(0).cast::<*mut u8>(); - let l1 = *arg0 - .add(::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l0, l1, 1); - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn _export_method_dkg_session_set_server_id_cabi< - T: GuestDkgSession, - >(arg0: *mut u8, arg1: *mut u8, arg2: usize) { - #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); - let len0 = arg2; - let bytes0 = _rt::Vec::from_raw_parts(arg1.cast(), len0, len0); - T::set_server_id( - unsafe { DkgSessionBorrow::lift(arg0 as u32 as usize) }.get(), - _rt::string_lift(bytes0), - ); - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn _export_method_dkg_session_get_server_id_cabi< - T: GuestDkgSession, - >(arg0: *mut u8) -> *mut u8 { - #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); - let result0 = T::get_server_id( - unsafe { DkgSessionBorrow::lift(arg0 as u32 as usize) }.get(), - ); - let ptr1 = (&raw mut _RET_AREA.0).cast::(); - let vec2 = (result0.into_bytes()).into_boxed_slice(); - let ptr2 = vec2.as_ptr().cast::(); - let len2 = vec2.len(); - ::core::mem::forget(vec2); - *ptr1.add(::core::mem::size_of::<*const u8>()).cast::() = len2; - *ptr1.add(0).cast::<*mut u8>() = ptr2.cast_mut(); - ptr1 - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn __post_return_method_dkg_session_get_server_id< - T: GuestDkgSession, - >(arg0: *mut u8) { - let l0 = *arg0.add(0).cast::<*mut u8>(); - let l1 = *arg0 - .add(::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l0, l1, 1); - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn _export_method_dkg_session_set_server_internal_secret_hex_cabi< - T: GuestDkgSession, - >(arg0: *mut u8, arg1: *mut u8, arg2: usize) { - #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); - let len0 = arg2; - let bytes0 = _rt::Vec::from_raw_parts(arg1.cast(), len0, len0); - T::set_server_internal_secret_hex( - unsafe { DkgSessionBorrow::lift(arg0 as u32 as usize) }.get(), - _rt::string_lift(bytes0), - ); - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn _export_method_dkg_session_get_server_internal_secret_hex_cabi< - T: GuestDkgSession, - >(arg0: *mut u8) -> *mut u8 { - #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); - let result0 = T::get_server_internal_secret_hex( - unsafe { DkgSessionBorrow::lift(arg0 as u32 as usize) }.get(), - ); - let ptr1 = (&raw mut _RET_AREA.0).cast::(); - let vec2 = (result0.into_bytes()).into_boxed_slice(); - let ptr2 = vec2.as_ptr().cast::(); - let len2 = vec2.len(); - ::core::mem::forget(vec2); - *ptr1.add(::core::mem::size_of::<*const u8>()).cast::() = len2; - *ptr1.add(0).cast::<*mut u8>() = ptr2.cast_mut(); - ptr1 - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn __post_return_method_dkg_session_get_server_internal_secret_hex< - T: GuestDkgSession, - >(arg0: *mut u8) { - let l0 = *arg0.add(0).cast::<*mut u8>(); - let l1 = *arg0 - .add(::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l0, l1, 1); - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn _export_method_dkg_session_insert_round2_received_cabi< - T: GuestDkgSession, - >( - arg0: *mut u8, - arg1: *mut u8, - arg2: usize, - arg3: *mut u8, - arg4: usize, - ) { - #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); - let len0 = arg2; - let bytes0 = _rt::Vec::from_raw_parts(arg1.cast(), len0, len0); - let len1 = arg4; - let bytes1 = _rt::Vec::from_raw_parts(arg3.cast(), len1, len1); - T::insert_round2_received( - unsafe { DkgSessionBorrow::lift(arg0 as u32 as usize) }.get(), - _rt::string_lift(bytes0), - _rt::string_lift(bytes1), - ); - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn _export_method_dkg_session_get_round2_received_json_cabi< - T: GuestDkgSession, - >(arg0: *mut u8) -> *mut u8 { - #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); - let result0 = T::get_round2_received_json( - unsafe { DkgSessionBorrow::lift(arg0 as u32 as usize) }.get(), - ); - let ptr1 = (&raw mut _RET_AREA.0).cast::(); - let vec2 = (result0.into_bytes()).into_boxed_slice(); - let ptr2 = vec2.as_ptr().cast::(); - let len2 = vec2.len(); - ::core::mem::forget(vec2); - *ptr1.add(::core::mem::size_of::<*const u8>()).cast::() = len2; - *ptr1.add(0).cast::<*mut u8>() = ptr2.cast_mut(); - ptr1 - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn __post_return_method_dkg_session_get_round2_received_json< - T: GuestDkgSession, - >(arg0: *mut u8) { - let l0 = *arg0.add(0).cast::<*mut u8>(); - let l1 = *arg0 - .add(::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l0, l1, 1); - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn _export_method_dkg_session_set_round2_local_json_cabi< - T: GuestDkgSession, - >(arg0: *mut u8, arg1: *mut u8, arg2: usize) { - #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); - let len0 = arg2; - let bytes0 = _rt::Vec::from_raw_parts(arg1.cast(), len0, len0); - T::set_round2_local_json( - unsafe { DkgSessionBorrow::lift(arg0 as u32 as usize) }.get(), - _rt::string_lift(bytes0), - ); - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn _export_method_dkg_session_get_round2_local_json_cabi< - T: GuestDkgSession, - >(arg0: *mut u8) -> *mut u8 { - #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); - let result0 = T::get_round2_local_json( - unsafe { DkgSessionBorrow::lift(arg0 as u32 as usize) }.get(), - ); - let ptr1 = (&raw mut _RET_AREA.0).cast::(); - let vec2 = (result0.into_bytes()).into_boxed_slice(); - let ptr2 = vec2.as_ptr().cast::(); - let len2 = vec2.len(); - ::core::mem::forget(vec2); - *ptr1.add(::core::mem::size_of::<*const u8>()).cast::() = len2; - *ptr1.add(0).cast::<*mut u8>() = ptr2.cast_mut(); - ptr1 - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn __post_return_method_dkg_session_get_round2_local_json< - T: GuestDkgSession, - >(arg0: *mut u8) { - let l0 = *arg0.add(0).cast::<*mut u8>(); - let l1 = *arg0 - .add(::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l0, l1, 1); - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn _export_method_dkg_session_is_round2_local_empty_cabi< - T: GuestDkgSession, - >(arg0: *mut u8) -> i32 { - #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); - let result0 = T::is_round2_local_empty( - unsafe { DkgSessionBorrow::lift(arg0 as u32 as usize) }.get(), - ); - match result0 { - true => 1, - false => 0, - } - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn _export_method_dkg_session_insert_relay_packages_cabi< - T: GuestDkgSession, - >( - arg0: *mut u8, - arg1: *mut u8, - arg2: usize, - arg3: *mut u8, - arg4: usize, - ) { - #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); - let len0 = arg2; - let bytes0 = _rt::Vec::from_raw_parts(arg1.cast(), len0, len0); - let len1 = arg4; - let bytes1 = _rt::Vec::from_raw_parts(arg3.cast(), len1, len1); - T::insert_relay_packages( - unsafe { DkgSessionBorrow::lift(arg0 as u32 as usize) }.get(), - _rt::string_lift(bytes0), - _rt::string_lift(bytes1), - ); - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn _export_method_dkg_session_insert_relay_from_local_cabi< - T: GuestDkgSession, - >(arg0: *mut u8, arg1: *mut u8, arg2: usize) { - #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); - let len0 = arg2; - let bytes0 = _rt::Vec::from_raw_parts(arg1.cast(), len0, len0); - T::insert_relay_from_local( - unsafe { DkgSessionBorrow::lift(arg0 as u32 as usize) }.get(), - _rt::string_lift(bytes0), - ); - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn _export_method_dkg_session_relay_sender_count_cabi< - T: GuestDkgSession, - >(arg0: *mut u8) -> i32 { - #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); - let result0 = T::relay_sender_count( - unsafe { DkgSessionBorrow::lift(arg0 as u32 as usize) }.get(), - ); - _rt::as_i32(result0) - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn _export_method_dkg_session_get_relay_packages_for_cabi< - T: GuestDkgSession, - >(arg0: *mut u8, arg1: *mut u8, arg2: usize) -> *mut u8 { - #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); - let len0 = arg2; - let bytes0 = _rt::Vec::from_raw_parts(arg1.cast(), len0, len0); - let result1 = T::get_relay_packages_for( - unsafe { DkgSessionBorrow::lift(arg0 as u32 as usize) }.get(), - _rt::string_lift(bytes0), - ); - let ptr2 = (&raw mut _RET_AREA.0).cast::(); - let vec3 = (result1.into_bytes()).into_boxed_slice(); - let ptr3 = vec3.as_ptr().cast::(); - let len3 = vec3.len(); - ::core::mem::forget(vec3); - *ptr2.add(::core::mem::size_of::<*const u8>()).cast::() = len3; - *ptr2.add(0).cast::<*mut u8>() = ptr3.cast_mut(); - ptr2 - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn __post_return_method_dkg_session_get_relay_packages_for< - T: GuestDkgSession, - >(arg0: *mut u8) { - let l0 = *arg0.add(0).cast::<*mut u8>(); - let l1 = *arg0 - .add(::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l0, l1, 1); - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn _export_constructor_signing_session_cabi< - T: GuestSigningSession, - >() -> i32 { - #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); - let result0 = SigningSession::new(T::new()); - (result0).take_handle() as i32 - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn _export_method_signing_session_reset_cabi< - T: GuestSigningSession, - >(arg0: *mut u8) { - #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); - T::reset( - unsafe { SigningSessionBorrow::lift(arg0 as u32 as usize) }.get(), - ); - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn _export_method_signing_session_set_user_hiding_hex_cabi< - T: GuestSigningSession, - >(arg0: *mut u8, arg1: *mut u8, arg2: usize) { - #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); - let len0 = arg2; - let bytes0 = _rt::Vec::from_raw_parts(arg1.cast(), len0, len0); - T::set_user_hiding_hex( - unsafe { SigningSessionBorrow::lift(arg0 as u32 as usize) } - .get(), - _rt::string_lift(bytes0), - ); - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn _export_method_signing_session_get_user_hiding_hex_cabi< - T: GuestSigningSession, - >(arg0: *mut u8) -> *mut u8 { - #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); - let result0 = T::get_user_hiding_hex( - unsafe { SigningSessionBorrow::lift(arg0 as u32 as usize) }.get(), - ); - let ptr1 = (&raw mut _RET_AREA.0).cast::(); - let vec2 = (result0.into_bytes()).into_boxed_slice(); - let ptr2 = vec2.as_ptr().cast::(); - let len2 = vec2.len(); - ::core::mem::forget(vec2); - *ptr1.add(::core::mem::size_of::<*const u8>()).cast::() = len2; - *ptr1.add(0).cast::<*mut u8>() = ptr2.cast_mut(); - ptr1 - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn __post_return_method_signing_session_get_user_hiding_hex< - T: GuestSigningSession, - >(arg0: *mut u8) { - let l0 = *arg0.add(0).cast::<*mut u8>(); - let l1 = *arg0 - .add(::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l0, l1, 1); - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn _export_method_signing_session_set_user_binding_hex_cabi< - T: GuestSigningSession, - >(arg0: *mut u8, arg1: *mut u8, arg2: usize) { - #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); - let len0 = arg2; - let bytes0 = _rt::Vec::from_raw_parts(arg1.cast(), len0, len0); - T::set_user_binding_hex( - unsafe { SigningSessionBorrow::lift(arg0 as u32 as usize) } - .get(), - _rt::string_lift(bytes0), - ); - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn _export_method_signing_session_get_user_binding_hex_cabi< - T: GuestSigningSession, - >(arg0: *mut u8) -> *mut u8 { - #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); - let result0 = T::get_user_binding_hex( - unsafe { SigningSessionBorrow::lift(arg0 as u32 as usize) }.get(), - ); - let ptr1 = (&raw mut _RET_AREA.0).cast::(); - let vec2 = (result0.into_bytes()).into_boxed_slice(); - let ptr2 = vec2.as_ptr().cast::(); - let len2 = vec2.len(); - ::core::mem::forget(vec2); - *ptr1.add(::core::mem::size_of::<*const u8>()).cast::() = len2; - *ptr1.add(0).cast::<*mut u8>() = ptr2.cast_mut(); - ptr1 - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn __post_return_method_signing_session_get_user_binding_hex< - T: GuestSigningSession, - >(arg0: *mut u8) { - let l0 = *arg0.add(0).cast::<*mut u8>(); - let l1 = *arg0 - .add(::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l0, l1, 1); - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn _export_method_signing_session_set_message_to_sign_cabi< - T: GuestSigningSession, - >(arg0: *mut u8, arg1: *mut u8, arg2: usize) { - #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); - let len0 = arg2; - let bytes0 = _rt::Vec::from_raw_parts(arg1.cast(), len0, len0); - T::set_message_to_sign( - unsafe { SigningSessionBorrow::lift(arg0 as u32 as usize) } - .get(), - _rt::string_lift(bytes0), - ); - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn _export_method_signing_session_get_message_to_sign_cabi< - T: GuestSigningSession, - >(arg0: *mut u8) -> *mut u8 { - #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); - let result0 = T::get_message_to_sign( - unsafe { SigningSessionBorrow::lift(arg0 as u32 as usize) }.get(), - ); - let ptr1 = (&raw mut _RET_AREA.0).cast::(); - let vec2 = (result0.into_bytes()).into_boxed_slice(); - let ptr2 = vec2.as_ptr().cast::(); - let len2 = vec2.len(); - ::core::mem::forget(vec2); - *ptr1.add(::core::mem::size_of::<*const u8>()).cast::() = len2; - *ptr1.add(0).cast::<*mut u8>() = ptr2.cast_mut(); - ptr1 - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn __post_return_method_signing_session_get_message_to_sign< - T: GuestSigningSession, - >(arg0: *mut u8) { - let l0 = *arg0.add(0).cast::<*mut u8>(); - let l1 = *arg0 - .add(::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l0, l1, 1); - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn _export_method_signing_session_has_message_cabi< - T: GuestSigningSession, - >(arg0: *mut u8) -> i32 { - #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); - let result0 = T::has_message( - unsafe { SigningSessionBorrow::lift(arg0 as u32 as usize) }.get(), - ); - match result0 { - true => 1, - false => 0, - } - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn _export_method_signing_session_set_server_commitments_json_cabi< - T: GuestSigningSession, - >(arg0: *mut u8, arg1: *mut u8, arg2: usize) { - #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); - let len0 = arg2; - let bytes0 = _rt::Vec::from_raw_parts(arg1.cast(), len0, len0); - T::set_server_commitments_json( - unsafe { SigningSessionBorrow::lift(arg0 as u32 as usize) } - .get(), - _rt::string_lift(bytes0), - ); - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn _export_method_signing_session_get_server_commitments_json_cabi< - T: GuestSigningSession, - >(arg0: *mut u8) -> *mut u8 { - #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); - let result0 = T::get_server_commitments_json( - unsafe { SigningSessionBorrow::lift(arg0 as u32 as usize) }.get(), - ); - let ptr1 = (&raw mut _RET_AREA.0).cast::(); - let vec2 = (result0.into_bytes()).into_boxed_slice(); - let ptr2 = vec2.as_ptr().cast::(); - let len2 = vec2.len(); - ::core::mem::forget(vec2); - *ptr1.add(::core::mem::size_of::<*const u8>()).cast::() = len2; - *ptr1.add(0).cast::<*mut u8>() = ptr2.cast_mut(); - ptr1 - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn __post_return_method_signing_session_get_server_commitments_json< - T: GuestSigningSession, - >(arg0: *mut u8) { - let l0 = *arg0.add(0).cast::<*mut u8>(); - let l1 = *arg0 - .add(::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l0, l1, 1); - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn _export_method_signing_session_has_server_commitments_cabi< - T: GuestSigningSession, - >(arg0: *mut u8) -> i32 { - #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); - let result0 = T::has_server_commitments( - unsafe { SigningSessionBorrow::lift(arg0 as u32 as usize) }.get(), - ); - match result0 { - true => 1, - false => 0, - } - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn _export_method_signing_session_insert_commitment_cabi< - T: GuestSigningSession, - >( - arg0: *mut u8, - arg1: *mut u8, - arg2: usize, - arg3: *mut u8, - arg4: usize, - ) { - #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); - let len0 = arg2; - let bytes0 = _rt::Vec::from_raw_parts(arg1.cast(), len0, len0); - let len1 = arg4; - let bytes1 = _rt::Vec::from_raw_parts(arg3.cast(), len1, len1); - T::insert_commitment( - unsafe { SigningSessionBorrow::lift(arg0 as u32 as usize) } - .get(), - _rt::string_lift(bytes0), - _rt::string_lift(bytes1), - ); - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn _export_method_signing_session_get_commitments_json_cabi< - T: GuestSigningSession, - >(arg0: *mut u8) -> *mut u8 { - #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); - let result0 = T::get_commitments_json( - unsafe { SigningSessionBorrow::lift(arg0 as u32 as usize) }.get(), - ); - let ptr1 = (&raw mut _RET_AREA.0).cast::(); - let vec2 = (result0.into_bytes()).into_boxed_slice(); - let ptr2 = vec2.as_ptr().cast::(); - let len2 = vec2.len(); - ::core::mem::forget(vec2); - *ptr1.add(::core::mem::size_of::<*const u8>()).cast::() = len2; - *ptr1.add(0).cast::<*mut u8>() = ptr2.cast_mut(); - ptr1 - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn __post_return_method_signing_session_get_commitments_json< - T: GuestSigningSession, - >(arg0: *mut u8) { - let l0 = *arg0.add(0).cast::<*mut u8>(); - let l1 = *arg0 - .add(::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l0, l1, 1); - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn _export_method_signing_session_insert_share_cabi< - T: GuestSigningSession, - >( - arg0: *mut u8, - arg1: *mut u8, - arg2: usize, - arg3: *mut u8, - arg4: usize, - ) { - #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); - let len0 = arg2; - let bytes0 = _rt::Vec::from_raw_parts(arg1.cast(), len0, len0); - let len1 = arg4; - let bytes1 = _rt::Vec::from_raw_parts(arg3.cast(), len1, len1); - T::insert_share( - unsafe { SigningSessionBorrow::lift(arg0 as u32 as usize) } - .get(), - _rt::string_lift(bytes0), - _rt::string_lift(bytes1), - ); - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn _export_method_signing_session_has_share_cabi< - T: GuestSigningSession, - >(arg0: *mut u8, arg1: *mut u8, arg2: usize) -> i32 { - #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); - let len0 = arg2; - let bytes0 = _rt::Vec::from_raw_parts(arg1.cast(), len0, len0); - let result1 = T::has_share( - unsafe { SigningSessionBorrow::lift(arg0 as u32 as usize) } - .get(), - _rt::string_lift(bytes0), - ); - match result1 { - true => 1, - false => 0, - } - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn _export_method_signing_session_share_count_cabi< - T: GuestSigningSession, - >(arg0: *mut u8) -> i32 { - #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); - let result0 = T::share_count( - unsafe { SigningSessionBorrow::lift(arg0 as u32 as usize) }.get(), - ); - _rt::as_i32(result0) - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn _export_method_signing_session_get_shares_json_cabi< - T: GuestSigningSession, - >(arg0: *mut u8) -> *mut u8 { - #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); - let result0 = T::get_shares_json( - unsafe { SigningSessionBorrow::lift(arg0 as u32 as usize) }.get(), - ); - let ptr1 = (&raw mut _RET_AREA.0).cast::(); - let vec2 = (result0.into_bytes()).into_boxed_slice(); - let ptr2 = vec2.as_ptr().cast::(); - let len2 = vec2.len(); - ::core::mem::forget(vec2); - *ptr1.add(::core::mem::size_of::<*const u8>()).cast::() = len2; - *ptr1.add(0).cast::<*mut u8>() = ptr2.cast_mut(); - ptr1 - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn __post_return_method_signing_session_get_shares_json< - T: GuestSigningSession, - >(arg0: *mut u8) { - let l0 = *arg0.add(0).cast::<*mut u8>(); - let l1 = *arg0 - .add(::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l0, l1, 1); - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn _export_method_signing_session_set_current_policy_id_cabi< - T: GuestSigningSession, - >(arg0: *mut u8, arg1: *mut u8, arg2: usize) { - #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); - let len0 = arg2; - let bytes0 = _rt::Vec::from_raw_parts(arg1.cast(), len0, len0); - T::set_current_policy_id( - unsafe { SigningSessionBorrow::lift(arg0 as u32 as usize) } - .get(), - _rt::string_lift(bytes0), - ); - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn _export_method_signing_session_get_current_policy_id_cabi< - T: GuestSigningSession, - >(arg0: *mut u8) -> *mut u8 { - #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); - let result0 = T::get_current_policy_id( - unsafe { SigningSessionBorrow::lift(arg0 as u32 as usize) }.get(), - ); - let ptr1 = (&raw mut _RET_AREA.0).cast::(); - let vec2 = (result0.into_bytes()).into_boxed_slice(); - let ptr2 = vec2.as_ptr().cast::(); - let len2 = vec2.len(); - ::core::mem::forget(vec2); - *ptr1.add(::core::mem::size_of::<*const u8>()).cast::() = len2; - *ptr1.add(0).cast::<*mut u8>() = ptr2.cast_mut(); - ptr1 - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn __post_return_method_signing_session_get_current_policy_id< - T: GuestSigningSession, - >(arg0: *mut u8) { - let l0 = *arg0.add(0).cast::<*mut u8>(); - let l1 = *arg0 - .add(::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l0, l1, 1); - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn _export_method_signing_session_set_pending_amount_cabi< - T: GuestSigningSession, - >(arg0: *mut u8, arg1: i64) { - #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); - T::set_pending_amount( - unsafe { SigningSessionBorrow::lift(arg0 as u32 as usize) } - .get(), - arg1, - ); - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn _export_method_signing_session_get_pending_amount_cabi< - T: GuestSigningSession, - >(arg0: *mut u8) -> i64 { - #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); - let result0 = T::get_pending_amount( - unsafe { SigningSessionBorrow::lift(arg0 as u32 as usize) }.get(), - ); - _rt::as_i64(result0) - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn _export_constructor_refresh_session_cabi< - T: GuestRefreshSession, - >() -> i32 { - #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); - let result0 = RefreshSession::new(T::new()); - (result0).take_handle() as i32 - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn _export_method_refresh_session_reset_cabi< - T: GuestRefreshSession, - >(arg0: *mut u8) { - #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); - T::reset( - unsafe { RefreshSessionBorrow::lift(arg0 as u32 as usize) }.get(), - ); - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn _export_method_refresh_session_insert_round1_package_cabi< - T: GuestRefreshSession, - >( - arg0: *mut u8, - arg1: *mut u8, - arg2: usize, - arg3: *mut u8, - arg4: usize, - ) { - #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); - let len0 = arg2; - let bytes0 = _rt::Vec::from_raw_parts(arg1.cast(), len0, len0); - let len1 = arg4; - let bytes1 = _rt::Vec::from_raw_parts(arg3.cast(), len1, len1); - T::insert_round1_package( - unsafe { RefreshSessionBorrow::lift(arg0 as u32 as usize) } - .get(), - _rt::string_lift(bytes0), - _rt::string_lift(bytes1), - ); - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn _export_method_refresh_session_round1_count_cabi< - T: GuestRefreshSession, - >(arg0: *mut u8) -> i32 { - #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); - let result0 = T::round1_count( - unsafe { RefreshSessionBorrow::lift(arg0 as u32 as usize) }.get(), - ); - _rt::as_i32(result0) - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn _export_method_refresh_session_get_round1_packages_json_cabi< - T: GuestRefreshSession, - >(arg0: *mut u8) -> *mut u8 { - #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); - let result0 = T::get_round1_packages_json( - unsafe { RefreshSessionBorrow::lift(arg0 as u32 as usize) }.get(), - ); - let ptr1 = (&raw mut _RET_AREA.0).cast::(); - let vec2 = (result0.into_bytes()).into_boxed_slice(); - let ptr2 = vec2.as_ptr().cast::(); - let len2 = vec2.len(); - ::core::mem::forget(vec2); - *ptr1.add(::core::mem::size_of::<*const u8>()).cast::() = len2; - *ptr1.add(0).cast::<*mut u8>() = ptr2.cast_mut(); - ptr1 - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn __post_return_method_refresh_session_get_round1_packages_json< - T: GuestRefreshSession, - >(arg0: *mut u8) { - let l0 = *arg0.add(0).cast::<*mut u8>(); - let l1 = *arg0 - .add(::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l0, l1, 1); - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn _export_method_refresh_session_get_round1_packages_excluding_json_cabi< - T: GuestRefreshSession, - >(arg0: *mut u8, arg1: *mut u8, arg2: usize) -> *mut u8 { - #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); - let len0 = arg2; - let bytes0 = _rt::Vec::from_raw_parts(arg1.cast(), len0, len0); - let result1 = T::get_round1_packages_excluding_json( - unsafe { RefreshSessionBorrow::lift(arg0 as u32 as usize) } - .get(), - _rt::string_lift(bytes0), - ); - let ptr2 = (&raw mut _RET_AREA.0).cast::(); - let vec3 = (result1.into_bytes()).into_boxed_slice(); - let ptr3 = vec3.as_ptr().cast::(); - let len3 = vec3.len(); - ::core::mem::forget(vec3); - *ptr2.add(::core::mem::size_of::<*const u8>()).cast::() = len3; - *ptr2.add(0).cast::<*mut u8>() = ptr3.cast_mut(); - ptr2 - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn __post_return_method_refresh_session_get_round1_packages_excluding_json< - T: GuestRefreshSession, - >(arg0: *mut u8) { - let l0 = *arg0.add(0).cast::<*mut u8>(); - let l1 = *arg0 - .add(::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l0, l1, 1); - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn _export_method_refresh_session_set_server_id_cabi< - T: GuestRefreshSession, - >(arg0: *mut u8, arg1: *mut u8, arg2: usize) { - #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); - let len0 = arg2; - let bytes0 = _rt::Vec::from_raw_parts(arg1.cast(), len0, len0); - T::set_server_id( - unsafe { RefreshSessionBorrow::lift(arg0 as u32 as usize) } - .get(), - _rt::string_lift(bytes0), - ); - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn _export_method_refresh_session_get_server_id_cabi< - T: GuestRefreshSession, - >(arg0: *mut u8) -> *mut u8 { - #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); - let result0 = T::get_server_id( - unsafe { RefreshSessionBorrow::lift(arg0 as u32 as usize) }.get(), - ); - let ptr1 = (&raw mut _RET_AREA.0).cast::(); - let vec2 = (result0.into_bytes()).into_boxed_slice(); - let ptr2 = vec2.as_ptr().cast::(); - let len2 = vec2.len(); - ::core::mem::forget(vec2); - *ptr1.add(::core::mem::size_of::<*const u8>()).cast::() = len2; - *ptr1.add(0).cast::<*mut u8>() = ptr2.cast_mut(); - ptr1 - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn __post_return_method_refresh_session_get_server_id< - T: GuestRefreshSession, - >(arg0: *mut u8) { - let l0 = *arg0.add(0).cast::<*mut u8>(); - let l1 = *arg0 - .add(::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l0, l1, 1); - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn _export_method_refresh_session_set_server_identifier_hex_cabi< - T: GuestRefreshSession, - >(arg0: *mut u8, arg1: *mut u8, arg2: usize) { - #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); - let len0 = arg2; - let bytes0 = _rt::Vec::from_raw_parts(arg1.cast(), len0, len0); - T::set_server_identifier_hex( - unsafe { RefreshSessionBorrow::lift(arg0 as u32 as usize) } - .get(), - _rt::string_lift(bytes0), - ); - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn _export_method_refresh_session_get_server_identifier_hex_cabi< - T: GuestRefreshSession, - >(arg0: *mut u8) -> *mut u8 { - #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); - let result0 = T::get_server_identifier_hex( - unsafe { RefreshSessionBorrow::lift(arg0 as u32 as usize) }.get(), - ); - let ptr1 = (&raw mut _RET_AREA.0).cast::(); - let vec2 = (result0.into_bytes()).into_boxed_slice(); - let ptr2 = vec2.as_ptr().cast::(); - let len2 = vec2.len(); - ::core::mem::forget(vec2); - *ptr1.add(::core::mem::size_of::<*const u8>()).cast::() = len2; - *ptr1.add(0).cast::<*mut u8>() = ptr2.cast_mut(); - ptr1 - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn __post_return_method_refresh_session_get_server_identifier_hex< - T: GuestRefreshSession, - >(arg0: *mut u8) { - let l0 = *arg0.add(0).cast::<*mut u8>(); - let l1 = *arg0 - .add(::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l0, l1, 1); - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn _export_method_refresh_session_insert_round2_received_cabi< - T: GuestRefreshSession, - >( - arg0: *mut u8, - arg1: *mut u8, - arg2: usize, - arg3: *mut u8, - arg4: usize, - ) { - #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); - let len0 = arg2; - let bytes0 = _rt::Vec::from_raw_parts(arg1.cast(), len0, len0); - let len1 = arg4; - let bytes1 = _rt::Vec::from_raw_parts(arg3.cast(), len1, len1); - T::insert_round2_received( - unsafe { RefreshSessionBorrow::lift(arg0 as u32 as usize) } - .get(), - _rt::string_lift(bytes0), - _rt::string_lift(bytes1), - ); - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn _export_method_refresh_session_get_round2_received_json_cabi< - T: GuestRefreshSession, - >(arg0: *mut u8) -> *mut u8 { - #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); - let result0 = T::get_round2_received_json( - unsafe { RefreshSessionBorrow::lift(arg0 as u32 as usize) }.get(), - ); - let ptr1 = (&raw mut _RET_AREA.0).cast::(); - let vec2 = (result0.into_bytes()).into_boxed_slice(); - let ptr2 = vec2.as_ptr().cast::(); - let len2 = vec2.len(); - ::core::mem::forget(vec2); - *ptr1.add(::core::mem::size_of::<*const u8>()).cast::() = len2; - *ptr1.add(0).cast::<*mut u8>() = ptr2.cast_mut(); - ptr1 - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn __post_return_method_refresh_session_get_round2_received_json< - T: GuestRefreshSession, - >(arg0: *mut u8) { - let l0 = *arg0.add(0).cast::<*mut u8>(); - let l1 = *arg0 - .add(::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l0, l1, 1); - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn _export_method_refresh_session_set_round2_local_json_cabi< - T: GuestRefreshSession, - >(arg0: *mut u8, arg1: *mut u8, arg2: usize) { - #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); - let len0 = arg2; - let bytes0 = _rt::Vec::from_raw_parts(arg1.cast(), len0, len0); - T::set_round2_local_json( - unsafe { RefreshSessionBorrow::lift(arg0 as u32 as usize) } - .get(), - _rt::string_lift(bytes0), - ); - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn _export_method_refresh_session_get_round2_local_json_cabi< - T: GuestRefreshSession, - >(arg0: *mut u8) -> *mut u8 { - #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); - let result0 = T::get_round2_local_json( - unsafe { RefreshSessionBorrow::lift(arg0 as u32 as usize) }.get(), - ); - let ptr1 = (&raw mut _RET_AREA.0).cast::(); - let vec2 = (result0.into_bytes()).into_boxed_slice(); - let ptr2 = vec2.as_ptr().cast::(); - let len2 = vec2.len(); - ::core::mem::forget(vec2); - *ptr1.add(::core::mem::size_of::<*const u8>()).cast::() = len2; - *ptr1.add(0).cast::<*mut u8>() = ptr2.cast_mut(); - ptr1 - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn __post_return_method_refresh_session_get_round2_local_json< - T: GuestRefreshSession, - >(arg0: *mut u8) { - let l0 = *arg0.add(0).cast::<*mut u8>(); - let l1 = *arg0 - .add(::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l0, l1, 1); - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn _export_method_refresh_session_is_round2_local_empty_cabi< - T: GuestRefreshSession, - >(arg0: *mut u8) -> i32 { - #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); - let result0 = T::is_round2_local_empty( - unsafe { RefreshSessionBorrow::lift(arg0 as u32 as usize) }.get(), - ); - match result0 { - true => 1, - false => 0, - } - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn _export_method_refresh_session_insert_relay_packages_cabi< - T: GuestRefreshSession, - >( - arg0: *mut u8, - arg1: *mut u8, - arg2: usize, - arg3: *mut u8, - arg4: usize, - ) { - #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); - let len0 = arg2; - let bytes0 = _rt::Vec::from_raw_parts(arg1.cast(), len0, len0); - let len1 = arg4; - let bytes1 = _rt::Vec::from_raw_parts(arg3.cast(), len1, len1); - T::insert_relay_packages( - unsafe { RefreshSessionBorrow::lift(arg0 as u32 as usize) } - .get(), - _rt::string_lift(bytes0), - _rt::string_lift(bytes1), - ); - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn _export_method_refresh_session_insert_relay_from_local_cabi< - T: GuestRefreshSession, - >(arg0: *mut u8, arg1: *mut u8, arg2: usize) { - #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); - let len0 = arg2; - let bytes0 = _rt::Vec::from_raw_parts(arg1.cast(), len0, len0); - T::insert_relay_from_local( - unsafe { RefreshSessionBorrow::lift(arg0 as u32 as usize) } - .get(), - _rt::string_lift(bytes0), - ); - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn _export_method_refresh_session_relay_sender_count_cabi< - T: GuestRefreshSession, - >(arg0: *mut u8) -> i32 { - #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); - let result0 = T::relay_sender_count( - unsafe { RefreshSessionBorrow::lift(arg0 as u32 as usize) }.get(), - ); - _rt::as_i32(result0) - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn _export_method_refresh_session_get_relay_packages_for_cabi< - T: GuestRefreshSession, - >(arg0: *mut u8, arg1: *mut u8, arg2: usize) -> *mut u8 { - #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); - let len0 = arg2; - let bytes0 = _rt::Vec::from_raw_parts(arg1.cast(), len0, len0); - let result1 = T::get_relay_packages_for( - unsafe { RefreshSessionBorrow::lift(arg0 as u32 as usize) } - .get(), - _rt::string_lift(bytes0), - ); - let ptr2 = (&raw mut _RET_AREA.0).cast::(); - let vec3 = (result1.into_bytes()).into_boxed_slice(); - let ptr3 = vec3.as_ptr().cast::(); - let len3 = vec3.len(); - ::core::mem::forget(vec3); - *ptr2.add(::core::mem::size_of::<*const u8>()).cast::() = len3; - *ptr2.add(0).cast::<*mut u8>() = ptr3.cast_mut(); - ptr2 - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn __post_return_method_refresh_session_get_relay_packages_for< - T: GuestRefreshSession, - >(arg0: *mut u8) { - let l0 = *arg0.add(0).cast::<*mut u8>(); - let l1 = *arg0 - .add(::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l0, l1, 1); - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn _export_method_refresh_session_set_refresh_creation_time_ms_cabi< - T: GuestRefreshSession, - >(arg0: *mut u8, arg1: i64) { - #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); - T::set_refresh_creation_time_ms( - unsafe { RefreshSessionBorrow::lift(arg0 as u32 as usize) } - .get(), - arg1, - ); - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn _export_method_refresh_session_get_refresh_creation_time_ms_cabi< - T: GuestRefreshSession, - >(arg0: *mut u8) -> i64 { - #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); - let result0 = T::get_refresh_creation_time_ms( - unsafe { RefreshSessionBorrow::lift(arg0 as u32 as usize) }.get(), - ); - _rt::as_i64(result0) - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn _export_method_refresh_session_set_refresh_id_cabi< - T: GuestRefreshSession, - >(arg0: *mut u8, arg1: *mut u8, arg2: usize) { - #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); - let len0 = arg2; - let bytes0 = _rt::Vec::from_raw_parts(arg1.cast(), len0, len0); - T::set_refresh_id( - unsafe { RefreshSessionBorrow::lift(arg0 as u32 as usize) } - .get(), - _rt::string_lift(bytes0), - ); - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn _export_method_refresh_session_get_refresh_id_cabi< - T: GuestRefreshSession, - >(arg0: *mut u8) -> *mut u8 { - #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); - let result0 = T::get_refresh_id( - unsafe { RefreshSessionBorrow::lift(arg0 as u32 as usize) }.get(), - ); - let ptr1 = (&raw mut _RET_AREA.0).cast::(); - let vec2 = (result0.into_bytes()).into_boxed_slice(); - let ptr2 = vec2.as_ptr().cast::(); - let len2 = vec2.len(); - ::core::mem::forget(vec2); - *ptr1.add(::core::mem::size_of::<*const u8>()).cast::() = len2; - *ptr1.add(0).cast::<*mut u8>() = ptr2.cast_mut(); - ptr1 - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn __post_return_method_refresh_session_get_refresh_id< - T: GuestRefreshSession, - >(arg0: *mut u8) { - let l0 = *arg0.add(0).cast::<*mut u8>(); - let l1 = *arg0 - .add(::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l0, l1, 1); - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn _export_method_refresh_session_set_refresh_threshold_amount_cabi< - T: GuestRefreshSession, - >(arg0: *mut u8, arg1: i64) { - #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); - T::set_refresh_threshold_amount( - unsafe { RefreshSessionBorrow::lift(arg0 as u32 as usize) } - .get(), - arg1, - ); - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn _export_method_refresh_session_get_refresh_threshold_amount_cabi< - T: GuestRefreshSession, - >(arg0: *mut u8) -> i64 { - #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); - let result0 = T::get_refresh_threshold_amount( - unsafe { RefreshSessionBorrow::lift(arg0 as u32 as usize) }.get(), - ); - _rt::as_i64(result0) - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn _export_method_refresh_session_set_refresh_interval_cabi< - T: GuestRefreshSession, - >(arg0: *mut u8, arg1: i64) { - #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); - T::set_refresh_interval( - unsafe { RefreshSessionBorrow::lift(arg0 as u32 as usize) } - .get(), - arg1, - ); - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn _export_method_refresh_session_get_refresh_interval_cabi< - T: GuestRefreshSession, - >(arg0: *mut u8) -> i64 { - #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); - let result0 = T::get_refresh_interval( - unsafe { RefreshSessionBorrow::lift(arg0 as u32 as usize) }.get(), - ); - _rt::as_i64(result0) - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn _export_constructor_auth_signer_cabi( - arg0: *mut u8, - arg1: usize, - ) -> i32 { - #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); - let len0 = arg1; - let bytes0 = _rt::Vec::from_raw_parts(arg0.cast(), len0, len0); - let result1 = AuthSigner::new(T::new(_rt::string_lift(bytes0))); - (result1).take_handle() as i32 - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn _export_method_auth_signer_sign_cabi( - arg0: *mut u8, - arg1: *mut u8, - arg2: usize, - ) -> *mut u8 { - #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); - let len0 = arg2; - let result1 = T::sign( - unsafe { AuthSignerBorrow::lift(arg0 as u32 as usize) }.get(), - _rt::Vec::from_raw_parts(arg1.cast(), len0, len0), - ); - let ptr2 = (&raw mut _RET_AREA.0).cast::(); - match result1 { - Ok(e) => { - *ptr2.add(0).cast::() = (0i32) as u8; - let vec3 = (e.into_bytes()).into_boxed_slice(); - let ptr3 = vec3.as_ptr().cast::(); - let len3 = vec3.len(); - ::core::mem::forget(vec3); - *ptr2 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::() = len3; - *ptr2 - .add(::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>() = ptr3.cast_mut(); - } - Err(e) => { - *ptr2.add(0).cast::() = (1i32) as u8; - match e { - ThresholdError::InvalidInput(e) => { - *ptr2 - .add(::core::mem::size_of::<*const u8>()) - .cast::() = (0i32) as u8; - let vec4 = (e.into_bytes()).into_boxed_slice(); - let ptr4 = vec4.as_ptr().cast::(); - let len4 = vec4.len(); - ::core::mem::forget(vec4); - *ptr2 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::() = len4; - *ptr2 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>() = ptr4.cast_mut(); - } - ThresholdError::CryptoError(e) => { - *ptr2 - .add(::core::mem::size_of::<*const u8>()) - .cast::() = (1i32) as u8; - let vec5 = (e.into_bytes()).into_boxed_slice(); - let ptr5 = vec5.as_ptr().cast::(); - let len5 = vec5.len(); - ::core::mem::forget(vec5); - *ptr2 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::() = len5; - *ptr2 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>() = ptr5.cast_mut(); - } - ThresholdError::SerializationError(e) => { - *ptr2 - .add(::core::mem::size_of::<*const u8>()) - .cast::() = (2i32) as u8; - let vec6 = (e.into_bytes()).into_boxed_slice(); - let ptr6 = vec6.as_ptr().cast::(); - let len6 = vec6.len(); - ::core::mem::forget(vec6); - *ptr2 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::() = len6; - *ptr2 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>() = ptr6.cast_mut(); - } - } - } - }; - ptr2 - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn __post_return_method_auth_signer_sign( - arg0: *mut u8, - ) { - let l0 = i32::from(*arg0.add(0).cast::()); - match l0 { - 0 => { - let l1 = *arg0 - .add(::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l2 = *arg0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l1, l2, 1); - } - _ => { - let l3 = i32::from( - *arg0.add(::core::mem::size_of::<*const u8>()).cast::(), - ); - match l3 { - 0 => { - let l4 = *arg0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l5 = *arg0 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l4, l5, 1); - } - 1 => { - let l6 = *arg0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l7 = *arg0 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l6, l7, 1); - } - _ => { - let l8 = *arg0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l9 = *arg0 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l8, l9, 1); - } - } - } - } - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn _export_method_auth_signer_public_key_cabi< - T: GuestAuthSigner, - >(arg0: *mut u8) -> *mut u8 { - #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); - let result0 = T::public_key( - unsafe { AuthSignerBorrow::lift(arg0 as u32 as usize) }.get(), - ); - let ptr1 = (&raw mut _RET_AREA.0).cast::(); - match result0 { - Ok(e) => { - *ptr1.add(0).cast::() = (0i32) as u8; - let vec2 = (e.into_bytes()).into_boxed_slice(); - let ptr2 = vec2.as_ptr().cast::(); - let len2 = vec2.len(); - ::core::mem::forget(vec2); - *ptr1 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::() = len2; - *ptr1 - .add(::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>() = ptr2.cast_mut(); - } - Err(e) => { - *ptr1.add(0).cast::() = (1i32) as u8; - match e { - ThresholdError::InvalidInput(e) => { - *ptr1 - .add(::core::mem::size_of::<*const u8>()) - .cast::() = (0i32) as u8; - let vec3 = (e.into_bytes()).into_boxed_slice(); - let ptr3 = vec3.as_ptr().cast::(); - let len3 = vec3.len(); - ::core::mem::forget(vec3); - *ptr1 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::() = len3; - *ptr1 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>() = ptr3.cast_mut(); - } - ThresholdError::CryptoError(e) => { - *ptr1 - .add(::core::mem::size_of::<*const u8>()) - .cast::() = (1i32) as u8; - let vec4 = (e.into_bytes()).into_boxed_slice(); - let ptr4 = vec4.as_ptr().cast::(); - let len4 = vec4.len(); - ::core::mem::forget(vec4); - *ptr1 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::() = len4; - *ptr1 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>() = ptr4.cast_mut(); - } - ThresholdError::SerializationError(e) => { - *ptr1 - .add(::core::mem::size_of::<*const u8>()) - .cast::() = (2i32) as u8; - let vec5 = (e.into_bytes()).into_boxed_slice(); - let ptr5 = vec5.as_ptr().cast::(); - let len5 = vec5.len(); - ::core::mem::forget(vec5); - *ptr1 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::() = len5; - *ptr1 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>() = ptr5.cast_mut(); - } - } - } - }; - ptr1 - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn __post_return_method_auth_signer_public_key< - T: GuestAuthSigner, - >(arg0: *mut u8) { - let l0 = i32::from(*arg0.add(0).cast::()); - match l0 { - 0 => { - let l1 = *arg0 - .add(::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l2 = *arg0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l1, l2, 1); - } - _ => { - let l3 = i32::from( - *arg0.add(::core::mem::size_of::<*const u8>()).cast::(), - ); - match l3 { - 0 => { - let l4 = *arg0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l5 = *arg0 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l4, l5, 1); - } - 1 => { - let l6 = *arg0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l7 = *arg0 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l6, l7, 1); - } - _ => { - let l8 = *arg0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l9 = *arg0 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l8, l9, 1); - } - } - } - } - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn _export_constructor_threshold_session_cabi< - T: GuestThresholdSession, - >() -> i32 { - #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); - let result0 = ThresholdSession::new(T::new()); - (result0).take_handle() as i32 - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn _export_method_threshold_session_dkg_part1_cabi< - T: GuestThresholdSession, - >( - arg0: *mut u8, - arg1: i32, - arg2: i32, - arg3: *mut u8, - arg4: usize, - arg5: *mut u8, - arg6: usize, - ) -> *mut u8 { - #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); - let len0 = arg4; - let bytes0 = _rt::Vec::from_raw_parts(arg3.cast(), len0, len0); - let len1 = arg6; - let bytes1 = _rt::Vec::from_raw_parts(arg5.cast(), len1, len1); - let result2 = T::dkg_part1( - unsafe { ThresholdSessionBorrow::lift(arg0 as u32 as usize) } - .get(), - arg1 as u32, - arg2 as u32, - _rt::string_lift(bytes0), - _rt::string_lift(bytes1), - ); - let ptr3 = (&raw mut _RET_AREA.0).cast::(); - match result2 { - Ok(e) => { - *ptr3.add(0).cast::() = (0i32) as u8; - let DkgRound1Output { - round1_package_json: round1_package_json4, - secret: secret4, - } = e; - let vec5 = (round1_package_json4.into_bytes()) - .into_boxed_slice(); - let ptr5 = vec5.as_ptr().cast::(); - let len5 = vec5.len(); - ::core::mem::forget(vec5); - *ptr3 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::() = len5; - *ptr3 - .add(::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>() = ptr5.cast_mut(); - *ptr3 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::() = (secret4).take_handle() as i32; - } - Err(e) => { - *ptr3.add(0).cast::() = (1i32) as u8; - match e { - ThresholdError::InvalidInput(e) => { - *ptr3 - .add(::core::mem::size_of::<*const u8>()) - .cast::() = (0i32) as u8; - let vec6 = (e.into_bytes()).into_boxed_slice(); - let ptr6 = vec6.as_ptr().cast::(); - let len6 = vec6.len(); - ::core::mem::forget(vec6); - *ptr3 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::() = len6; - *ptr3 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>() = ptr6.cast_mut(); - } - ThresholdError::CryptoError(e) => { - *ptr3 - .add(::core::mem::size_of::<*const u8>()) - .cast::() = (1i32) as u8; - let vec7 = (e.into_bytes()).into_boxed_slice(); - let ptr7 = vec7.as_ptr().cast::(); - let len7 = vec7.len(); - ::core::mem::forget(vec7); - *ptr3 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::() = len7; - *ptr3 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>() = ptr7.cast_mut(); - } - ThresholdError::SerializationError(e) => { - *ptr3 - .add(::core::mem::size_of::<*const u8>()) - .cast::() = (2i32) as u8; - let vec8 = (e.into_bytes()).into_boxed_slice(); - let ptr8 = vec8.as_ptr().cast::(); - let len8 = vec8.len(); - ::core::mem::forget(vec8); - *ptr3 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::() = len8; - *ptr3 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>() = ptr8.cast_mut(); - } - } - } - }; - ptr3 - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn __post_return_method_threshold_session_dkg_part1< - T: GuestThresholdSession, - >(arg0: *mut u8) { - let l0 = i32::from(*arg0.add(0).cast::()); - match l0 { - 0 => { - let l1 = *arg0 - .add(::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l2 = *arg0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l1, l2, 1); - } - _ => { - let l3 = i32::from( - *arg0.add(::core::mem::size_of::<*const u8>()).cast::(), - ); - match l3 { - 0 => { - let l4 = *arg0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l5 = *arg0 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l4, l5, 1); - } - 1 => { - let l6 = *arg0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l7 = *arg0 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l6, l7, 1); - } - _ => { - let l8 = *arg0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l9 = *arg0 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l8, l9, 1); - } - } - } - } - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn _export_method_threshold_session_dkg_part2_cabi< - T: GuestThresholdSession, - >( - arg0: *mut u8, - arg1: i32, - arg2: *mut u8, - arg3: usize, - arg4: *mut u8, - arg5: usize, - ) -> *mut u8 { - #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); - let len0 = arg3; - let bytes0 = _rt::Vec::from_raw_parts(arg2.cast(), len0, len0); - let len1 = arg5; - let bytes1 = _rt::Vec::from_raw_parts(arg4.cast(), len1, len1); - let result2 = T::dkg_part2( - unsafe { ThresholdSessionBorrow::lift(arg0 as u32 as usize) } - .get(), - unsafe { Round1Secret::from_handle(arg1 as u32) }, - _rt::string_lift(bytes0), - _rt::string_lift(bytes1), - ); - let ptr3 = (&raw mut _RET_AREA.0).cast::(); - match result2 { - Ok(e) => { - *ptr3.add(0).cast::() = (0i32) as u8; - let DkgRound2Output { - round2_packages_json: round2_packages_json4, - secret: secret4, - } = e; - let vec5 = (round2_packages_json4.into_bytes()) - .into_boxed_slice(); - let ptr5 = vec5.as_ptr().cast::(); - let len5 = vec5.len(); - ::core::mem::forget(vec5); - *ptr3 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::() = len5; - *ptr3 - .add(::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>() = ptr5.cast_mut(); - *ptr3 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::() = (secret4).take_handle() as i32; - } - Err(e) => { - *ptr3.add(0).cast::() = (1i32) as u8; - match e { - ThresholdError::InvalidInput(e) => { - *ptr3 - .add(::core::mem::size_of::<*const u8>()) - .cast::() = (0i32) as u8; - let vec6 = (e.into_bytes()).into_boxed_slice(); - let ptr6 = vec6.as_ptr().cast::(); - let len6 = vec6.len(); - ::core::mem::forget(vec6); - *ptr3 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::() = len6; - *ptr3 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>() = ptr6.cast_mut(); - } - ThresholdError::CryptoError(e) => { - *ptr3 - .add(::core::mem::size_of::<*const u8>()) - .cast::() = (1i32) as u8; - let vec7 = (e.into_bytes()).into_boxed_slice(); - let ptr7 = vec7.as_ptr().cast::(); - let len7 = vec7.len(); - ::core::mem::forget(vec7); - *ptr3 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::() = len7; - *ptr3 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>() = ptr7.cast_mut(); - } - ThresholdError::SerializationError(e) => { - *ptr3 - .add(::core::mem::size_of::<*const u8>()) - .cast::() = (2i32) as u8; - let vec8 = (e.into_bytes()).into_boxed_slice(); - let ptr8 = vec8.as_ptr().cast::(); - let len8 = vec8.len(); - ::core::mem::forget(vec8); - *ptr3 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::() = len8; - *ptr3 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>() = ptr8.cast_mut(); - } - } - } - }; - ptr3 - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn __post_return_method_threshold_session_dkg_part2< - T: GuestThresholdSession, - >(arg0: *mut u8) { - let l0 = i32::from(*arg0.add(0).cast::()); - match l0 { - 0 => { - let l1 = *arg0 - .add(::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l2 = *arg0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l1, l2, 1); - } - _ => { - let l3 = i32::from( - *arg0.add(::core::mem::size_of::<*const u8>()).cast::(), - ); - match l3 { - 0 => { - let l4 = *arg0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l5 = *arg0 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l4, l5, 1); - } - 1 => { - let l6 = *arg0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l7 = *arg0 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l6, l7, 1); - } - _ => { - let l8 = *arg0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l9 = *arg0 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l8, l9, 1); - } - } - } - } - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn _export_method_threshold_session_dkg_part3_cabi< - T: GuestThresholdSession, - >( - arg0: *mut u8, - arg1: i32, - arg2: *mut u8, - arg3: usize, - arg4: *mut u8, - arg5: usize, - arg6: *mut u8, - arg7: usize, - ) -> *mut u8 { - #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); - let len0 = arg3; - let bytes0 = _rt::Vec::from_raw_parts(arg2.cast(), len0, len0); - let len1 = arg5; - let bytes1 = _rt::Vec::from_raw_parts(arg4.cast(), len1, len1); - let len2 = arg7; - let bytes2 = _rt::Vec::from_raw_parts(arg6.cast(), len2, len2); - let result3 = T::dkg_part3( - unsafe { ThresholdSessionBorrow::lift(arg0 as u32 as usize) } - .get(), - unsafe { Round2Secret::from_handle(arg1 as u32) }, - _rt::string_lift(bytes0), - _rt::string_lift(bytes1), - _rt::string_lift(bytes2), - ); - let ptr4 = (&raw mut _RET_AREA.0).cast::(); - match result3 { - Ok(e) => { - *ptr4.add(0).cast::() = (0i32) as u8; - let DkgRound3Output { - key_package_json: key_package_json5, - public_key_package_json: public_key_package_json5, - } = e; - let vec6 = (key_package_json5.into_bytes()) - .into_boxed_slice(); - let ptr6 = vec6.as_ptr().cast::(); - let len6 = vec6.len(); - ::core::mem::forget(vec6); - *ptr4 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::() = len6; - *ptr4 - .add(::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>() = ptr6.cast_mut(); - let vec7 = (public_key_package_json5.into_bytes()) - .into_boxed_slice(); - let ptr7 = vec7.as_ptr().cast::(); - let len7 = vec7.len(); - ::core::mem::forget(vec7); - *ptr4 - .add(4 * ::core::mem::size_of::<*const u8>()) - .cast::() = len7; - *ptr4 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>() = ptr7.cast_mut(); - } - Err(e) => { - *ptr4.add(0).cast::() = (1i32) as u8; - match e { - ThresholdError::InvalidInput(e) => { - *ptr4 - .add(::core::mem::size_of::<*const u8>()) - .cast::() = (0i32) as u8; - let vec8 = (e.into_bytes()).into_boxed_slice(); - let ptr8 = vec8.as_ptr().cast::(); - let len8 = vec8.len(); - ::core::mem::forget(vec8); - *ptr4 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::() = len8; - *ptr4 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>() = ptr8.cast_mut(); - } - ThresholdError::CryptoError(e) => { - *ptr4 - .add(::core::mem::size_of::<*const u8>()) - .cast::() = (1i32) as u8; - let vec9 = (e.into_bytes()).into_boxed_slice(); - let ptr9 = vec9.as_ptr().cast::(); - let len9 = vec9.len(); - ::core::mem::forget(vec9); - *ptr4 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::() = len9; - *ptr4 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>() = ptr9.cast_mut(); - } - ThresholdError::SerializationError(e) => { - *ptr4 - .add(::core::mem::size_of::<*const u8>()) - .cast::() = (2i32) as u8; - let vec10 = (e.into_bytes()).into_boxed_slice(); - let ptr10 = vec10.as_ptr().cast::(); - let len10 = vec10.len(); - ::core::mem::forget(vec10); - *ptr4 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::() = len10; - *ptr4 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>() = ptr10.cast_mut(); - } - } - } - }; - ptr4 - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn __post_return_method_threshold_session_dkg_part3< - T: GuestThresholdSession, - >(arg0: *mut u8) { - let l0 = i32::from(*arg0.add(0).cast::()); - match l0 { - 0 => { - let l1 = *arg0 - .add(::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l2 = *arg0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l1, l2, 1); - let l3 = *arg0 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l4 = *arg0 - .add(4 * ::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l3, l4, 1); - } - _ => { - let l5 = i32::from( - *arg0.add(::core::mem::size_of::<*const u8>()).cast::(), - ); - match l5 { - 0 => { - let l6 = *arg0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l7 = *arg0 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l6, l7, 1); - } - 1 => { - let l8 = *arg0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l9 = *arg0 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l8, l9, 1); - } - _ => { - let l10 = *arg0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l11 = *arg0 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l10, l11, 1); - } - } - } - } - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn _export_method_threshold_session_dkg_part3_receive_cabi< - T: GuestThresholdSession, - >( - arg0: *mut u8, - arg1: *mut u8, - arg2: usize, - arg3: *mut u8, - arg4: usize, - arg5: *mut u8, - arg6: usize, - arg7: i32, - arg8: i32, - arg9: *mut u8, - arg10: usize, - ) -> *mut u8 { - #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); - let len0 = arg2; - let bytes0 = _rt::Vec::from_raw_parts(arg1.cast(), len0, len0); - let len1 = arg4; - let bytes1 = _rt::Vec::from_raw_parts(arg3.cast(), len1, len1); - let len2 = arg6; - let bytes2 = _rt::Vec::from_raw_parts(arg5.cast(), len2, len2); - let len3 = arg10; - let bytes3 = _rt::Vec::from_raw_parts(arg9.cast(), len3, len3); - let result4 = T::dkg_part3_receive( - unsafe { ThresholdSessionBorrow::lift(arg0 as u32 as usize) } - .get(), - _rt::string_lift(bytes0), - _rt::string_lift(bytes1), - _rt::string_lift(bytes2), - arg7 as u32, - arg8 as u32, - _rt::string_lift(bytes3), - ); - let ptr5 = (&raw mut _RET_AREA.0).cast::(); - match result4 { - Ok(e) => { - *ptr5.add(0).cast::() = (0i32) as u8; - let DkgRound3Output { - key_package_json: key_package_json6, - public_key_package_json: public_key_package_json6, - } = e; - let vec7 = (key_package_json6.into_bytes()) - .into_boxed_slice(); - let ptr7 = vec7.as_ptr().cast::(); - let len7 = vec7.len(); - ::core::mem::forget(vec7); - *ptr5 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::() = len7; - *ptr5 - .add(::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>() = ptr7.cast_mut(); - let vec8 = (public_key_package_json6.into_bytes()) - .into_boxed_slice(); - let ptr8 = vec8.as_ptr().cast::(); - let len8 = vec8.len(); - ::core::mem::forget(vec8); - *ptr5 - .add(4 * ::core::mem::size_of::<*const u8>()) - .cast::() = len8; - *ptr5 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>() = ptr8.cast_mut(); - } - Err(e) => { - *ptr5.add(0).cast::() = (1i32) as u8; - match e { - ThresholdError::InvalidInput(e) => { - *ptr5 - .add(::core::mem::size_of::<*const u8>()) - .cast::() = (0i32) as u8; - let vec9 = (e.into_bytes()).into_boxed_slice(); - let ptr9 = vec9.as_ptr().cast::(); - let len9 = vec9.len(); - ::core::mem::forget(vec9); - *ptr5 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::() = len9; - *ptr5 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>() = ptr9.cast_mut(); - } - ThresholdError::CryptoError(e) => { - *ptr5 - .add(::core::mem::size_of::<*const u8>()) - .cast::() = (1i32) as u8; - let vec10 = (e.into_bytes()).into_boxed_slice(); - let ptr10 = vec10.as_ptr().cast::(); - let len10 = vec10.len(); - ::core::mem::forget(vec10); - *ptr5 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::() = len10; - *ptr5 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>() = ptr10.cast_mut(); - } - ThresholdError::SerializationError(e) => { - *ptr5 - .add(::core::mem::size_of::<*const u8>()) - .cast::() = (2i32) as u8; - let vec11 = (e.into_bytes()).into_boxed_slice(); - let ptr11 = vec11.as_ptr().cast::(); - let len11 = vec11.len(); - ::core::mem::forget(vec11); - *ptr5 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::() = len11; - *ptr5 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>() = ptr11.cast_mut(); - } - } - } - }; - ptr5 - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn __post_return_method_threshold_session_dkg_part3_receive< - T: GuestThresholdSession, - >(arg0: *mut u8) { - let l0 = i32::from(*arg0.add(0).cast::()); - match l0 { - 0 => { - let l1 = *arg0 - .add(::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l2 = *arg0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l1, l2, 1); - let l3 = *arg0 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l4 = *arg0 - .add(4 * ::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l3, l4, 1); - } - _ => { - let l5 = i32::from( - *arg0.add(::core::mem::size_of::<*const u8>()).cast::(), - ); - match l5 { - 0 => { - let l6 = *arg0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l7 = *arg0 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l6, l7, 1); - } - 1 => { - let l8 = *arg0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l9 = *arg0 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l8, l9, 1); - } - _ => { - let l10 = *arg0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l11 = *arg0 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l10, l11, 1); - } - } - } - } - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn _export_method_threshold_session_dkg_refresh_part1_cabi< - T: GuestThresholdSession, - >( - arg0: *mut u8, - arg1: *mut u8, - arg2: usize, - arg3: i32, - arg4: i32, - arg5: *mut u8, - arg6: usize, - ) -> *mut u8 { - #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); - let len0 = arg2; - let bytes0 = _rt::Vec::from_raw_parts(arg1.cast(), len0, len0); - let len1 = arg6; - let result2 = T::dkg_refresh_part1( - unsafe { ThresholdSessionBorrow::lift(arg0 as u32 as usize) } - .get(), - _rt::string_lift(bytes0), - arg3 as u32, - arg4 as u32, - _rt::Vec::from_raw_parts(arg5.cast(), len1, len1), - ); - let ptr3 = (&raw mut _RET_AREA.0).cast::(); - match result2 { - Ok(e) => { - *ptr3.add(0).cast::() = (0i32) as u8; - let DkgRefreshRound1Output { - round1_package_json: round1_package_json4, - coefficients_json: coefficients_json4, - secret: secret4, - } = e; - let vec5 = (round1_package_json4.into_bytes()) - .into_boxed_slice(); - let ptr5 = vec5.as_ptr().cast::(); - let len5 = vec5.len(); - ::core::mem::forget(vec5); - *ptr3 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::() = len5; - *ptr3 - .add(::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>() = ptr5.cast_mut(); - let vec6 = (coefficients_json4.into_bytes()) - .into_boxed_slice(); - let ptr6 = vec6.as_ptr().cast::(); - let len6 = vec6.len(); - ::core::mem::forget(vec6); - *ptr3 - .add(4 * ::core::mem::size_of::<*const u8>()) - .cast::() = len6; - *ptr3 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>() = ptr6.cast_mut(); - *ptr3 - .add(5 * ::core::mem::size_of::<*const u8>()) - .cast::() = (secret4).take_handle() as i32; - } - Err(e) => { - *ptr3.add(0).cast::() = (1i32) as u8; - match e { - ThresholdError::InvalidInput(e) => { - *ptr3 - .add(::core::mem::size_of::<*const u8>()) - .cast::() = (0i32) as u8; - let vec7 = (e.into_bytes()).into_boxed_slice(); - let ptr7 = vec7.as_ptr().cast::(); - let len7 = vec7.len(); - ::core::mem::forget(vec7); - *ptr3 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::() = len7; - *ptr3 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>() = ptr7.cast_mut(); - } - ThresholdError::CryptoError(e) => { - *ptr3 - .add(::core::mem::size_of::<*const u8>()) - .cast::() = (1i32) as u8; - let vec8 = (e.into_bytes()).into_boxed_slice(); - let ptr8 = vec8.as_ptr().cast::(); - let len8 = vec8.len(); - ::core::mem::forget(vec8); - *ptr3 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::() = len8; - *ptr3 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>() = ptr8.cast_mut(); - } - ThresholdError::SerializationError(e) => { - *ptr3 - .add(::core::mem::size_of::<*const u8>()) - .cast::() = (2i32) as u8; - let vec9 = (e.into_bytes()).into_boxed_slice(); - let ptr9 = vec9.as_ptr().cast::(); - let len9 = vec9.len(); - ::core::mem::forget(vec9); - *ptr3 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::() = len9; - *ptr3 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>() = ptr9.cast_mut(); - } - } - } - }; - ptr3 - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn __post_return_method_threshold_session_dkg_refresh_part1< - T: GuestThresholdSession, - >(arg0: *mut u8) { - let l0 = i32::from(*arg0.add(0).cast::()); - match l0 { - 0 => { - let l1 = *arg0 - .add(::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l2 = *arg0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l1, l2, 1); - let l3 = *arg0 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l4 = *arg0 - .add(4 * ::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l3, l4, 1); - } - _ => { - let l5 = i32::from( - *arg0.add(::core::mem::size_of::<*const u8>()).cast::(), - ); - match l5 { - 0 => { - let l6 = *arg0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l7 = *arg0 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l6, l7, 1); - } - 1 => { - let l8 = *arg0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l9 = *arg0 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l8, l9, 1); - } - _ => { - let l10 = *arg0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l11 = *arg0 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l10, l11, 1); - } - } - } - } - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn _export_method_threshold_session_dkg_refresh_part2_cabi< - T: GuestThresholdSession, - >(arg0: *mut u8, arg1: i32, arg2: *mut u8, arg3: usize) -> *mut u8 { - #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); - let len0 = arg3; - let bytes0 = _rt::Vec::from_raw_parts(arg2.cast(), len0, len0); - let result1 = T::dkg_refresh_part2( - unsafe { ThresholdSessionBorrow::lift(arg0 as u32 as usize) } - .get(), - unsafe { Round1Secret::from_handle(arg1 as u32) }, - _rt::string_lift(bytes0), - ); - let ptr2 = (&raw mut _RET_AREA.0).cast::(); - match result1 { - Ok(e) => { - *ptr2.add(0).cast::() = (0i32) as u8; - let DkgRound2Output { - round2_packages_json: round2_packages_json3, - secret: secret3, - } = e; - let vec4 = (round2_packages_json3.into_bytes()) - .into_boxed_slice(); - let ptr4 = vec4.as_ptr().cast::(); - let len4 = vec4.len(); - ::core::mem::forget(vec4); - *ptr2 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::() = len4; - *ptr2 - .add(::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>() = ptr4.cast_mut(); - *ptr2 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::() = (secret3).take_handle() as i32; - } - Err(e) => { - *ptr2.add(0).cast::() = (1i32) as u8; - match e { - ThresholdError::InvalidInput(e) => { - *ptr2 - .add(::core::mem::size_of::<*const u8>()) - .cast::() = (0i32) as u8; - let vec5 = (e.into_bytes()).into_boxed_slice(); - let ptr5 = vec5.as_ptr().cast::(); - let len5 = vec5.len(); - ::core::mem::forget(vec5); - *ptr2 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::() = len5; - *ptr2 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>() = ptr5.cast_mut(); - } - ThresholdError::CryptoError(e) => { - *ptr2 - .add(::core::mem::size_of::<*const u8>()) - .cast::() = (1i32) as u8; - let vec6 = (e.into_bytes()).into_boxed_slice(); - let ptr6 = vec6.as_ptr().cast::(); - let len6 = vec6.len(); - ::core::mem::forget(vec6); - *ptr2 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::() = len6; - *ptr2 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>() = ptr6.cast_mut(); - } - ThresholdError::SerializationError(e) => { - *ptr2 - .add(::core::mem::size_of::<*const u8>()) - .cast::() = (2i32) as u8; - let vec7 = (e.into_bytes()).into_boxed_slice(); - let ptr7 = vec7.as_ptr().cast::(); - let len7 = vec7.len(); - ::core::mem::forget(vec7); - *ptr2 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::() = len7; - *ptr2 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>() = ptr7.cast_mut(); - } - } - } - }; - ptr2 - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn __post_return_method_threshold_session_dkg_refresh_part2< - T: GuestThresholdSession, - >(arg0: *mut u8) { - let l0 = i32::from(*arg0.add(0).cast::()); - match l0 { - 0 => { - let l1 = *arg0 - .add(::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l2 = *arg0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l1, l2, 1); - } - _ => { - let l3 = i32::from( - *arg0.add(::core::mem::size_of::<*const u8>()).cast::(), - ); - match l3 { - 0 => { - let l4 = *arg0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l5 = *arg0 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l4, l5, 1); - } - 1 => { - let l6 = *arg0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l7 = *arg0 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l6, l7, 1); - } - _ => { - let l8 = *arg0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l9 = *arg0 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l8, l9, 1); - } - } - } - } - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn _export_method_threshold_session_dkg_refresh_part3_cabi< - T: GuestThresholdSession, - >( - arg0: *mut u8, - arg1: i32, - arg2: *mut u8, - arg3: usize, - arg4: *mut u8, - arg5: usize, - arg6: *mut u8, - arg7: usize, - arg8: *mut u8, - arg9: usize, - ) -> *mut u8 { - #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); - let len0 = arg3; - let bytes0 = _rt::Vec::from_raw_parts(arg2.cast(), len0, len0); - let len1 = arg5; - let bytes1 = _rt::Vec::from_raw_parts(arg4.cast(), len1, len1); - let len2 = arg7; - let bytes2 = _rt::Vec::from_raw_parts(arg6.cast(), len2, len2); - let len3 = arg9; - let bytes3 = _rt::Vec::from_raw_parts(arg8.cast(), len3, len3); - let result4 = T::dkg_refresh_part3( - unsafe { ThresholdSessionBorrow::lift(arg0 as u32 as usize) } - .get(), - unsafe { Round2Secret::from_handle(arg1 as u32) }, - _rt::string_lift(bytes0), - _rt::string_lift(bytes1), - _rt::string_lift(bytes2), - _rt::string_lift(bytes3), - ); - let ptr5 = (&raw mut _RET_AREA.0).cast::(); - match result4 { - Ok(e) => { - *ptr5.add(0).cast::() = (0i32) as u8; - let DkgRound3Output { - key_package_json: key_package_json6, - public_key_package_json: public_key_package_json6, - } = e; - let vec7 = (key_package_json6.into_bytes()) - .into_boxed_slice(); - let ptr7 = vec7.as_ptr().cast::(); - let len7 = vec7.len(); - ::core::mem::forget(vec7); - *ptr5 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::() = len7; - *ptr5 - .add(::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>() = ptr7.cast_mut(); - let vec8 = (public_key_package_json6.into_bytes()) - .into_boxed_slice(); - let ptr8 = vec8.as_ptr().cast::(); - let len8 = vec8.len(); - ::core::mem::forget(vec8); - *ptr5 - .add(4 * ::core::mem::size_of::<*const u8>()) - .cast::() = len8; - *ptr5 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>() = ptr8.cast_mut(); - } - Err(e) => { - *ptr5.add(0).cast::() = (1i32) as u8; - match e { - ThresholdError::InvalidInput(e) => { - *ptr5 - .add(::core::mem::size_of::<*const u8>()) - .cast::() = (0i32) as u8; - let vec9 = (e.into_bytes()).into_boxed_slice(); - let ptr9 = vec9.as_ptr().cast::(); - let len9 = vec9.len(); - ::core::mem::forget(vec9); - *ptr5 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::() = len9; - *ptr5 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>() = ptr9.cast_mut(); - } - ThresholdError::CryptoError(e) => { - *ptr5 - .add(::core::mem::size_of::<*const u8>()) - .cast::() = (1i32) as u8; - let vec10 = (e.into_bytes()).into_boxed_slice(); - let ptr10 = vec10.as_ptr().cast::(); - let len10 = vec10.len(); - ::core::mem::forget(vec10); - *ptr5 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::() = len10; - *ptr5 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>() = ptr10.cast_mut(); - } - ThresholdError::SerializationError(e) => { - *ptr5 - .add(::core::mem::size_of::<*const u8>()) - .cast::() = (2i32) as u8; - let vec11 = (e.into_bytes()).into_boxed_slice(); - let ptr11 = vec11.as_ptr().cast::(); - let len11 = vec11.len(); - ::core::mem::forget(vec11); - *ptr5 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::() = len11; - *ptr5 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>() = ptr11.cast_mut(); - } - } - } - }; - ptr5 - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn __post_return_method_threshold_session_dkg_refresh_part3< - T: GuestThresholdSession, - >(arg0: *mut u8) { - let l0 = i32::from(*arg0.add(0).cast::()); - match l0 { - 0 => { - let l1 = *arg0 - .add(::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l2 = *arg0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l1, l2, 1); - let l3 = *arg0 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l4 = *arg0 - .add(4 * ::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l3, l4, 1); - } - _ => { - let l5 = i32::from( - *arg0.add(::core::mem::size_of::<*const u8>()).cast::(), - ); - match l5 { - 0 => { - let l6 = *arg0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l7 = *arg0 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l6, l7, 1); - } - 1 => { - let l8 = *arg0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l9 = *arg0 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l8, l9, 1); - } - _ => { - let l10 = *arg0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l11 = *arg0 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l10, l11, 1); - } - } - } - } - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn _export_method_threshold_session_new_nonce_cabi< - T: GuestThresholdSession, - >(arg0: *mut u8, arg1: *mut u8, arg2: usize) -> *mut u8 { - #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); - let len0 = arg2; - let bytes0 = _rt::Vec::from_raw_parts(arg1.cast(), len0, len0); - let result1 = T::new_nonce( - unsafe { ThresholdSessionBorrow::lift(arg0 as u32 as usize) } - .get(), - _rt::string_lift(bytes0), - ); - let ptr2 = (&raw mut _RET_AREA.0).cast::(); - match result1 { - Ok(e) => { - *ptr2.add(0).cast::() = (0i32) as u8; - let NonceOutput { - commitments_json: commitments_json3, - nonce: nonce3, - } = e; - let vec4 = (commitments_json3.into_bytes()) - .into_boxed_slice(); - let ptr4 = vec4.as_ptr().cast::(); - let len4 = vec4.len(); - ::core::mem::forget(vec4); - *ptr2 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::() = len4; - *ptr2 - .add(::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>() = ptr4.cast_mut(); - *ptr2 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::() = (nonce3).take_handle() as i32; - } - Err(e) => { - *ptr2.add(0).cast::() = (1i32) as u8; - match e { - ThresholdError::InvalidInput(e) => { - *ptr2 - .add(::core::mem::size_of::<*const u8>()) - .cast::() = (0i32) as u8; - let vec5 = (e.into_bytes()).into_boxed_slice(); - let ptr5 = vec5.as_ptr().cast::(); - let len5 = vec5.len(); - ::core::mem::forget(vec5); - *ptr2 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::() = len5; - *ptr2 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>() = ptr5.cast_mut(); - } - ThresholdError::CryptoError(e) => { - *ptr2 - .add(::core::mem::size_of::<*const u8>()) - .cast::() = (1i32) as u8; - let vec6 = (e.into_bytes()).into_boxed_slice(); - let ptr6 = vec6.as_ptr().cast::(); - let len6 = vec6.len(); - ::core::mem::forget(vec6); - *ptr2 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::() = len6; - *ptr2 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>() = ptr6.cast_mut(); - } - ThresholdError::SerializationError(e) => { - *ptr2 - .add(::core::mem::size_of::<*const u8>()) - .cast::() = (2i32) as u8; - let vec7 = (e.into_bytes()).into_boxed_slice(); - let ptr7 = vec7.as_ptr().cast::(); - let len7 = vec7.len(); - ::core::mem::forget(vec7); - *ptr2 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::() = len7; - *ptr2 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>() = ptr7.cast_mut(); - } - } - } - }; - ptr2 - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn __post_return_method_threshold_session_new_nonce< - T: GuestThresholdSession, - >(arg0: *mut u8) { - let l0 = i32::from(*arg0.add(0).cast::()); - match l0 { - 0 => { - let l1 = *arg0 - .add(::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l2 = *arg0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l1, l2, 1); - } - _ => { - let l3 = i32::from( - *arg0.add(::core::mem::size_of::<*const u8>()).cast::(), - ); - match l3 { - 0 => { - let l4 = *arg0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l5 = *arg0 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l4, l5, 1); - } - 1 => { - let l6 = *arg0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l7 = *arg0 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l6, l7, 1); - } - _ => { - let l8 = *arg0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l9 = *arg0 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l8, l9, 1); - } - } - } - } - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn _export_method_threshold_session_frost_sign_cabi< - T: GuestThresholdSession, - >( - arg0: *mut u8, - arg1: *mut u8, - arg2: usize, - arg3: i32, - arg4: *mut u8, - arg5: usize, - ) -> *mut u8 { - #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); - let len0 = arg2; - let bytes0 = _rt::Vec::from_raw_parts(arg1.cast(), len0, len0); - let len1 = arg5; - let bytes1 = _rt::Vec::from_raw_parts(arg4.cast(), len1, len1); - let result2 = T::frost_sign( - unsafe { ThresholdSessionBorrow::lift(arg0 as u32 as usize) } - .get(), - _rt::string_lift(bytes0), - unsafe { SigningNonce::from_handle(arg3 as u32) }, - _rt::string_lift(bytes1), - ); - let ptr3 = (&raw mut _RET_AREA.0).cast::(); - match result2 { - Ok(e) => { - *ptr3.add(0).cast::() = (0i32) as u8; - let vec4 = (e.into_bytes()).into_boxed_slice(); - let ptr4 = vec4.as_ptr().cast::(); - let len4 = vec4.len(); - ::core::mem::forget(vec4); - *ptr3 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::() = len4; - *ptr3 - .add(::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>() = ptr4.cast_mut(); - } - Err(e) => { - *ptr3.add(0).cast::() = (1i32) as u8; - match e { - ThresholdError::InvalidInput(e) => { - *ptr3 - .add(::core::mem::size_of::<*const u8>()) - .cast::() = (0i32) as u8; - let vec5 = (e.into_bytes()).into_boxed_slice(); - let ptr5 = vec5.as_ptr().cast::(); - let len5 = vec5.len(); - ::core::mem::forget(vec5); - *ptr3 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::() = len5; - *ptr3 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>() = ptr5.cast_mut(); - } - ThresholdError::CryptoError(e) => { - *ptr3 - .add(::core::mem::size_of::<*const u8>()) - .cast::() = (1i32) as u8; - let vec6 = (e.into_bytes()).into_boxed_slice(); - let ptr6 = vec6.as_ptr().cast::(); - let len6 = vec6.len(); - ::core::mem::forget(vec6); - *ptr3 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::() = len6; - *ptr3 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>() = ptr6.cast_mut(); - } - ThresholdError::SerializationError(e) => { - *ptr3 - .add(::core::mem::size_of::<*const u8>()) - .cast::() = (2i32) as u8; - let vec7 = (e.into_bytes()).into_boxed_slice(); - let ptr7 = vec7.as_ptr().cast::(); - let len7 = vec7.len(); - ::core::mem::forget(vec7); - *ptr3 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::() = len7; - *ptr3 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>() = ptr7.cast_mut(); - } - } - } - }; - ptr3 - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn __post_return_method_threshold_session_frost_sign< - T: GuestThresholdSession, - >(arg0: *mut u8) { - let l0 = i32::from(*arg0.add(0).cast::()); - match l0 { - 0 => { - let l1 = *arg0 - .add(::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l2 = *arg0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l1, l2, 1); - } - _ => { - let l3 = i32::from( - *arg0.add(::core::mem::size_of::<*const u8>()).cast::(), - ); - match l3 { - 0 => { - let l4 = *arg0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l5 = *arg0 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l4, l5, 1); - } - 1 => { - let l6 = *arg0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l7 = *arg0 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l6, l7, 1); - } - _ => { - let l8 = *arg0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l9 = *arg0 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l8, l9, 1); - } - } - } - } - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn _export_method_threshold_session_frost_aggregate_cabi< - T: GuestThresholdSession, - >( - arg0: *mut u8, - arg1: *mut u8, - arg2: usize, - arg3: *mut u8, - arg4: usize, - arg5: *mut u8, - arg6: usize, - ) -> *mut u8 { - #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); - let len0 = arg2; - let bytes0 = _rt::Vec::from_raw_parts(arg1.cast(), len0, len0); - let len1 = arg4; - let bytes1 = _rt::Vec::from_raw_parts(arg3.cast(), len1, len1); - let len2 = arg6; - let bytes2 = _rt::Vec::from_raw_parts(arg5.cast(), len2, len2); - let result3 = T::frost_aggregate( - unsafe { ThresholdSessionBorrow::lift(arg0 as u32 as usize) } - .get(), - _rt::string_lift(bytes0), - _rt::string_lift(bytes1), - _rt::string_lift(bytes2), - ); - let ptr4 = (&raw mut _RET_AREA.0).cast::(); - match result3 { - Ok(e) => { - *ptr4.add(0).cast::() = (0i32) as u8; - let vec5 = (e.into_bytes()).into_boxed_slice(); - let ptr5 = vec5.as_ptr().cast::(); - let len5 = vec5.len(); - ::core::mem::forget(vec5); - *ptr4 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::() = len5; - *ptr4 - .add(::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>() = ptr5.cast_mut(); - } - Err(e) => { - *ptr4.add(0).cast::() = (1i32) as u8; - match e { - ThresholdError::InvalidInput(e) => { - *ptr4 - .add(::core::mem::size_of::<*const u8>()) - .cast::() = (0i32) as u8; - let vec6 = (e.into_bytes()).into_boxed_slice(); - let ptr6 = vec6.as_ptr().cast::(); - let len6 = vec6.len(); - ::core::mem::forget(vec6); - *ptr4 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::() = len6; - *ptr4 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>() = ptr6.cast_mut(); - } - ThresholdError::CryptoError(e) => { - *ptr4 - .add(::core::mem::size_of::<*const u8>()) - .cast::() = (1i32) as u8; - let vec7 = (e.into_bytes()).into_boxed_slice(); - let ptr7 = vec7.as_ptr().cast::(); - let len7 = vec7.len(); - ::core::mem::forget(vec7); - *ptr4 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::() = len7; - *ptr4 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>() = ptr7.cast_mut(); - } - ThresholdError::SerializationError(e) => { - *ptr4 - .add(::core::mem::size_of::<*const u8>()) - .cast::() = (2i32) as u8; - let vec8 = (e.into_bytes()).into_boxed_slice(); - let ptr8 = vec8.as_ptr().cast::(); - let len8 = vec8.len(); - ::core::mem::forget(vec8); - *ptr4 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::() = len8; - *ptr4 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>() = ptr8.cast_mut(); - } - } - } - }; - ptr4 - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn __post_return_method_threshold_session_frost_aggregate< - T: GuestThresholdSession, - >(arg0: *mut u8) { - let l0 = i32::from(*arg0.add(0).cast::()); - match l0 { - 0 => { - let l1 = *arg0 - .add(::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l2 = *arg0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l1, l2, 1); - } - _ => { - let l3 = i32::from( - *arg0.add(::core::mem::size_of::<*const u8>()).cast::(), - ); - match l3 { - 0 => { - let l4 = *arg0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l5 = *arg0 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l4, l5, 1); - } - 1 => { - let l6 = *arg0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l7 = *arg0 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l6, l7, 1); - } - _ => { - let l8 = *arg0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l9 = *arg0 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l8, l9, 1); - } - } - } - } - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn _export_method_threshold_session_key_package_tweak_cabi< - T: GuestThresholdSession, - >( - arg0: *mut u8, - arg1: *mut u8, - arg2: usize, - arg3: i32, - arg4: *mut u8, - arg5: usize, - ) -> *mut u8 { - #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); - let len0 = arg2; - let bytes0 = _rt::Vec::from_raw_parts(arg1.cast(), len0, len0); - let result2 = T::key_package_tweak( - unsafe { ThresholdSessionBorrow::lift(arg0 as u32 as usize) } - .get(), - _rt::string_lift(bytes0), - match arg3 { - 0 => None, - 1 => { - let e = { - let len1 = arg5; - _rt::Vec::from_raw_parts(arg4.cast(), len1, len1) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - ); - let ptr3 = (&raw mut _RET_AREA.0).cast::(); - match result2 { - Ok(e) => { - *ptr3.add(0).cast::() = (0i32) as u8; - let vec4 = (e.into_bytes()).into_boxed_slice(); - let ptr4 = vec4.as_ptr().cast::(); - let len4 = vec4.len(); - ::core::mem::forget(vec4); - *ptr3 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::() = len4; - *ptr3 - .add(::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>() = ptr4.cast_mut(); - } - Err(e) => { - *ptr3.add(0).cast::() = (1i32) as u8; - match e { - ThresholdError::InvalidInput(e) => { - *ptr3 - .add(::core::mem::size_of::<*const u8>()) - .cast::() = (0i32) as u8; - let vec5 = (e.into_bytes()).into_boxed_slice(); - let ptr5 = vec5.as_ptr().cast::(); - let len5 = vec5.len(); - ::core::mem::forget(vec5); - *ptr3 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::() = len5; - *ptr3 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>() = ptr5.cast_mut(); - } - ThresholdError::CryptoError(e) => { - *ptr3 - .add(::core::mem::size_of::<*const u8>()) - .cast::() = (1i32) as u8; - let vec6 = (e.into_bytes()).into_boxed_slice(); - let ptr6 = vec6.as_ptr().cast::(); - let len6 = vec6.len(); - ::core::mem::forget(vec6); - *ptr3 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::() = len6; - *ptr3 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>() = ptr6.cast_mut(); - } - ThresholdError::SerializationError(e) => { - *ptr3 - .add(::core::mem::size_of::<*const u8>()) - .cast::() = (2i32) as u8; - let vec7 = (e.into_bytes()).into_boxed_slice(); - let ptr7 = vec7.as_ptr().cast::(); - let len7 = vec7.len(); - ::core::mem::forget(vec7); - *ptr3 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::() = len7; - *ptr3 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>() = ptr7.cast_mut(); - } - } - } - }; - ptr3 - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn __post_return_method_threshold_session_key_package_tweak< - T: GuestThresholdSession, - >(arg0: *mut u8) { - let l0 = i32::from(*arg0.add(0).cast::()); - match l0 { - 0 => { - let l1 = *arg0 - .add(::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l2 = *arg0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l1, l2, 1); - } - _ => { - let l3 = i32::from( - *arg0.add(::core::mem::size_of::<*const u8>()).cast::(), - ); - match l3 { - 0 => { - let l4 = *arg0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l5 = *arg0 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l4, l5, 1); - } - 1 => { - let l6 = *arg0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l7 = *arg0 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l6, l7, 1); - } - _ => { - let l8 = *arg0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l9 = *arg0 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l8, l9, 1); - } - } - } - } - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn _export_method_threshold_session_pub_key_package_tweak_cabi< - T: GuestThresholdSession, - >( - arg0: *mut u8, - arg1: *mut u8, - arg2: usize, - arg3: i32, - arg4: *mut u8, - arg5: usize, - ) -> *mut u8 { - #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); - let len0 = arg2; - let bytes0 = _rt::Vec::from_raw_parts(arg1.cast(), len0, len0); - let result2 = T::pub_key_package_tweak( - unsafe { ThresholdSessionBorrow::lift(arg0 as u32 as usize) } - .get(), - _rt::string_lift(bytes0), - match arg3 { - 0 => None, - 1 => { - let e = { - let len1 = arg5; - _rt::Vec::from_raw_parts(arg4.cast(), len1, len1) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - ); - let ptr3 = (&raw mut _RET_AREA.0).cast::(); - match result2 { - Ok(e) => { - *ptr3.add(0).cast::() = (0i32) as u8; - let vec4 = (e.into_bytes()).into_boxed_slice(); - let ptr4 = vec4.as_ptr().cast::(); - let len4 = vec4.len(); - ::core::mem::forget(vec4); - *ptr3 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::() = len4; - *ptr3 - .add(::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>() = ptr4.cast_mut(); - } - Err(e) => { - *ptr3.add(0).cast::() = (1i32) as u8; - match e { - ThresholdError::InvalidInput(e) => { - *ptr3 - .add(::core::mem::size_of::<*const u8>()) - .cast::() = (0i32) as u8; - let vec5 = (e.into_bytes()).into_boxed_slice(); - let ptr5 = vec5.as_ptr().cast::(); - let len5 = vec5.len(); - ::core::mem::forget(vec5); - *ptr3 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::() = len5; - *ptr3 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>() = ptr5.cast_mut(); - } - ThresholdError::CryptoError(e) => { - *ptr3 - .add(::core::mem::size_of::<*const u8>()) - .cast::() = (1i32) as u8; - let vec6 = (e.into_bytes()).into_boxed_slice(); - let ptr6 = vec6.as_ptr().cast::(); - let len6 = vec6.len(); - ::core::mem::forget(vec6); - *ptr3 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::() = len6; - *ptr3 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>() = ptr6.cast_mut(); - } - ThresholdError::SerializationError(e) => { - *ptr3 - .add(::core::mem::size_of::<*const u8>()) - .cast::() = (2i32) as u8; - let vec7 = (e.into_bytes()).into_boxed_slice(); - let ptr7 = vec7.as_ptr().cast::(); - let len7 = vec7.len(); - ::core::mem::forget(vec7); - *ptr3 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::() = len7; - *ptr3 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>() = ptr7.cast_mut(); - } - } - } - }; - ptr3 - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn __post_return_method_threshold_session_pub_key_package_tweak< - T: GuestThresholdSession, - >(arg0: *mut u8) { - let l0 = i32::from(*arg0.add(0).cast::()); - match l0 { - 0 => { - let l1 = *arg0 - .add(::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l2 = *arg0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l1, l2, 1); - } - _ => { - let l3 = i32::from( - *arg0.add(::core::mem::size_of::<*const u8>()).cast::(), - ); - match l3 { - 0 => { - let l4 = *arg0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l5 = *arg0 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l4, l5, 1); - } - 1 => { - let l6 = *arg0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l7 = *arg0 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l6, l7, 1); - } - _ => { - let l8 = *arg0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l9 = *arg0 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l8, l9, 1); - } - } - } - } - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn _export_method_threshold_session_key_package_into_even_y_cabi< - T: GuestThresholdSession, - >(arg0: *mut u8, arg1: *mut u8, arg2: usize) -> *mut u8 { - #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); - let len0 = arg2; - let bytes0 = _rt::Vec::from_raw_parts(arg1.cast(), len0, len0); - let result1 = T::key_package_into_even_y( - unsafe { ThresholdSessionBorrow::lift(arg0 as u32 as usize) } - .get(), - _rt::string_lift(bytes0), - ); - let ptr2 = (&raw mut _RET_AREA.0).cast::(); - match result1 { - Ok(e) => { - *ptr2.add(0).cast::() = (0i32) as u8; - let vec3 = (e.into_bytes()).into_boxed_slice(); - let ptr3 = vec3.as_ptr().cast::(); - let len3 = vec3.len(); - ::core::mem::forget(vec3); - *ptr2 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::() = len3; - *ptr2 - .add(::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>() = ptr3.cast_mut(); - } - Err(e) => { - *ptr2.add(0).cast::() = (1i32) as u8; - match e { - ThresholdError::InvalidInput(e) => { - *ptr2 - .add(::core::mem::size_of::<*const u8>()) - .cast::() = (0i32) as u8; - let vec4 = (e.into_bytes()).into_boxed_slice(); - let ptr4 = vec4.as_ptr().cast::(); - let len4 = vec4.len(); - ::core::mem::forget(vec4); - *ptr2 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::() = len4; - *ptr2 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>() = ptr4.cast_mut(); - } - ThresholdError::CryptoError(e) => { - *ptr2 - .add(::core::mem::size_of::<*const u8>()) - .cast::() = (1i32) as u8; - let vec5 = (e.into_bytes()).into_boxed_slice(); - let ptr5 = vec5.as_ptr().cast::(); - let len5 = vec5.len(); - ::core::mem::forget(vec5); - *ptr2 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::() = len5; - *ptr2 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>() = ptr5.cast_mut(); - } - ThresholdError::SerializationError(e) => { - *ptr2 - .add(::core::mem::size_of::<*const u8>()) - .cast::() = (2i32) as u8; - let vec6 = (e.into_bytes()).into_boxed_slice(); - let ptr6 = vec6.as_ptr().cast::(); - let len6 = vec6.len(); - ::core::mem::forget(vec6); - *ptr2 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::() = len6; - *ptr2 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>() = ptr6.cast_mut(); - } - } - } - }; - ptr2 - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn __post_return_method_threshold_session_key_package_into_even_y< - T: GuestThresholdSession, - >(arg0: *mut u8) { - let l0 = i32::from(*arg0.add(0).cast::()); - match l0 { - 0 => { - let l1 = *arg0 - .add(::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l2 = *arg0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l1, l2, 1); - } - _ => { - let l3 = i32::from( - *arg0.add(::core::mem::size_of::<*const u8>()).cast::(), - ); - match l3 { - 0 => { - let l4 = *arg0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l5 = *arg0 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l4, l5, 1); - } - 1 => { - let l6 = *arg0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l7 = *arg0 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l6, l7, 1); - } - _ => { - let l8 = *arg0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l9 = *arg0 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l8, l9, 1); - } - } - } - } - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn _export_method_threshold_session_pub_key_package_into_even_y_cabi< - T: GuestThresholdSession, - >(arg0: *mut u8, arg1: *mut u8, arg2: usize) -> *mut u8 { - #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); - let len0 = arg2; - let bytes0 = _rt::Vec::from_raw_parts(arg1.cast(), len0, len0); - let result1 = T::pub_key_package_into_even_y( - unsafe { ThresholdSessionBorrow::lift(arg0 as u32 as usize) } - .get(), - _rt::string_lift(bytes0), - ); - let ptr2 = (&raw mut _RET_AREA.0).cast::(); - match result1 { - Ok(e) => { - *ptr2.add(0).cast::() = (0i32) as u8; - let vec3 = (e.into_bytes()).into_boxed_slice(); - let ptr3 = vec3.as_ptr().cast::(); - let len3 = vec3.len(); - ::core::mem::forget(vec3); - *ptr2 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::() = len3; - *ptr2 - .add(::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>() = ptr3.cast_mut(); - } - Err(e) => { - *ptr2.add(0).cast::() = (1i32) as u8; - match e { - ThresholdError::InvalidInput(e) => { - *ptr2 - .add(::core::mem::size_of::<*const u8>()) - .cast::() = (0i32) as u8; - let vec4 = (e.into_bytes()).into_boxed_slice(); - let ptr4 = vec4.as_ptr().cast::(); - let len4 = vec4.len(); - ::core::mem::forget(vec4); - *ptr2 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::() = len4; - *ptr2 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>() = ptr4.cast_mut(); - } - ThresholdError::CryptoError(e) => { - *ptr2 - .add(::core::mem::size_of::<*const u8>()) - .cast::() = (1i32) as u8; - let vec5 = (e.into_bytes()).into_boxed_slice(); - let ptr5 = vec5.as_ptr().cast::(); - let len5 = vec5.len(); - ::core::mem::forget(vec5); - *ptr2 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::() = len5; - *ptr2 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>() = ptr5.cast_mut(); - } - ThresholdError::SerializationError(e) => { - *ptr2 - .add(::core::mem::size_of::<*const u8>()) - .cast::() = (2i32) as u8; - let vec6 = (e.into_bytes()).into_boxed_slice(); - let ptr6 = vec6.as_ptr().cast::(); - let len6 = vec6.len(); - ::core::mem::forget(vec6); - *ptr2 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::() = len6; - *ptr2 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>() = ptr6.cast_mut(); - } - } - } - }; - ptr2 - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn __post_return_method_threshold_session_pub_key_package_into_even_y< - T: GuestThresholdSession, - >(arg0: *mut u8) { - let l0 = i32::from(*arg0.add(0).cast::()); - match l0 { - 0 => { - let l1 = *arg0 - .add(::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l2 = *arg0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l1, l2, 1); - } - _ => { - let l3 = i32::from( - *arg0.add(::core::mem::size_of::<*const u8>()).cast::(), - ); - match l3 { - 0 => { - let l4 = *arg0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l5 = *arg0 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l4, l5, 1); - } - 1 => { - let l6 = *arg0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l7 = *arg0 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l6, l7, 1); - } - _ => { - let l8 = *arg0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l9 = *arg0 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l8, l9, 1); - } - } - } - } - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn _export_method_threshold_session_verify_schnorr_signature_cabi< - T: GuestThresholdSession, - >( - arg0: *mut u8, - arg1: *mut u8, - arg2: usize, - arg3: *mut u8, - arg4: usize, - arg5: *mut u8, - arg6: usize, - ) -> *mut u8 { - #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); - let len0 = arg2; - let bytes0 = _rt::Vec::from_raw_parts(arg1.cast(), len0, len0); - let len1 = arg4; - let len2 = arg6; - let bytes2 = _rt::Vec::from_raw_parts(arg5.cast(), len2, len2); - let result3 = T::verify_schnorr_signature( - unsafe { ThresholdSessionBorrow::lift(arg0 as u32 as usize) } - .get(), - _rt::string_lift(bytes0), - _rt::Vec::from_raw_parts(arg3.cast(), len1, len1), - _rt::string_lift(bytes2), - ); - let ptr4 = (&raw mut _RET_AREA.0).cast::(); - match result3 { - Ok(e) => { - *ptr4.add(0).cast::() = (0i32) as u8; - *ptr4 - .add(::core::mem::size_of::<*const u8>()) - .cast::() = (match e { - true => 1, - false => 0, - }) as u8; - } - Err(e) => { - *ptr4.add(0).cast::() = (1i32) as u8; - match e { - ThresholdError::InvalidInput(e) => { - *ptr4 - .add(::core::mem::size_of::<*const u8>()) - .cast::() = (0i32) as u8; - let vec5 = (e.into_bytes()).into_boxed_slice(); - let ptr5 = vec5.as_ptr().cast::(); - let len5 = vec5.len(); - ::core::mem::forget(vec5); - *ptr4 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::() = len5; - *ptr4 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>() = ptr5.cast_mut(); - } - ThresholdError::CryptoError(e) => { - *ptr4 - .add(::core::mem::size_of::<*const u8>()) - .cast::() = (1i32) as u8; - let vec6 = (e.into_bytes()).into_boxed_slice(); - let ptr6 = vec6.as_ptr().cast::(); - let len6 = vec6.len(); - ::core::mem::forget(vec6); - *ptr4 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::() = len6; - *ptr4 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>() = ptr6.cast_mut(); - } - ThresholdError::SerializationError(e) => { - *ptr4 - .add(::core::mem::size_of::<*const u8>()) - .cast::() = (2i32) as u8; - let vec7 = (e.into_bytes()).into_boxed_slice(); - let ptr7 = vec7.as_ptr().cast::(); - let len7 = vec7.len(); - ::core::mem::forget(vec7); - *ptr4 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::() = len7; - *ptr4 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>() = ptr7.cast_mut(); - } - } - } - }; - ptr4 - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn __post_return_method_threshold_session_verify_schnorr_signature< - T: GuestThresholdSession, - >(arg0: *mut u8) { - let l0 = i32::from(*arg0.add(0).cast::()); - match l0 { - 0 => {} - _ => { - let l1 = i32::from( - *arg0.add(::core::mem::size_of::<*const u8>()).cast::(), - ); - match l1 { - 0 => { - let l2 = *arg0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l3 = *arg0 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l2, l3, 1); - } - 1 => { - let l4 = *arg0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l5 = *arg0 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l4, l5, 1); - } - _ => { - let l6 = *arg0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l7 = *arg0 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l6, l7, 1); - } - } - } - } - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn _export_method_threshold_session_ark_default_vtxo_script_pubkey_cabi< - T: GuestThresholdSession, - >( - arg0: *mut u8, - arg1: *mut u8, - arg2: usize, - arg3: *mut u8, - arg4: usize, - arg5: i32, - ) -> *mut u8 { - #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); - let len0 = arg2; - let bytes0 = _rt::Vec::from_raw_parts(arg1.cast(), len0, len0); - let len1 = arg4; - let bytes1 = _rt::Vec::from_raw_parts(arg3.cast(), len1, len1); - let result2 = T::ark_default_vtxo_script_pubkey( - unsafe { ThresholdSessionBorrow::lift(arg0 as u32 as usize) } - .get(), - _rt::string_lift(bytes0), - _rt::string_lift(bytes1), - arg5 as u32, - ); - let ptr3 = (&raw mut _RET_AREA.0).cast::(); - match result2 { - Ok(e) => { - *ptr3.add(0).cast::() = (0i32) as u8; - let vec4 = (e.into_bytes()).into_boxed_slice(); - let ptr4 = vec4.as_ptr().cast::(); - let len4 = vec4.len(); - ::core::mem::forget(vec4); - *ptr3 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::() = len4; - *ptr3 - .add(::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>() = ptr4.cast_mut(); - } - Err(e) => { - *ptr3.add(0).cast::() = (1i32) as u8; - match e { - ThresholdError::InvalidInput(e) => { - *ptr3 - .add(::core::mem::size_of::<*const u8>()) - .cast::() = (0i32) as u8; - let vec5 = (e.into_bytes()).into_boxed_slice(); - let ptr5 = vec5.as_ptr().cast::(); - let len5 = vec5.len(); - ::core::mem::forget(vec5); - *ptr3 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::() = len5; - *ptr3 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>() = ptr5.cast_mut(); - } - ThresholdError::CryptoError(e) => { - *ptr3 - .add(::core::mem::size_of::<*const u8>()) - .cast::() = (1i32) as u8; - let vec6 = (e.into_bytes()).into_boxed_slice(); - let ptr6 = vec6.as_ptr().cast::(); - let len6 = vec6.len(); - ::core::mem::forget(vec6); - *ptr3 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::() = len6; - *ptr3 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>() = ptr6.cast_mut(); - } - ThresholdError::SerializationError(e) => { - *ptr3 - .add(::core::mem::size_of::<*const u8>()) - .cast::() = (2i32) as u8; - let vec7 = (e.into_bytes()).into_boxed_slice(); - let ptr7 = vec7.as_ptr().cast::(); - let len7 = vec7.len(); - ::core::mem::forget(vec7); - *ptr3 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::() = len7; - *ptr3 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>() = ptr7.cast_mut(); - } - } - } - }; - ptr3 - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn __post_return_method_threshold_session_ark_default_vtxo_script_pubkey< - T: GuestThresholdSession, - >(arg0: *mut u8) { - let l0 = i32::from(*arg0.add(0).cast::()); - match l0 { - 0 => { - let l1 = *arg0 - .add(::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l2 = *arg0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l1, l2, 1); - } - _ => { - let l3 = i32::from( - *arg0.add(::core::mem::size_of::<*const u8>()).cast::(), - ); - match l3 { - 0 => { - let l4 = *arg0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l5 = *arg0 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l4, l5, 1); - } - 1 => { - let l6 = *arg0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l7 = *arg0 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l6, l7, 1); - } - _ => { - let l8 = *arg0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l9 = *arg0 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l8, l9, 1); - } - } - } - } - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn _export_method_threshold_session_ark_forfeit_spend_info_cabi< - T: GuestThresholdSession, - >( - arg0: *mut u8, - arg1: *mut u8, - arg2: usize, - arg3: *mut u8, - arg4: usize, - arg5: i32, - ) -> *mut u8 { - #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); - let len0 = arg2; - let bytes0 = _rt::Vec::from_raw_parts(arg1.cast(), len0, len0); - let len1 = arg4; - let bytes1 = _rt::Vec::from_raw_parts(arg3.cast(), len1, len1); - let result2 = T::ark_forfeit_spend_info( - unsafe { ThresholdSessionBorrow::lift(arg0 as u32 as usize) } - .get(), - _rt::string_lift(bytes0), - _rt::string_lift(bytes1), - arg5 as u32, - ); - let ptr3 = (&raw mut _RET_AREA.0).cast::(); - match result2 { - Ok(e) => { - *ptr3.add(0).cast::() = (0i32) as u8; - let vec4 = (e.into_bytes()).into_boxed_slice(); - let ptr4 = vec4.as_ptr().cast::(); - let len4 = vec4.len(); - ::core::mem::forget(vec4); - *ptr3 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::() = len4; - *ptr3 - .add(::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>() = ptr4.cast_mut(); - } - Err(e) => { - *ptr3.add(0).cast::() = (1i32) as u8; - match e { - ThresholdError::InvalidInput(e) => { - *ptr3 - .add(::core::mem::size_of::<*const u8>()) - .cast::() = (0i32) as u8; - let vec5 = (e.into_bytes()).into_boxed_slice(); - let ptr5 = vec5.as_ptr().cast::(); - let len5 = vec5.len(); - ::core::mem::forget(vec5); - *ptr3 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::() = len5; - *ptr3 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>() = ptr5.cast_mut(); - } - ThresholdError::CryptoError(e) => { - *ptr3 - .add(::core::mem::size_of::<*const u8>()) - .cast::() = (1i32) as u8; - let vec6 = (e.into_bytes()).into_boxed_slice(); - let ptr6 = vec6.as_ptr().cast::(); - let len6 = vec6.len(); - ::core::mem::forget(vec6); - *ptr3 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::() = len6; - *ptr3 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>() = ptr6.cast_mut(); - } - ThresholdError::SerializationError(e) => { - *ptr3 - .add(::core::mem::size_of::<*const u8>()) - .cast::() = (2i32) as u8; - let vec7 = (e.into_bytes()).into_boxed_slice(); - let ptr7 = vec7.as_ptr().cast::(); - let len7 = vec7.len(); - ::core::mem::forget(vec7); - *ptr3 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::() = len7; - *ptr3 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>() = ptr7.cast_mut(); - } - } - } - }; - ptr3 - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn __post_return_method_threshold_session_ark_forfeit_spend_info< - T: GuestThresholdSession, - >(arg0: *mut u8) { - let l0 = i32::from(*arg0.add(0).cast::()); - match l0 { - 0 => { - let l1 = *arg0 - .add(::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l2 = *arg0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l1, l2, 1); - } - _ => { - let l3 = i32::from( - *arg0.add(::core::mem::size_of::<*const u8>()).cast::(), - ); - match l3 { - 0 => { - let l4 = *arg0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l5 = *arg0 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l4, l5, 1); - } - 1 => { - let l6 = *arg0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l7 = *arg0 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l6, l7, 1); - } - _ => { - let l8 = *arg0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l9 = *arg0 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l8, l9, 1); - } - } - } - } - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn _export_method_threshold_session_ark_exit_spend_info_cabi< - T: GuestThresholdSession, - >( - arg0: *mut u8, - arg1: *mut u8, - arg2: usize, - arg3: *mut u8, - arg4: usize, - arg5: i32, - ) -> *mut u8 { - #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); - let len0 = arg2; - let bytes0 = _rt::Vec::from_raw_parts(arg1.cast(), len0, len0); - let len1 = arg4; - let bytes1 = _rt::Vec::from_raw_parts(arg3.cast(), len1, len1); - let result2 = T::ark_exit_spend_info( - unsafe { ThresholdSessionBorrow::lift(arg0 as u32 as usize) } - .get(), - _rt::string_lift(bytes0), - _rt::string_lift(bytes1), - arg5 as u32, - ); - let ptr3 = (&raw mut _RET_AREA.0).cast::(); - match result2 { - Ok(e) => { - *ptr3.add(0).cast::() = (0i32) as u8; - let vec4 = (e.into_bytes()).into_boxed_slice(); - let ptr4 = vec4.as_ptr().cast::(); - let len4 = vec4.len(); - ::core::mem::forget(vec4); - *ptr3 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::() = len4; - *ptr3 - .add(::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>() = ptr4.cast_mut(); - } - Err(e) => { - *ptr3.add(0).cast::() = (1i32) as u8; - match e { - ThresholdError::InvalidInput(e) => { - *ptr3 - .add(::core::mem::size_of::<*const u8>()) - .cast::() = (0i32) as u8; - let vec5 = (e.into_bytes()).into_boxed_slice(); - let ptr5 = vec5.as_ptr().cast::(); - let len5 = vec5.len(); - ::core::mem::forget(vec5); - *ptr3 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::() = len5; - *ptr3 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>() = ptr5.cast_mut(); - } - ThresholdError::CryptoError(e) => { - *ptr3 - .add(::core::mem::size_of::<*const u8>()) - .cast::() = (1i32) as u8; - let vec6 = (e.into_bytes()).into_boxed_slice(); - let ptr6 = vec6.as_ptr().cast::(); - let len6 = vec6.len(); - ::core::mem::forget(vec6); - *ptr3 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::() = len6; - *ptr3 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>() = ptr6.cast_mut(); - } - ThresholdError::SerializationError(e) => { - *ptr3 - .add(::core::mem::size_of::<*const u8>()) - .cast::() = (2i32) as u8; - let vec7 = (e.into_bytes()).into_boxed_slice(); - let ptr7 = vec7.as_ptr().cast::(); - let len7 = vec7.len(); - ::core::mem::forget(vec7); - *ptr3 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::() = len7; - *ptr3 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>() = ptr7.cast_mut(); - } - } - } - }; - ptr3 - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn __post_return_method_threshold_session_ark_exit_spend_info< - T: GuestThresholdSession, - >(arg0: *mut u8) { - let l0 = i32::from(*arg0.add(0).cast::()); - match l0 { - 0 => { - let l1 = *arg0 - .add(::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l2 = *arg0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l1, l2, 1); - } - _ => { - let l3 = i32::from( - *arg0.add(::core::mem::size_of::<*const u8>()).cast::(), - ); - match l3 { - 0 => { - let l4 = *arg0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l5 = *arg0 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l4, l5, 1); - } - 1 => { - let l6 = *arg0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l7 = *arg0 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l6, l7, 1); - } - _ => { - let l8 = *arg0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l9 = *arg0 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l8, l9, 1); - } - } - } - } - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn _export_method_threshold_session_identifier_derive_cabi< - T: GuestThresholdSession, - >(arg0: *mut u8, arg1: *mut u8, arg2: usize) -> *mut u8 { - #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); - let len0 = arg2; - let result1 = T::identifier_derive( - unsafe { ThresholdSessionBorrow::lift(arg0 as u32 as usize) } - .get(), - _rt::Vec::from_raw_parts(arg1.cast(), len0, len0), - ); - let ptr2 = (&raw mut _RET_AREA.0).cast::(); - match result1 { - Ok(e) => { - *ptr2.add(0).cast::() = (0i32) as u8; - let vec3 = (e.into_bytes()).into_boxed_slice(); - let ptr3 = vec3.as_ptr().cast::(); - let len3 = vec3.len(); - ::core::mem::forget(vec3); - *ptr2 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::() = len3; - *ptr2 - .add(::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>() = ptr3.cast_mut(); - } - Err(e) => { - *ptr2.add(0).cast::() = (1i32) as u8; - match e { - ThresholdError::InvalidInput(e) => { - *ptr2 - .add(::core::mem::size_of::<*const u8>()) - .cast::() = (0i32) as u8; - let vec4 = (e.into_bytes()).into_boxed_slice(); - let ptr4 = vec4.as_ptr().cast::(); - let len4 = vec4.len(); - ::core::mem::forget(vec4); - *ptr2 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::() = len4; - *ptr2 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>() = ptr4.cast_mut(); - } - ThresholdError::CryptoError(e) => { - *ptr2 - .add(::core::mem::size_of::<*const u8>()) - .cast::() = (1i32) as u8; - let vec5 = (e.into_bytes()).into_boxed_slice(); - let ptr5 = vec5.as_ptr().cast::(); - let len5 = vec5.len(); - ::core::mem::forget(vec5); - *ptr2 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::() = len5; - *ptr2 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>() = ptr5.cast_mut(); - } - ThresholdError::SerializationError(e) => { - *ptr2 - .add(::core::mem::size_of::<*const u8>()) - .cast::() = (2i32) as u8; - let vec6 = (e.into_bytes()).into_boxed_slice(); - let ptr6 = vec6.as_ptr().cast::(); - let len6 = vec6.len(); - ::core::mem::forget(vec6); - *ptr2 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::() = len6; - *ptr2 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>() = ptr6.cast_mut(); - } - } - } - }; - ptr2 - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn __post_return_method_threshold_session_identifier_derive< - T: GuestThresholdSession, - >(arg0: *mut u8) { - let l0 = i32::from(*arg0.add(0).cast::()); - match l0 { - 0 => { - let l1 = *arg0 - .add(::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l2 = *arg0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l1, l2, 1); - } - _ => { - let l3 = i32::from( - *arg0.add(::core::mem::size_of::<*const u8>()).cast::(), - ); - match l3 { - 0 => { - let l4 = *arg0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l5 = *arg0 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l4, l5, 1); - } - 1 => { - let l6 = *arg0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l7 = *arg0 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l6, l7, 1); - } - _ => { - let l8 = *arg0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l9 = *arg0 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l8, l9, 1); - } - } - } - } - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn _export_method_threshold_session_identifier_from_bigint_cabi< - T: GuestThresholdSession, - >(arg0: *mut u8, arg1: *mut u8, arg2: usize) -> *mut u8 { - #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); - let len0 = arg2; - let bytes0 = _rt::Vec::from_raw_parts(arg1.cast(), len0, len0); - let result1 = T::identifier_from_bigint( - unsafe { ThresholdSessionBorrow::lift(arg0 as u32 as usize) } - .get(), - _rt::string_lift(bytes0), - ); - let ptr2 = (&raw mut _RET_AREA.0).cast::(); - match result1 { - Ok(e) => { - *ptr2.add(0).cast::() = (0i32) as u8; - let vec3 = (e.into_bytes()).into_boxed_slice(); - let ptr3 = vec3.as_ptr().cast::(); - let len3 = vec3.len(); - ::core::mem::forget(vec3); - *ptr2 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::() = len3; - *ptr2 - .add(::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>() = ptr3.cast_mut(); - } - Err(e) => { - *ptr2.add(0).cast::() = (1i32) as u8; - match e { - ThresholdError::InvalidInput(e) => { - *ptr2 - .add(::core::mem::size_of::<*const u8>()) - .cast::() = (0i32) as u8; - let vec4 = (e.into_bytes()).into_boxed_slice(); - let ptr4 = vec4.as_ptr().cast::(); - let len4 = vec4.len(); - ::core::mem::forget(vec4); - *ptr2 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::() = len4; - *ptr2 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>() = ptr4.cast_mut(); - } - ThresholdError::CryptoError(e) => { - *ptr2 - .add(::core::mem::size_of::<*const u8>()) - .cast::() = (1i32) as u8; - let vec5 = (e.into_bytes()).into_boxed_slice(); - let ptr5 = vec5.as_ptr().cast::(); - let len5 = vec5.len(); - ::core::mem::forget(vec5); - *ptr2 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::() = len5; - *ptr2 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>() = ptr5.cast_mut(); - } - ThresholdError::SerializationError(e) => { - *ptr2 - .add(::core::mem::size_of::<*const u8>()) - .cast::() = (2i32) as u8; - let vec6 = (e.into_bytes()).into_boxed_slice(); - let ptr6 = vec6.as_ptr().cast::(); - let len6 = vec6.len(); - ::core::mem::forget(vec6); - *ptr2 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::() = len6; - *ptr2 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>() = ptr6.cast_mut(); - } - } - } - }; - ptr2 - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn __post_return_method_threshold_session_identifier_from_bigint< - T: GuestThresholdSession, - >(arg0: *mut u8) { - let l0 = i32::from(*arg0.add(0).cast::()); - match l0 { - 0 => { - let l1 = *arg0 - .add(::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l2 = *arg0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l1, l2, 1); - } - _ => { - let l3 = i32::from( - *arg0.add(::core::mem::size_of::<*const u8>()).cast::(), - ); - match l3 { - 0 => { - let l4 = *arg0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l5 = *arg0 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l4, l5, 1); - } - 1 => { - let l6 = *arg0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l7 = *arg0 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l6, l7, 1); - } - _ => { - let l8 = *arg0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l9 = *arg0 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l8, l9, 1); - } - } - } - } - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn _export_method_threshold_session_generate_coefficients_cabi< - T: GuestThresholdSession, - >(arg0: *mut u8, arg1: i32, arg2: *mut u8, arg3: usize) -> *mut u8 { - #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); - let len0 = arg3; - let result1 = T::generate_coefficients( - unsafe { ThresholdSessionBorrow::lift(arg0 as u32 as usize) } - .get(), - arg1 as u32, - _rt::Vec::from_raw_parts(arg2.cast(), len0, len0), - ); - let ptr2 = (&raw mut _RET_AREA.0).cast::(); - match result1 { - Ok(e) => { - *ptr2.add(0).cast::() = (0i32) as u8; - let vec3 = (e.into_bytes()).into_boxed_slice(); - let ptr3 = vec3.as_ptr().cast::(); - let len3 = vec3.len(); - ::core::mem::forget(vec3); - *ptr2 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::() = len3; - *ptr2 - .add(::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>() = ptr3.cast_mut(); - } - Err(e) => { - *ptr2.add(0).cast::() = (1i32) as u8; - match e { - ThresholdError::InvalidInput(e) => { - *ptr2 - .add(::core::mem::size_of::<*const u8>()) - .cast::() = (0i32) as u8; - let vec4 = (e.into_bytes()).into_boxed_slice(); - let ptr4 = vec4.as_ptr().cast::(); - let len4 = vec4.len(); - ::core::mem::forget(vec4); - *ptr2 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::() = len4; - *ptr2 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>() = ptr4.cast_mut(); - } - ThresholdError::CryptoError(e) => { - *ptr2 - .add(::core::mem::size_of::<*const u8>()) - .cast::() = (1i32) as u8; - let vec5 = (e.into_bytes()).into_boxed_slice(); - let ptr5 = vec5.as_ptr().cast::(); - let len5 = vec5.len(); - ::core::mem::forget(vec5); - *ptr2 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::() = len5; - *ptr2 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>() = ptr5.cast_mut(); - } - ThresholdError::SerializationError(e) => { - *ptr2 - .add(::core::mem::size_of::<*const u8>()) - .cast::() = (2i32) as u8; - let vec6 = (e.into_bytes()).into_boxed_slice(); - let ptr6 = vec6.as_ptr().cast::(); - let len6 = vec6.len(); - ::core::mem::forget(vec6); - *ptr2 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::() = len6; - *ptr2 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>() = ptr6.cast_mut(); - } - } - } - }; - ptr2 - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn __post_return_method_threshold_session_generate_coefficients< - T: GuestThresholdSession, - >(arg0: *mut u8) { - let l0 = i32::from(*arg0.add(0).cast::()); - match l0 { - 0 => { - let l1 = *arg0 - .add(::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l2 = *arg0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l1, l2, 1); - } - _ => { - let l3 = i32::from( - *arg0.add(::core::mem::size_of::<*const u8>()).cast::(), - ); - match l3 { - 0 => { - let l4 = *arg0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l5 = *arg0 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l4, l5, 1); - } - 1 => { - let l6 = *arg0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l7 = *arg0 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l6, l7, 1); - } - _ => { - let l8 = *arg0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l9 = *arg0 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l8, l9, 1); - } - } - } - } - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn _export_method_threshold_session_evaluate_polynomial_cabi< - T: GuestThresholdSession, - >( - arg0: *mut u8, - arg1: *mut u8, - arg2: usize, - arg3: *mut u8, - arg4: usize, - ) -> *mut u8 { - #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); - let len0 = arg2; - let bytes0 = _rt::Vec::from_raw_parts(arg1.cast(), len0, len0); - let len1 = arg4; - let bytes1 = _rt::Vec::from_raw_parts(arg3.cast(), len1, len1); - let result2 = T::evaluate_polynomial( - unsafe { ThresholdSessionBorrow::lift(arg0 as u32 as usize) } - .get(), - _rt::string_lift(bytes0), - _rt::string_lift(bytes1), - ); - let ptr3 = (&raw mut _RET_AREA.0).cast::(); - match result2 { - Ok(e) => { - *ptr3.add(0).cast::() = (0i32) as u8; - let vec4 = (e.into_bytes()).into_boxed_slice(); - let ptr4 = vec4.as_ptr().cast::(); - let len4 = vec4.len(); - ::core::mem::forget(vec4); - *ptr3 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::() = len4; - *ptr3 - .add(::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>() = ptr4.cast_mut(); - } - Err(e) => { - *ptr3.add(0).cast::() = (1i32) as u8; - match e { - ThresholdError::InvalidInput(e) => { - *ptr3 - .add(::core::mem::size_of::<*const u8>()) - .cast::() = (0i32) as u8; - let vec5 = (e.into_bytes()).into_boxed_slice(); - let ptr5 = vec5.as_ptr().cast::(); - let len5 = vec5.len(); - ::core::mem::forget(vec5); - *ptr3 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::() = len5; - *ptr3 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>() = ptr5.cast_mut(); - } - ThresholdError::CryptoError(e) => { - *ptr3 - .add(::core::mem::size_of::<*const u8>()) - .cast::() = (1i32) as u8; - let vec6 = (e.into_bytes()).into_boxed_slice(); - let ptr6 = vec6.as_ptr().cast::(); - let len6 = vec6.len(); - ::core::mem::forget(vec6); - *ptr3 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::() = len6; - *ptr3 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>() = ptr6.cast_mut(); - } - ThresholdError::SerializationError(e) => { - *ptr3 - .add(::core::mem::size_of::<*const u8>()) - .cast::() = (2i32) as u8; - let vec7 = (e.into_bytes()).into_boxed_slice(); - let ptr7 = vec7.as_ptr().cast::(); - let len7 = vec7.len(); - ::core::mem::forget(vec7); - *ptr3 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::() = len7; - *ptr3 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>() = ptr7.cast_mut(); - } - } - } - }; - ptr3 - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn __post_return_method_threshold_session_evaluate_polynomial< - T: GuestThresholdSession, - >(arg0: *mut u8) { - let l0 = i32::from(*arg0.add(0).cast::()); - match l0 { - 0 => { - let l1 = *arg0 - .add(::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l2 = *arg0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l1, l2, 1); - } - _ => { - let l3 = i32::from( - *arg0.add(::core::mem::size_of::<*const u8>()).cast::(), - ); - match l3 { - 0 => { - let l4 = *arg0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l5 = *arg0 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l4, l5, 1); - } - 1 => { - let l6 = *arg0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l7 = *arg0 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l6, l7, 1); - } - _ => { - let l8 = *arg0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l9 = *arg0 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l8, l9, 1); - } - } - } - } - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn _export_method_threshold_session_mod_n_random_cabi< - T: GuestThresholdSession, - >(arg0: *mut u8) -> *mut u8 { - #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); - let result0 = T::mod_n_random( - unsafe { ThresholdSessionBorrow::lift(arg0 as u32 as usize) } - .get(), - ); - let ptr1 = (&raw mut _RET_AREA.0).cast::(); - match result0 { - Ok(e) => { - *ptr1.add(0).cast::() = (0i32) as u8; - let vec2 = (e.into_bytes()).into_boxed_slice(); - let ptr2 = vec2.as_ptr().cast::(); - let len2 = vec2.len(); - ::core::mem::forget(vec2); - *ptr1 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::() = len2; - *ptr1 - .add(::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>() = ptr2.cast_mut(); - } - Err(e) => { - *ptr1.add(0).cast::() = (1i32) as u8; - match e { - ThresholdError::InvalidInput(e) => { - *ptr1 - .add(::core::mem::size_of::<*const u8>()) - .cast::() = (0i32) as u8; - let vec3 = (e.into_bytes()).into_boxed_slice(); - let ptr3 = vec3.as_ptr().cast::(); - let len3 = vec3.len(); - ::core::mem::forget(vec3); - *ptr1 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::() = len3; - *ptr1 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>() = ptr3.cast_mut(); - } - ThresholdError::CryptoError(e) => { - *ptr1 - .add(::core::mem::size_of::<*const u8>()) - .cast::() = (1i32) as u8; - let vec4 = (e.into_bytes()).into_boxed_slice(); - let ptr4 = vec4.as_ptr().cast::(); - let len4 = vec4.len(); - ::core::mem::forget(vec4); - *ptr1 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::() = len4; - *ptr1 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>() = ptr4.cast_mut(); - } - ThresholdError::SerializationError(e) => { - *ptr1 - .add(::core::mem::size_of::<*const u8>()) - .cast::() = (2i32) as u8; - let vec5 = (e.into_bytes()).into_boxed_slice(); - let ptr5 = vec5.as_ptr().cast::(); - let len5 = vec5.len(); - ::core::mem::forget(vec5); - *ptr1 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::() = len5; - *ptr1 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>() = ptr5.cast_mut(); - } - } - } - }; - ptr1 - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn __post_return_method_threshold_session_mod_n_random< - T: GuestThresholdSession, - >(arg0: *mut u8) { - let l0 = i32::from(*arg0.add(0).cast::()); - match l0 { - 0 => { - let l1 = *arg0 - .add(::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l2 = *arg0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l1, l2, 1); - } - _ => { - let l3 = i32::from( - *arg0.add(::core::mem::size_of::<*const u8>()).cast::(), - ); - match l3 { - 0 => { - let l4 = *arg0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l5 = *arg0 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l4, l5, 1); - } - 1 => { - let l6 = *arg0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l7 = *arg0 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l6, l7, 1); - } - _ => { - let l8 = *arg0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l9 = *arg0 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l8, l9, 1); - } - } - } - } - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn _export_method_threshold_session_elem_base_mul_cabi< - T: GuestThresholdSession, - >(arg0: *mut u8, arg1: *mut u8, arg2: usize) -> *mut u8 { - #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); - let len0 = arg2; - let bytes0 = _rt::Vec::from_raw_parts(arg1.cast(), len0, len0); - let result1 = T::elem_base_mul( - unsafe { ThresholdSessionBorrow::lift(arg0 as u32 as usize) } - .get(), - _rt::string_lift(bytes0), - ); - let ptr2 = (&raw mut _RET_AREA.0).cast::(); - match result1 { - Ok(e) => { - *ptr2.add(0).cast::() = (0i32) as u8; - let vec3 = (e.into_bytes()).into_boxed_slice(); - let ptr3 = vec3.as_ptr().cast::(); - let len3 = vec3.len(); - ::core::mem::forget(vec3); - *ptr2 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::() = len3; - *ptr2 - .add(::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>() = ptr3.cast_mut(); - } - Err(e) => { - *ptr2.add(0).cast::() = (1i32) as u8; - match e { - ThresholdError::InvalidInput(e) => { - *ptr2 - .add(::core::mem::size_of::<*const u8>()) - .cast::() = (0i32) as u8; - let vec4 = (e.into_bytes()).into_boxed_slice(); - let ptr4 = vec4.as_ptr().cast::(); - let len4 = vec4.len(); - ::core::mem::forget(vec4); - *ptr2 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::() = len4; - *ptr2 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>() = ptr4.cast_mut(); - } - ThresholdError::CryptoError(e) => { - *ptr2 - .add(::core::mem::size_of::<*const u8>()) - .cast::() = (1i32) as u8; - let vec5 = (e.into_bytes()).into_boxed_slice(); - let ptr5 = vec5.as_ptr().cast::(); - let len5 = vec5.len(); - ::core::mem::forget(vec5); - *ptr2 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::() = len5; - *ptr2 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>() = ptr5.cast_mut(); - } - ThresholdError::SerializationError(e) => { - *ptr2 - .add(::core::mem::size_of::<*const u8>()) - .cast::() = (2i32) as u8; - let vec6 = (e.into_bytes()).into_boxed_slice(); - let ptr6 = vec6.as_ptr().cast::(); - let len6 = vec6.len(); - ::core::mem::forget(vec6); - *ptr2 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::() = len6; - *ptr2 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>() = ptr6.cast_mut(); - } - } - } - }; - ptr2 - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn __post_return_method_threshold_session_elem_base_mul< - T: GuestThresholdSession, - >(arg0: *mut u8) { - let l0 = i32::from(*arg0.add(0).cast::()); - match l0 { - 0 => { - let l1 = *arg0 - .add(::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l2 = *arg0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l1, l2, 1); - } - _ => { - let l3 = i32::from( - *arg0.add(::core::mem::size_of::<*const u8>()).cast::(), - ); - match l3 { - 0 => { - let l4 = *arg0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l5 = *arg0 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l4, l5, 1); - } - 1 => { - let l6 = *arg0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l7 = *arg0 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l6, l7, 1); - } - _ => { - let l8 = *arg0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l9 = *arg0 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l8, l9, 1); - } - } - } - } - } - pub trait Guest { - type Round1Secret: GuestRound1Secret; - type Round2Secret: GuestRound2Secret; - type SigningNonce: GuestSigningNonce; - type DkgSession: GuestDkgSession; - type SigningSession: GuestSigningSession; - type RefreshSession: GuestRefreshSession; - type AuthSigner: GuestAuthSigner; - type ThresholdSession: GuestThresholdSession; - } - pub trait GuestRound1Secret: 'static { - #[doc(hidden)] - unsafe fn _resource_new(val: *mut u8) -> u32 - where - Self: Sized, - { - #[cfg(not(target_arch = "wasm32"))] - { - let _ = val; - unreachable!(); - } - #[cfg(target_arch = "wasm32")] - { - #[link( - wasm_import_module = "[export]component:threshold/types@0.1.0" - )] - unsafe extern "C" { - #[link_name = "[resource-new]round1-secret"] - fn new(_: *mut u8) -> u32; - } - unsafe { new(val) } - } - } - #[doc(hidden)] - fn _resource_rep(handle: u32) -> *mut u8 - where - Self: Sized, - { - #[cfg(not(target_arch = "wasm32"))] - { - let _ = handle; - unreachable!(); - } - #[cfg(target_arch = "wasm32")] - { - #[link( - wasm_import_module = "[export]component:threshold/types@0.1.0" - )] - unsafe extern "C" { - #[link_name = "[resource-rep]round1-secret"] - fn rep(_: u32) -> *mut u8; - } - unsafe { rep(handle) } - } - } - } - pub trait GuestRound2Secret: 'static { - #[doc(hidden)] - unsafe fn _resource_new(val: *mut u8) -> u32 - where - Self: Sized, - { - #[cfg(not(target_arch = "wasm32"))] - { - let _ = val; - unreachable!(); - } - #[cfg(target_arch = "wasm32")] - { - #[link( - wasm_import_module = "[export]component:threshold/types@0.1.0" - )] - unsafe extern "C" { - #[link_name = "[resource-new]round2-secret"] - fn new(_: *mut u8) -> u32; - } - unsafe { new(val) } - } - } - #[doc(hidden)] - fn _resource_rep(handle: u32) -> *mut u8 - where - Self: Sized, - { - #[cfg(not(target_arch = "wasm32"))] - { - let _ = handle; - unreachable!(); - } - #[cfg(target_arch = "wasm32")] - { - #[link( - wasm_import_module = "[export]component:threshold/types@0.1.0" - )] - unsafe extern "C" { - #[link_name = "[resource-rep]round2-secret"] - fn rep(_: u32) -> *mut u8; - } - unsafe { rep(handle) } - } - } - } - pub trait GuestSigningNonce: 'static { - #[doc(hidden)] - unsafe fn _resource_new(val: *mut u8) -> u32 - where - Self: Sized, - { - #[cfg(not(target_arch = "wasm32"))] - { - let _ = val; - unreachable!(); - } - #[cfg(target_arch = "wasm32")] - { - #[link( - wasm_import_module = "[export]component:threshold/types@0.1.0" - )] - unsafe extern "C" { - #[link_name = "[resource-new]signing-nonce"] - fn new(_: *mut u8) -> u32; - } - unsafe { new(val) } - } - } - #[doc(hidden)] - fn _resource_rep(handle: u32) -> *mut u8 - where - Self: Sized, - { - #[cfg(not(target_arch = "wasm32"))] - { - let _ = handle; - unreachable!(); - } - #[cfg(target_arch = "wasm32")] - { - #[link( - wasm_import_module = "[export]component:threshold/types@0.1.0" - )] - unsafe extern "C" { - #[link_name = "[resource-rep]signing-nonce"] - fn rep(_: u32) -> *mut u8; - } - unsafe { rep(handle) } - } - } - } - pub trait GuestDkgSession: 'static { - #[doc(hidden)] - unsafe fn _resource_new(val: *mut u8) -> u32 - where - Self: Sized, - { - #[cfg(not(target_arch = "wasm32"))] - { - let _ = val; - unreachable!(); - } - #[cfg(target_arch = "wasm32")] - { - #[link( - wasm_import_module = "[export]component:threshold/types@0.1.0" - )] - unsafe extern "C" { - #[link_name = "[resource-new]dkg-session"] - fn new(_: *mut u8) -> u32; - } - unsafe { new(val) } - } - } - #[doc(hidden)] - fn _resource_rep(handle: u32) -> *mut u8 - where - Self: Sized, - { - #[cfg(not(target_arch = "wasm32"))] - { - let _ = handle; - unreachable!(); - } - #[cfg(target_arch = "wasm32")] - { - #[link( - wasm_import_module = "[export]component:threshold/types@0.1.0" - )] - unsafe extern "C" { - #[link_name = "[resource-rep]dkg-session"] - fn rep(_: u32) -> *mut u8; - } - unsafe { rep(handle) } - } - } - fn new() -> Self; - fn reset(&self) -> (); - /// Round 1 packages - fn insert_round1_package( - &self, - id_hex: _rt::String, - pkg_json: _rt::String, - ) -> (); - fn insert_receiver_identifier(&self, id_hex: _rt::String) -> (); - fn total_participants(&self) -> u32; - fn is_receiver(&self, id_hex: _rt::String) -> bool; - fn get_round1_packages_json(&self) -> _rt::String; - fn get_round1_packages_excluding_json( - &self, - exclude_id_hex: _rt::String, - ) -> _rt::String; - fn get_receiver_ids_json(&self) -> _rt::String; - /// Server identity - fn set_server_id(&self, server_id_hex: _rt::String) -> (); - fn get_server_id(&self) -> _rt::String; - fn set_server_internal_secret_hex( - &self, - secret_hex: _rt::String, - ) -> (); - fn get_server_internal_secret_hex(&self) -> _rt::String; - /// Round 2 received - fn insert_round2_received( - &self, - sender_id_hex: _rt::String, - pkg_json: _rt::String, - ) -> (); - fn get_round2_received_json(&self) -> _rt::String; - /// Round 2 local (server's own) - fn set_round2_local_json(&self, json: _rt::String) -> (); - fn get_round2_local_json(&self) -> _rt::String; - fn is_round2_local_empty(&self) -> bool; - /// Round 2 relay: sender -> { recipient -> pkg } - fn insert_relay_packages( - &self, - sender_id_hex: _rt::String, - packages_json: _rt::String, - ) -> (); - fn insert_relay_from_local(&self, server_id_hex: _rt::String) -> (); - fn relay_sender_count(&self) -> u32; - fn get_relay_packages_for( - &self, - recipient_id_hex: _rt::String, - ) -> _rt::String; - } - pub trait GuestSigningSession: 'static { - #[doc(hidden)] - unsafe fn _resource_new(val: *mut u8) -> u32 - where - Self: Sized, - { - #[cfg(not(target_arch = "wasm32"))] - { - let _ = val; - unreachable!(); - } - #[cfg(target_arch = "wasm32")] - { - #[link( - wasm_import_module = "[export]component:threshold/types@0.1.0" - )] - unsafe extern "C" { - #[link_name = "[resource-new]signing-session"] - fn new(_: *mut u8) -> u32; - } - unsafe { new(val) } - } - } - #[doc(hidden)] - fn _resource_rep(handle: u32) -> *mut u8 - where - Self: Sized, - { - #[cfg(not(target_arch = "wasm32"))] - { - let _ = handle; - unreachable!(); - } - #[cfg(target_arch = "wasm32")] - { - #[link( - wasm_import_module = "[export]component:threshold/types@0.1.0" - )] - unsafe extern "C" { - #[link_name = "[resource-rep]signing-session"] - fn rep(_: u32) -> *mut u8; - } - unsafe { rep(handle) } - } - } - fn new() -> Self; - fn reset(&self) -> (); - /// User commitments - fn set_user_hiding_hex(&self, hex: _rt::String) -> (); - fn get_user_hiding_hex(&self) -> _rt::String; - fn set_user_binding_hex(&self, hex: _rt::String) -> (); - fn get_user_binding_hex(&self) -> _rt::String; - /// Message - fn set_message_to_sign(&self, msg_hex: _rt::String) -> (); - fn get_message_to_sign(&self) -> _rt::String; - fn has_message(&self) -> bool; - /// Server commitments - fn set_server_commitments_json(&self, json: _rt::String) -> (); - fn get_server_commitments_json(&self) -> _rt::String; - fn has_server_commitments(&self) -> bool; - /// Commitment list: id -> commitments_json - fn insert_commitment( - &self, - id_hex: _rt::String, - commitments_json: _rt::String, - ) -> (); - fn get_commitments_json(&self) -> _rt::String; - /// Signature shares: id -> share_hex - fn insert_share( - &self, - id_hex: _rt::String, - share_hex: _rt::String, - ) -> (); - fn has_share(&self, id_hex: _rt::String) -> bool; - fn share_count(&self) -> u32; - fn get_shares_json(&self) -> _rt::String; - /// Policy metadata - fn set_current_policy_id(&self, id: _rt::String) -> (); - fn get_current_policy_id(&self) -> _rt::String; - fn set_pending_amount(&self, amount: i64) -> (); - fn get_pending_amount(&self) -> i64; - } - pub trait GuestRefreshSession: 'static { - #[doc(hidden)] - unsafe fn _resource_new(val: *mut u8) -> u32 - where - Self: Sized, - { - #[cfg(not(target_arch = "wasm32"))] - { - let _ = val; - unreachable!(); - } - #[cfg(target_arch = "wasm32")] - { - #[link( - wasm_import_module = "[export]component:threshold/types@0.1.0" - )] - unsafe extern "C" { - #[link_name = "[resource-new]refresh-session"] - fn new(_: *mut u8) -> u32; - } - unsafe { new(val) } - } - } - #[doc(hidden)] - fn _resource_rep(handle: u32) -> *mut u8 - where - Self: Sized, - { - #[cfg(not(target_arch = "wasm32"))] - { - let _ = handle; - unreachable!(); - } - #[cfg(target_arch = "wasm32")] - { - #[link( - wasm_import_module = "[export]component:threshold/types@0.1.0" - )] - unsafe extern "C" { - #[link_name = "[resource-rep]refresh-session"] - fn rep(_: u32) -> *mut u8; - } - unsafe { rep(handle) } - } - } - fn new() -> Self; - fn reset(&self) -> (); - /// Round 1 packages - fn insert_round1_package( - &self, - id_hex: _rt::String, - pkg_json: _rt::String, - ) -> (); - fn round1_count(&self) -> u32; - fn get_round1_packages_json(&self) -> _rt::String; - fn get_round1_packages_excluding_json( - &self, - exclude_id_hex: _rt::String, - ) -> _rt::String; - /// Server identity - fn set_server_id(&self, server_id_hex: _rt::String) -> (); - fn get_server_id(&self) -> _rt::String; - fn set_server_identifier_hex(&self, id_hex: _rt::String) -> (); - fn get_server_identifier_hex(&self) -> _rt::String; - /// Round 2 received - fn insert_round2_received( - &self, - sender_id_hex: _rt::String, - pkg_json: _rt::String, - ) -> (); - fn get_round2_received_json(&self) -> _rt::String; - /// Round 2 local - fn set_round2_local_json(&self, json: _rt::String) -> (); - fn get_round2_local_json(&self) -> _rt::String; - fn is_round2_local_empty(&self) -> bool; - /// Round 2 relay - fn insert_relay_packages( - &self, - sender_id_hex: _rt::String, - packages_json: _rt::String, - ) -> (); - fn insert_relay_from_local(&self, server_id_hex: _rt::String) -> (); - fn relay_sender_count(&self) -> u32; - fn get_relay_packages_for( - &self, - recipient_id_hex: _rt::String, - ) -> _rt::String; - /// Refresh policy metadata - fn set_refresh_creation_time_ms(&self, ms: i64) -> (); - fn get_refresh_creation_time_ms(&self) -> i64; - fn set_refresh_id(&self, id: _rt::String) -> (); - fn get_refresh_id(&self) -> _rt::String; - fn set_refresh_threshold_amount(&self, amount: i64) -> (); - fn get_refresh_threshold_amount(&self) -> i64; - fn set_refresh_interval(&self, interval: i64) -> (); - fn get_refresh_interval(&self) -> i64; - } - pub trait GuestAuthSigner: 'static { - #[doc(hidden)] - unsafe fn _resource_new(val: *mut u8) -> u32 - where - Self: Sized, - { - #[cfg(not(target_arch = "wasm32"))] - { - let _ = val; - unreachable!(); - } - #[cfg(target_arch = "wasm32")] - { - #[link( - wasm_import_module = "[export]component:threshold/types@0.1.0" - )] - unsafe extern "C" { - #[link_name = "[resource-new]auth-signer"] - fn new(_: *mut u8) -> u32; - } - unsafe { new(val) } - } - } - #[doc(hidden)] - fn _resource_rep(handle: u32) -> *mut u8 - where - Self: Sized, - { - #[cfg(not(target_arch = "wasm32"))] - { - let _ = handle; - unreachable!(); - } - #[cfg(target_arch = "wasm32")] - { - #[link( - wasm_import_module = "[export]component:threshold/types@0.1.0" - )] - unsafe extern "C" { - #[link_name = "[resource-rep]auth-signer"] - fn rep(_: u32) -> *mut u8; - } - unsafe { rep(handle) } - } - } - /// Create an AuthSigner from a 64-char hex secret key. - /// Returns the compressed public key hex (66 chars). - fn new(secret_hex: _rt::String) -> Self; - /// Sign a message. Returns signature hex (128 chars). - fn sign( - &self, - message: _rt::Vec, - ) -> Result<_rt::String, ThresholdError>; - /// Get the compressed public key hex (66 chars). - fn public_key(&self) -> Result<_rt::String, ThresholdError>; - } - pub trait GuestThresholdSession: 'static { - #[doc(hidden)] - unsafe fn _resource_new(val: *mut u8) -> u32 - where - Self: Sized, - { - #[cfg(not(target_arch = "wasm32"))] - { - let _ = val; - unreachable!(); - } - #[cfg(target_arch = "wasm32")] - { - #[link( - wasm_import_module = "[export]component:threshold/types@0.1.0" - )] - unsafe extern "C" { - #[link_name = "[resource-new]threshold-session"] - fn new(_: *mut u8) -> u32; - } - unsafe { new(val) } - } - } - #[doc(hidden)] - fn _resource_rep(handle: u32) -> *mut u8 - where - Self: Sized, - { - #[cfg(not(target_arch = "wasm32"))] - { - let _ = handle; - unreachable!(); - } - #[cfg(target_arch = "wasm32")] - { - #[link( - wasm_import_module = "[export]component:threshold/types@0.1.0" - )] - unsafe extern "C" { - #[link_name = "[resource-rep]threshold-session"] - fn rep(_: u32) -> *mut u8; - } - unsafe { rep(handle) } - } - } - fn new() -> Self; - /// ----- DKG ----- - /// DKG round 1: generate secret polynomial, commitment, proof-of-knowledge. - fn dkg_part1( - &self, - max_signers: u32, - min_signers: u32, - secret_hex: _rt::String, - coefficients_json: _rt::String, - ) -> Result; - /// DKG round 2: verify round 1 packages and compute shares. - fn dkg_part2( - &self, - secret: Round1Secret, - round1_packages_json: _rt::String, - receiver_ids_json: _rt::String, - ) -> Result; - /// DKG round 3: verify shares, compute final key package. - fn dkg_part3( - &self, - r2_secret: Round2Secret, - round1_packages_json: _rt::String, - round2_packages_json: _rt::String, - receiver_ids_json: _rt::String, - ) -> Result; - /// DKG round 3 for a passive receiver (no secret polynomial). - fn dkg_part3_receive( - &self, - my_id_hex: _rt::String, - dealer_r1_json: _rt::String, - shares_json: _rt::String, - min_signers: u32, - max_signers: u32, - all_ids_json: _rt::String, - ) -> Result; - /// ----- Key Refresh ----- - /// Key refresh round 1: zero-secret polynomial for share rotation. - fn dkg_refresh_part1( - &self, - id_hex: _rt::String, - max_signers: u32, - min_signers: u32, - seed: _rt::Vec, - ) -> Result; - /// Key refresh round 2: compute refresh shares. - fn dkg_refresh_part2( - &self, - secret: Round1Secret, - round1_packages_json: _rt::String, - ) -> Result; - /// Key refresh round 3: combine with old keys. - fn dkg_refresh_part3( - &self, - r2_secret: Round2Secret, - round1_packages_json: _rt::String, - round2_packages_json: _rt::String, - old_pkp_json: _rt::String, - old_kp_json: _rt::String, - ) -> Result; - /// ----- Signing ----- - /// Generate a signing nonce pair from the signer's secret share. - fn new_nonce( - &self, - secret_hex: _rt::String, - ) -> Result; - /// Compute a FROST signature share. - fn frost_sign( - &self, - signing_package_json: _rt::String, - nonce: SigningNonce, - key_package_json: _rt::String, - ) -> Result<_rt::String, ThresholdError>; - /// Aggregate signature shares into final signature. - fn frost_aggregate( - &self, - signing_package_json: _rt::String, - shares_json: _rt::String, - public_key_package_json: _rt::String, - ) -> Result<_rt::String, ThresholdError>; - /// ----- Key Operations ----- - /// Apply taproot tweak to a KeyPackage. - fn key_package_tweak( - &self, - kp_json: _rt::String, - merkle_root: Option<_rt::Vec>, - ) -> Result<_rt::String, ThresholdError>; - /// Apply taproot tweak to a PublicKeyPackage. - fn pub_key_package_tweak( - &self, - pkp_json: _rt::String, - merkle_root: Option<_rt::Vec>, - ) -> Result<_rt::String, ThresholdError>; - /// Normalize KeyPackage to even Y (BIP-340). - fn key_package_into_even_y( - &self, - kp_json: _rt::String, - ) -> Result<_rt::String, ThresholdError>; - /// Normalize PublicKeyPackage to even Y (BIP-340). - fn pub_key_package_into_even_y( - &self, - pkp_json: _rt::String, - ) -> Result<_rt::String, ThresholdError>; - /// ----- Auth ----- - /// Verify a BIP-340 Schnorr signature. - fn verify_schnorr_signature( - &self, - pk_hex: _rt::String, - message: _rt::Vec, - sig_hex: _rt::String, - ) -> Result; - /// ----- Ark Protocol ----- - /// Compute the default VTXO script pubkey for the given keys and exit delay. - /// Returns hex-encoded 34-byte script pubkey. - fn ark_default_vtxo_script_pubkey( - &self, - server_pk_hex: _rt::String, - owner_pk_hex: _rt::String, - exit_delay: u32, - ) -> Result<_rt::String, ThresholdError>; - /// Get forfeit (cooperative) spend info for a default Ark VTXO. - /// Returns JSON: {"script_hex": "...", "control_block_hex": "..."} - fn ark_forfeit_spend_info( - &self, - server_pk_hex: _rt::String, - owner_pk_hex: _rt::String, - exit_delay: u32, - ) -> Result<_rt::String, ThresholdError>; - /// Get exit (unilateral) spend info for a default Ark VTXO. - /// Returns JSON: {"script_hex": "...", "control_block_hex": "..."} - fn ark_exit_spend_info( - &self, - server_pk_hex: _rt::String, - owner_pk_hex: _rt::String, - exit_delay: u32, - ) -> Result<_rt::String, ThresholdError>; - /// ----- Utils ----- - /// Derive an identifier from arbitrary bytes (SHA-256). - fn identifier_derive( - &self, - message: _rt::Vec, - ) -> Result<_rt::String, ThresholdError>; - /// Create identifier from BigInt hex scalar. - fn identifier_from_bigint( - &self, - hex_str: _rt::String, - ) -> Result<_rt::String, ThresholdError>; - /// Generate random coefficients (seeded if seed non-empty). - fn generate_coefficients( - &self, - count: u32, - seed: _rt::Vec, - ) -> Result<_rt::String, ThresholdError>; - /// Evaluate polynomial at identifier. - fn evaluate_polynomial( - &self, - id_hex: _rt::String, - coefficients_json: _rt::String, - ) -> Result<_rt::String, ThresholdError>; - /// Generate a random non-zero scalar mod n. - fn mod_n_random(&self) -> Result<_rt::String, ThresholdError>; - /// Scalar * G (base point multiplication). - fn elem_base_mul( - &self, - scalar_hex: _rt::String, - ) -> Result<_rt::String, ThresholdError>; - } - #[doc(hidden)] - macro_rules! __export_component_threshold_types_0_1_0_cabi { - ($ty:ident with_types_in $($path_to_types:tt)*) => { - const _ : () = { #[unsafe (export_name = - "component:threshold/types@0.1.0#[constructor]dkg-session")] - unsafe extern "C" fn export_constructor_dkg_session() -> i32 { - unsafe { $($path_to_types)*:: - _export_constructor_dkg_session_cabi::<<$ty as - $($path_to_types)*:: Guest >::DkgSession > () } } #[unsafe - (export_name = - "component:threshold/types@0.1.0#[method]dkg-session.reset")] - unsafe extern "C" fn export_method_dkg_session_reset(arg0 : * mut - u8,) { unsafe { $($path_to_types)*:: - _export_method_dkg_session_reset_cabi::<<$ty as - $($path_to_types)*:: Guest >::DkgSession > (arg0) } } #[unsafe - (export_name = - "component:threshold/types@0.1.0#[method]dkg-session.insert-round1-package")] - unsafe extern "C" fn - export_method_dkg_session_insert_round1_package(arg0 : * mut u8, - arg1 : * mut u8, arg2 : usize, arg3 : * mut u8, arg4 : usize,) { - unsafe { $($path_to_types)*:: - _export_method_dkg_session_insert_round1_package_cabi::<<$ty as - $($path_to_types)*:: Guest >::DkgSession > (arg0, arg1, arg2, - arg3, arg4) } } #[unsafe (export_name = - "component:threshold/types@0.1.0#[method]dkg-session.insert-receiver-identifier")] - unsafe extern "C" fn - export_method_dkg_session_insert_receiver_identifier(arg0 : * mut - u8, arg1 : * mut u8, arg2 : usize,) { unsafe { - $($path_to_types)*:: - _export_method_dkg_session_insert_receiver_identifier_cabi::<<$ty - as $($path_to_types)*:: Guest >::DkgSession > (arg0, arg1, arg2) - } } #[unsafe (export_name = - "component:threshold/types@0.1.0#[method]dkg-session.total-participants")] - unsafe extern "C" fn - export_method_dkg_session_total_participants(arg0 : * mut u8,) -> - i32 { unsafe { $($path_to_types)*:: - _export_method_dkg_session_total_participants_cabi::<<$ty as - $($path_to_types)*:: Guest >::DkgSession > (arg0) } } #[unsafe - (export_name = - "component:threshold/types@0.1.0#[method]dkg-session.is-receiver")] - unsafe extern "C" fn export_method_dkg_session_is_receiver(arg0 : - * mut u8, arg1 : * mut u8, arg2 : usize,) -> i32 { unsafe { - $($path_to_types)*:: - _export_method_dkg_session_is_receiver_cabi::<<$ty as - $($path_to_types)*:: Guest >::DkgSession > (arg0, arg1, arg2) } } - #[unsafe (export_name = - "component:threshold/types@0.1.0#[method]dkg-session.get-round1-packages-json")] - unsafe extern "C" fn - export_method_dkg_session_get_round1_packages_json(arg0 : * mut - u8,) -> * mut u8 { unsafe { $($path_to_types)*:: - _export_method_dkg_session_get_round1_packages_json_cabi::<<$ty - as $($path_to_types)*:: Guest >::DkgSession > (arg0) } } #[unsafe - (export_name = - "cabi_post_component:threshold/types@0.1.0#[method]dkg-session.get-round1-packages-json")] - unsafe extern "C" fn - _post_return_method_dkg_session_get_round1_packages_json(arg0 : * - mut u8,) { unsafe { $($path_to_types)*:: - __post_return_method_dkg_session_get_round1_packages_json::<<$ty - as $($path_to_types)*:: Guest >::DkgSession > (arg0) } } #[unsafe - (export_name = - "component:threshold/types@0.1.0#[method]dkg-session.get-round1-packages-excluding-json")] - unsafe extern "C" fn - export_method_dkg_session_get_round1_packages_excluding_json(arg0 - : * mut u8, arg1 : * mut u8, arg2 : usize,) -> * mut u8 { unsafe - { $($path_to_types)*:: - _export_method_dkg_session_get_round1_packages_excluding_json_cabi::<<$ty - as $($path_to_types)*:: Guest >::DkgSession > (arg0, arg1, arg2) - } } #[unsafe (export_name = - "cabi_post_component:threshold/types@0.1.0#[method]dkg-session.get-round1-packages-excluding-json")] - unsafe extern "C" fn - _post_return_method_dkg_session_get_round1_packages_excluding_json(arg0 - : * mut u8,) { unsafe { $($path_to_types)*:: - __post_return_method_dkg_session_get_round1_packages_excluding_json::<<$ty - as $($path_to_types)*:: Guest >::DkgSession > (arg0) } } #[unsafe - (export_name = - "component:threshold/types@0.1.0#[method]dkg-session.get-receiver-ids-json")] - unsafe extern "C" fn - export_method_dkg_session_get_receiver_ids_json(arg0 : * mut u8,) - -> * mut u8 { unsafe { $($path_to_types)*:: - _export_method_dkg_session_get_receiver_ids_json_cabi::<<$ty as - $($path_to_types)*:: Guest >::DkgSession > (arg0) } } #[unsafe - (export_name = - "cabi_post_component:threshold/types@0.1.0#[method]dkg-session.get-receiver-ids-json")] - unsafe extern "C" fn - _post_return_method_dkg_session_get_receiver_ids_json(arg0 : * - mut u8,) { unsafe { $($path_to_types)*:: - __post_return_method_dkg_session_get_receiver_ids_json::<<$ty as - $($path_to_types)*:: Guest >::DkgSession > (arg0) } } #[unsafe - (export_name = - "component:threshold/types@0.1.0#[method]dkg-session.set-server-id")] - unsafe extern "C" fn export_method_dkg_session_set_server_id(arg0 - : * mut u8, arg1 : * mut u8, arg2 : usize,) { unsafe { - $($path_to_types)*:: - _export_method_dkg_session_set_server_id_cabi::<<$ty as - $($path_to_types)*:: Guest >::DkgSession > (arg0, arg1, arg2) } } - #[unsafe (export_name = - "component:threshold/types@0.1.0#[method]dkg-session.get-server-id")] - unsafe extern "C" fn export_method_dkg_session_get_server_id(arg0 - : * mut u8,) -> * mut u8 { unsafe { $($path_to_types)*:: - _export_method_dkg_session_get_server_id_cabi::<<$ty as - $($path_to_types)*:: Guest >::DkgSession > (arg0) } } #[unsafe - (export_name = - "cabi_post_component:threshold/types@0.1.0#[method]dkg-session.get-server-id")] - unsafe extern "C" fn - _post_return_method_dkg_session_get_server_id(arg0 : * mut u8,) { - unsafe { $($path_to_types)*:: - __post_return_method_dkg_session_get_server_id::<<$ty as - $($path_to_types)*:: Guest >::DkgSession > (arg0) } } #[unsafe - (export_name = - "component:threshold/types@0.1.0#[method]dkg-session.set-server-internal-secret-hex")] - unsafe extern "C" fn - export_method_dkg_session_set_server_internal_secret_hex(arg0 : * - mut u8, arg1 : * mut u8, arg2 : usize,) { unsafe { - $($path_to_types)*:: - _export_method_dkg_session_set_server_internal_secret_hex_cabi::<<$ty - as $($path_to_types)*:: Guest >::DkgSession > (arg0, arg1, arg2) - } } #[unsafe (export_name = - "component:threshold/types@0.1.0#[method]dkg-session.get-server-internal-secret-hex")] - unsafe extern "C" fn - export_method_dkg_session_get_server_internal_secret_hex(arg0 : * - mut u8,) -> * mut u8 { unsafe { $($path_to_types)*:: - _export_method_dkg_session_get_server_internal_secret_hex_cabi::<<$ty - as $($path_to_types)*:: Guest >::DkgSession > (arg0) } } #[unsafe - (export_name = - "cabi_post_component:threshold/types@0.1.0#[method]dkg-session.get-server-internal-secret-hex")] - unsafe extern "C" fn - _post_return_method_dkg_session_get_server_internal_secret_hex(arg0 - : * mut u8,) { unsafe { $($path_to_types)*:: - __post_return_method_dkg_session_get_server_internal_secret_hex::<<$ty - as $($path_to_types)*:: Guest >::DkgSession > (arg0) } } #[unsafe - (export_name = - "component:threshold/types@0.1.0#[method]dkg-session.insert-round2-received")] - unsafe extern "C" fn - export_method_dkg_session_insert_round2_received(arg0 : * mut u8, - arg1 : * mut u8, arg2 : usize, arg3 : * mut u8, arg4 : usize,) { - unsafe { $($path_to_types)*:: - _export_method_dkg_session_insert_round2_received_cabi::<<$ty as - $($path_to_types)*:: Guest >::DkgSession > (arg0, arg1, arg2, - arg3, arg4) } } #[unsafe (export_name = - "component:threshold/types@0.1.0#[method]dkg-session.get-round2-received-json")] - unsafe extern "C" fn - export_method_dkg_session_get_round2_received_json(arg0 : * mut - u8,) -> * mut u8 { unsafe { $($path_to_types)*:: - _export_method_dkg_session_get_round2_received_json_cabi::<<$ty - as $($path_to_types)*:: Guest >::DkgSession > (arg0) } } #[unsafe - (export_name = - "cabi_post_component:threshold/types@0.1.0#[method]dkg-session.get-round2-received-json")] - unsafe extern "C" fn - _post_return_method_dkg_session_get_round2_received_json(arg0 : * - mut u8,) { unsafe { $($path_to_types)*:: - __post_return_method_dkg_session_get_round2_received_json::<<$ty - as $($path_to_types)*:: Guest >::DkgSession > (arg0) } } #[unsafe - (export_name = - "component:threshold/types@0.1.0#[method]dkg-session.set-round2-local-json")] - unsafe extern "C" fn - export_method_dkg_session_set_round2_local_json(arg0 : * mut u8, - arg1 : * mut u8, arg2 : usize,) { unsafe { $($path_to_types)*:: - _export_method_dkg_session_set_round2_local_json_cabi::<<$ty as - $($path_to_types)*:: Guest >::DkgSession > (arg0, arg1, arg2) } } - #[unsafe (export_name = - "component:threshold/types@0.1.0#[method]dkg-session.get-round2-local-json")] - unsafe extern "C" fn - export_method_dkg_session_get_round2_local_json(arg0 : * mut u8,) - -> * mut u8 { unsafe { $($path_to_types)*:: - _export_method_dkg_session_get_round2_local_json_cabi::<<$ty as - $($path_to_types)*:: Guest >::DkgSession > (arg0) } } #[unsafe - (export_name = - "cabi_post_component:threshold/types@0.1.0#[method]dkg-session.get-round2-local-json")] - unsafe extern "C" fn - _post_return_method_dkg_session_get_round2_local_json(arg0 : * - mut u8,) { unsafe { $($path_to_types)*:: - __post_return_method_dkg_session_get_round2_local_json::<<$ty as - $($path_to_types)*:: Guest >::DkgSession > (arg0) } } #[unsafe - (export_name = - "component:threshold/types@0.1.0#[method]dkg-session.is-round2-local-empty")] - unsafe extern "C" fn - export_method_dkg_session_is_round2_local_empty(arg0 : * mut u8,) - -> i32 { unsafe { $($path_to_types)*:: - _export_method_dkg_session_is_round2_local_empty_cabi::<<$ty as - $($path_to_types)*:: Guest >::DkgSession > (arg0) } } #[unsafe - (export_name = - "component:threshold/types@0.1.0#[method]dkg-session.insert-relay-packages")] - unsafe extern "C" fn - export_method_dkg_session_insert_relay_packages(arg0 : * mut u8, - arg1 : * mut u8, arg2 : usize, arg3 : * mut u8, arg4 : usize,) { - unsafe { $($path_to_types)*:: - _export_method_dkg_session_insert_relay_packages_cabi::<<$ty as - $($path_to_types)*:: Guest >::DkgSession > (arg0, arg1, arg2, - arg3, arg4) } } #[unsafe (export_name = - "component:threshold/types@0.1.0#[method]dkg-session.insert-relay-from-local")] - unsafe extern "C" fn - export_method_dkg_session_insert_relay_from_local(arg0 : * mut - u8, arg1 : * mut u8, arg2 : usize,) { unsafe { - $($path_to_types)*:: - _export_method_dkg_session_insert_relay_from_local_cabi::<<$ty as - $($path_to_types)*:: Guest >::DkgSession > (arg0, arg1, arg2) } } - #[unsafe (export_name = - "component:threshold/types@0.1.0#[method]dkg-session.relay-sender-count")] - unsafe extern "C" fn - export_method_dkg_session_relay_sender_count(arg0 : * mut u8,) -> - i32 { unsafe { $($path_to_types)*:: - _export_method_dkg_session_relay_sender_count_cabi::<<$ty as - $($path_to_types)*:: Guest >::DkgSession > (arg0) } } #[unsafe - (export_name = - "component:threshold/types@0.1.0#[method]dkg-session.get-relay-packages-for")] - unsafe extern "C" fn - export_method_dkg_session_get_relay_packages_for(arg0 : * mut u8, - arg1 : * mut u8, arg2 : usize,) -> * mut u8 { unsafe { - $($path_to_types)*:: - _export_method_dkg_session_get_relay_packages_for_cabi::<<$ty as - $($path_to_types)*:: Guest >::DkgSession > (arg0, arg1, arg2) } } - #[unsafe (export_name = - "cabi_post_component:threshold/types@0.1.0#[method]dkg-session.get-relay-packages-for")] - unsafe extern "C" fn - _post_return_method_dkg_session_get_relay_packages_for(arg0 : * - mut u8,) { unsafe { $($path_to_types)*:: - __post_return_method_dkg_session_get_relay_packages_for::<<$ty as - $($path_to_types)*:: Guest >::DkgSession > (arg0) } } #[unsafe - (export_name = - "component:threshold/types@0.1.0#[constructor]signing-session")] - unsafe extern "C" fn export_constructor_signing_session() -> i32 - { unsafe { $($path_to_types)*:: - _export_constructor_signing_session_cabi::<<$ty as - $($path_to_types)*:: Guest >::SigningSession > () } } #[unsafe - (export_name = - "component:threshold/types@0.1.0#[method]signing-session.reset")] - unsafe extern "C" fn export_method_signing_session_reset(arg0 : * - mut u8,) { unsafe { $($path_to_types)*:: - _export_method_signing_session_reset_cabi::<<$ty as - $($path_to_types)*:: Guest >::SigningSession > (arg0) } } - #[unsafe (export_name = - "component:threshold/types@0.1.0#[method]signing-session.set-user-hiding-hex")] - unsafe extern "C" fn - export_method_signing_session_set_user_hiding_hex(arg0 : * mut - u8, arg1 : * mut u8, arg2 : usize,) { unsafe { - $($path_to_types)*:: - _export_method_signing_session_set_user_hiding_hex_cabi::<<$ty as - $($path_to_types)*:: Guest >::SigningSession > (arg0, arg1, arg2) - } } #[unsafe (export_name = - "component:threshold/types@0.1.0#[method]signing-session.get-user-hiding-hex")] - unsafe extern "C" fn - export_method_signing_session_get_user_hiding_hex(arg0 : * mut - u8,) -> * mut u8 { unsafe { $($path_to_types)*:: - _export_method_signing_session_get_user_hiding_hex_cabi::<<$ty as - $($path_to_types)*:: Guest >::SigningSession > (arg0) } } - #[unsafe (export_name = - "cabi_post_component:threshold/types@0.1.0#[method]signing-session.get-user-hiding-hex")] - unsafe extern "C" fn - _post_return_method_signing_session_get_user_hiding_hex(arg0 : * - mut u8,) { unsafe { $($path_to_types)*:: - __post_return_method_signing_session_get_user_hiding_hex::<<$ty - as $($path_to_types)*:: Guest >::SigningSession > (arg0) } } - #[unsafe (export_name = - "component:threshold/types@0.1.0#[method]signing-session.set-user-binding-hex")] - unsafe extern "C" fn - export_method_signing_session_set_user_binding_hex(arg0 : * mut - u8, arg1 : * mut u8, arg2 : usize,) { unsafe { - $($path_to_types)*:: - _export_method_signing_session_set_user_binding_hex_cabi::<<$ty - as $($path_to_types)*:: Guest >::SigningSession > (arg0, arg1, - arg2) } } #[unsafe (export_name = - "component:threshold/types@0.1.0#[method]signing-session.get-user-binding-hex")] - unsafe extern "C" fn - export_method_signing_session_get_user_binding_hex(arg0 : * mut - u8,) -> * mut u8 { unsafe { $($path_to_types)*:: - _export_method_signing_session_get_user_binding_hex_cabi::<<$ty - as $($path_to_types)*:: Guest >::SigningSession > (arg0) } } - #[unsafe (export_name = - "cabi_post_component:threshold/types@0.1.0#[method]signing-session.get-user-binding-hex")] - unsafe extern "C" fn - _post_return_method_signing_session_get_user_binding_hex(arg0 : * - mut u8,) { unsafe { $($path_to_types)*:: - __post_return_method_signing_session_get_user_binding_hex::<<$ty - as $($path_to_types)*:: Guest >::SigningSession > (arg0) } } - #[unsafe (export_name = - "component:threshold/types@0.1.0#[method]signing-session.set-message-to-sign")] - unsafe extern "C" fn - export_method_signing_session_set_message_to_sign(arg0 : * mut - u8, arg1 : * mut u8, arg2 : usize,) { unsafe { - $($path_to_types)*:: - _export_method_signing_session_set_message_to_sign_cabi::<<$ty as - $($path_to_types)*:: Guest >::SigningSession > (arg0, arg1, arg2) - } } #[unsafe (export_name = - "component:threshold/types@0.1.0#[method]signing-session.get-message-to-sign")] - unsafe extern "C" fn - export_method_signing_session_get_message_to_sign(arg0 : * mut - u8,) -> * mut u8 { unsafe { $($path_to_types)*:: - _export_method_signing_session_get_message_to_sign_cabi::<<$ty as - $($path_to_types)*:: Guest >::SigningSession > (arg0) } } - #[unsafe (export_name = - "cabi_post_component:threshold/types@0.1.0#[method]signing-session.get-message-to-sign")] - unsafe extern "C" fn - _post_return_method_signing_session_get_message_to_sign(arg0 : * - mut u8,) { unsafe { $($path_to_types)*:: - __post_return_method_signing_session_get_message_to_sign::<<$ty - as $($path_to_types)*:: Guest >::SigningSession > (arg0) } } - #[unsafe (export_name = - "component:threshold/types@0.1.0#[method]signing-session.has-message")] - unsafe extern "C" fn - export_method_signing_session_has_message(arg0 : * mut u8,) -> - i32 { unsafe { $($path_to_types)*:: - _export_method_signing_session_has_message_cabi::<<$ty as - $($path_to_types)*:: Guest >::SigningSession > (arg0) } } - #[unsafe (export_name = - "component:threshold/types@0.1.0#[method]signing-session.set-server-commitments-json")] - unsafe extern "C" fn - export_method_signing_session_set_server_commitments_json(arg0 : - * mut u8, arg1 : * mut u8, arg2 : usize,) { unsafe { - $($path_to_types)*:: - _export_method_signing_session_set_server_commitments_json_cabi::<<$ty - as $($path_to_types)*:: Guest >::SigningSession > (arg0, arg1, - arg2) } } #[unsafe (export_name = - "component:threshold/types@0.1.0#[method]signing-session.get-server-commitments-json")] - unsafe extern "C" fn - export_method_signing_session_get_server_commitments_json(arg0 : - * mut u8,) -> * mut u8 { unsafe { $($path_to_types)*:: - _export_method_signing_session_get_server_commitments_json_cabi::<<$ty - as $($path_to_types)*:: Guest >::SigningSession > (arg0) } } - #[unsafe (export_name = - "cabi_post_component:threshold/types@0.1.0#[method]signing-session.get-server-commitments-json")] - unsafe extern "C" fn - _post_return_method_signing_session_get_server_commitments_json(arg0 - : * mut u8,) { unsafe { $($path_to_types)*:: - __post_return_method_signing_session_get_server_commitments_json::<<$ty - as $($path_to_types)*:: Guest >::SigningSession > (arg0) } } - #[unsafe (export_name = - "component:threshold/types@0.1.0#[method]signing-session.has-server-commitments")] - unsafe extern "C" fn - export_method_signing_session_has_server_commitments(arg0 : * mut - u8,) -> i32 { unsafe { $($path_to_types)*:: - _export_method_signing_session_has_server_commitments_cabi::<<$ty - as $($path_to_types)*:: Guest >::SigningSession > (arg0) } } - #[unsafe (export_name = - "component:threshold/types@0.1.0#[method]signing-session.insert-commitment")] - unsafe extern "C" fn - export_method_signing_session_insert_commitment(arg0 : * mut u8, - arg1 : * mut u8, arg2 : usize, arg3 : * mut u8, arg4 : usize,) { - unsafe { $($path_to_types)*:: - _export_method_signing_session_insert_commitment_cabi::<<$ty as - $($path_to_types)*:: Guest >::SigningSession > (arg0, arg1, arg2, - arg3, arg4) } } #[unsafe (export_name = - "component:threshold/types@0.1.0#[method]signing-session.get-commitments-json")] - unsafe extern "C" fn - export_method_signing_session_get_commitments_json(arg0 : * mut - u8,) -> * mut u8 { unsafe { $($path_to_types)*:: - _export_method_signing_session_get_commitments_json_cabi::<<$ty - as $($path_to_types)*:: Guest >::SigningSession > (arg0) } } - #[unsafe (export_name = - "cabi_post_component:threshold/types@0.1.0#[method]signing-session.get-commitments-json")] - unsafe extern "C" fn - _post_return_method_signing_session_get_commitments_json(arg0 : * - mut u8,) { unsafe { $($path_to_types)*:: - __post_return_method_signing_session_get_commitments_json::<<$ty - as $($path_to_types)*:: Guest >::SigningSession > (arg0) } } - #[unsafe (export_name = - "component:threshold/types@0.1.0#[method]signing-session.insert-share")] - unsafe extern "C" fn - export_method_signing_session_insert_share(arg0 : * mut u8, arg1 - : * mut u8, arg2 : usize, arg3 : * mut u8, arg4 : usize,) { - unsafe { $($path_to_types)*:: - _export_method_signing_session_insert_share_cabi::<<$ty as - $($path_to_types)*:: Guest >::SigningSession > (arg0, arg1, arg2, - arg3, arg4) } } #[unsafe (export_name = - "component:threshold/types@0.1.0#[method]signing-session.has-share")] - unsafe extern "C" fn export_method_signing_session_has_share(arg0 - : * mut u8, arg1 : * mut u8, arg2 : usize,) -> i32 { unsafe { - $($path_to_types)*:: - _export_method_signing_session_has_share_cabi::<<$ty as - $($path_to_types)*:: Guest >::SigningSession > (arg0, arg1, arg2) - } } #[unsafe (export_name = - "component:threshold/types@0.1.0#[method]signing-session.share-count")] - unsafe extern "C" fn - export_method_signing_session_share_count(arg0 : * mut u8,) -> - i32 { unsafe { $($path_to_types)*:: - _export_method_signing_session_share_count_cabi::<<$ty as - $($path_to_types)*:: Guest >::SigningSession > (arg0) } } - #[unsafe (export_name = - "component:threshold/types@0.1.0#[method]signing-session.get-shares-json")] - unsafe extern "C" fn - export_method_signing_session_get_shares_json(arg0 : * mut u8,) - -> * mut u8 { unsafe { $($path_to_types)*:: - _export_method_signing_session_get_shares_json_cabi::<<$ty as - $($path_to_types)*:: Guest >::SigningSession > (arg0) } } - #[unsafe (export_name = - "cabi_post_component:threshold/types@0.1.0#[method]signing-session.get-shares-json")] - unsafe extern "C" fn - _post_return_method_signing_session_get_shares_json(arg0 : * mut - u8,) { unsafe { $($path_to_types)*:: - __post_return_method_signing_session_get_shares_json::<<$ty as - $($path_to_types)*:: Guest >::SigningSession > (arg0) } } - #[unsafe (export_name = - "component:threshold/types@0.1.0#[method]signing-session.set-current-policy-id")] - unsafe extern "C" fn - export_method_signing_session_set_current_policy_id(arg0 : * mut - u8, arg1 : * mut u8, arg2 : usize,) { unsafe { - $($path_to_types)*:: - _export_method_signing_session_set_current_policy_id_cabi::<<$ty - as $($path_to_types)*:: Guest >::SigningSession > (arg0, arg1, - arg2) } } #[unsafe (export_name = - "component:threshold/types@0.1.0#[method]signing-session.get-current-policy-id")] - unsafe extern "C" fn - export_method_signing_session_get_current_policy_id(arg0 : * mut - u8,) -> * mut u8 { unsafe { $($path_to_types)*:: - _export_method_signing_session_get_current_policy_id_cabi::<<$ty - as $($path_to_types)*:: Guest >::SigningSession > (arg0) } } - #[unsafe (export_name = - "cabi_post_component:threshold/types@0.1.0#[method]signing-session.get-current-policy-id")] - unsafe extern "C" fn - _post_return_method_signing_session_get_current_policy_id(arg0 : - * mut u8,) { unsafe { $($path_to_types)*:: - __post_return_method_signing_session_get_current_policy_id::<<$ty - as $($path_to_types)*:: Guest >::SigningSession > (arg0) } } - #[unsafe (export_name = - "component:threshold/types@0.1.0#[method]signing-session.set-pending-amount")] - unsafe extern "C" fn - export_method_signing_session_set_pending_amount(arg0 : * mut u8, - arg1 : i64,) { unsafe { $($path_to_types)*:: - _export_method_signing_session_set_pending_amount_cabi::<<$ty as - $($path_to_types)*:: Guest >::SigningSession > (arg0, arg1) } } - #[unsafe (export_name = - "component:threshold/types@0.1.0#[method]signing-session.get-pending-amount")] - unsafe extern "C" fn - export_method_signing_session_get_pending_amount(arg0 : * mut - u8,) -> i64 { unsafe { $($path_to_types)*:: - _export_method_signing_session_get_pending_amount_cabi::<<$ty as - $($path_to_types)*:: Guest >::SigningSession > (arg0) } } - #[unsafe (export_name = - "component:threshold/types@0.1.0#[constructor]refresh-session")] - unsafe extern "C" fn export_constructor_refresh_session() -> i32 - { unsafe { $($path_to_types)*:: - _export_constructor_refresh_session_cabi::<<$ty as - $($path_to_types)*:: Guest >::RefreshSession > () } } #[unsafe - (export_name = - "component:threshold/types@0.1.0#[method]refresh-session.reset")] - unsafe extern "C" fn export_method_refresh_session_reset(arg0 : * - mut u8,) { unsafe { $($path_to_types)*:: - _export_method_refresh_session_reset_cabi::<<$ty as - $($path_to_types)*:: Guest >::RefreshSession > (arg0) } } - #[unsafe (export_name = - "component:threshold/types@0.1.0#[method]refresh-session.insert-round1-package")] - unsafe extern "C" fn - export_method_refresh_session_insert_round1_package(arg0 : * mut - u8, arg1 : * mut u8, arg2 : usize, arg3 : * mut u8, arg4 : - usize,) { unsafe { $($path_to_types)*:: - _export_method_refresh_session_insert_round1_package_cabi::<<$ty - as $($path_to_types)*:: Guest >::RefreshSession > (arg0, arg1, - arg2, arg3, arg4) } } #[unsafe (export_name = - "component:threshold/types@0.1.0#[method]refresh-session.round1-count")] - unsafe extern "C" fn - export_method_refresh_session_round1_count(arg0 : * mut u8,) -> - i32 { unsafe { $($path_to_types)*:: - _export_method_refresh_session_round1_count_cabi::<<$ty as - $($path_to_types)*:: Guest >::RefreshSession > (arg0) } } - #[unsafe (export_name = - "component:threshold/types@0.1.0#[method]refresh-session.get-round1-packages-json")] - unsafe extern "C" fn - export_method_refresh_session_get_round1_packages_json(arg0 : * - mut u8,) -> * mut u8 { unsafe { $($path_to_types)*:: - _export_method_refresh_session_get_round1_packages_json_cabi::<<$ty - as $($path_to_types)*:: Guest >::RefreshSession > (arg0) } } - #[unsafe (export_name = - "cabi_post_component:threshold/types@0.1.0#[method]refresh-session.get-round1-packages-json")] - unsafe extern "C" fn - _post_return_method_refresh_session_get_round1_packages_json(arg0 - : * mut u8,) { unsafe { $($path_to_types)*:: - __post_return_method_refresh_session_get_round1_packages_json::<<$ty - as $($path_to_types)*:: Guest >::RefreshSession > (arg0) } } - #[unsafe (export_name = - "component:threshold/types@0.1.0#[method]refresh-session.get-round1-packages-excluding-json")] - unsafe extern "C" fn - export_method_refresh_session_get_round1_packages_excluding_json(arg0 - : * mut u8, arg1 : * mut u8, arg2 : usize,) -> * mut u8 { unsafe - { $($path_to_types)*:: - _export_method_refresh_session_get_round1_packages_excluding_json_cabi::<<$ty - as $($path_to_types)*:: Guest >::RefreshSession > (arg0, arg1, - arg2) } } #[unsafe (export_name = - "cabi_post_component:threshold/types@0.1.0#[method]refresh-session.get-round1-packages-excluding-json")] - unsafe extern "C" fn - _post_return_method_refresh_session_get_round1_packages_excluding_json(arg0 - : * mut u8,) { unsafe { $($path_to_types)*:: - __post_return_method_refresh_session_get_round1_packages_excluding_json::<<$ty - as $($path_to_types)*:: Guest >::RefreshSession > (arg0) } } - #[unsafe (export_name = - "component:threshold/types@0.1.0#[method]refresh-session.set-server-id")] - unsafe extern "C" fn - export_method_refresh_session_set_server_id(arg0 : * mut u8, arg1 - : * mut u8, arg2 : usize,) { unsafe { $($path_to_types)*:: - _export_method_refresh_session_set_server_id_cabi::<<$ty as - $($path_to_types)*:: Guest >::RefreshSession > (arg0, arg1, arg2) - } } #[unsafe (export_name = - "component:threshold/types@0.1.0#[method]refresh-session.get-server-id")] - unsafe extern "C" fn - export_method_refresh_session_get_server_id(arg0 : * mut u8,) -> - * mut u8 { unsafe { $($path_to_types)*:: - _export_method_refresh_session_get_server_id_cabi::<<$ty as - $($path_to_types)*:: Guest >::RefreshSession > (arg0) } } - #[unsafe (export_name = - "cabi_post_component:threshold/types@0.1.0#[method]refresh-session.get-server-id")] - unsafe extern "C" fn - _post_return_method_refresh_session_get_server_id(arg0 : * mut - u8,) { unsafe { $($path_to_types)*:: - __post_return_method_refresh_session_get_server_id::<<$ty as - $($path_to_types)*:: Guest >::RefreshSession > (arg0) } } - #[unsafe (export_name = - "component:threshold/types@0.1.0#[method]refresh-session.set-server-identifier-hex")] - unsafe extern "C" fn - export_method_refresh_session_set_server_identifier_hex(arg0 : * - mut u8, arg1 : * mut u8, arg2 : usize,) { unsafe { - $($path_to_types)*:: - _export_method_refresh_session_set_server_identifier_hex_cabi::<<$ty - as $($path_to_types)*:: Guest >::RefreshSession > (arg0, arg1, - arg2) } } #[unsafe (export_name = - "component:threshold/types@0.1.0#[method]refresh-session.get-server-identifier-hex")] - unsafe extern "C" fn - export_method_refresh_session_get_server_identifier_hex(arg0 : * - mut u8,) -> * mut u8 { unsafe { $($path_to_types)*:: - _export_method_refresh_session_get_server_identifier_hex_cabi::<<$ty - as $($path_to_types)*:: Guest >::RefreshSession > (arg0) } } - #[unsafe (export_name = - "cabi_post_component:threshold/types@0.1.0#[method]refresh-session.get-server-identifier-hex")] - unsafe extern "C" fn - _post_return_method_refresh_session_get_server_identifier_hex(arg0 - : * mut u8,) { unsafe { $($path_to_types)*:: - __post_return_method_refresh_session_get_server_identifier_hex::<<$ty - as $($path_to_types)*:: Guest >::RefreshSession > (arg0) } } - #[unsafe (export_name = - "component:threshold/types@0.1.0#[method]refresh-session.insert-round2-received")] - unsafe extern "C" fn - export_method_refresh_session_insert_round2_received(arg0 : * mut - u8, arg1 : * mut u8, arg2 : usize, arg3 : * mut u8, arg4 : - usize,) { unsafe { $($path_to_types)*:: - _export_method_refresh_session_insert_round2_received_cabi::<<$ty - as $($path_to_types)*:: Guest >::RefreshSession > (arg0, arg1, - arg2, arg3, arg4) } } #[unsafe (export_name = - "component:threshold/types@0.1.0#[method]refresh-session.get-round2-received-json")] - unsafe extern "C" fn - export_method_refresh_session_get_round2_received_json(arg0 : * - mut u8,) -> * mut u8 { unsafe { $($path_to_types)*:: - _export_method_refresh_session_get_round2_received_json_cabi::<<$ty - as $($path_to_types)*:: Guest >::RefreshSession > (arg0) } } - #[unsafe (export_name = - "cabi_post_component:threshold/types@0.1.0#[method]refresh-session.get-round2-received-json")] - unsafe extern "C" fn - _post_return_method_refresh_session_get_round2_received_json(arg0 - : * mut u8,) { unsafe { $($path_to_types)*:: - __post_return_method_refresh_session_get_round2_received_json::<<$ty - as $($path_to_types)*:: Guest >::RefreshSession > (arg0) } } - #[unsafe (export_name = - "component:threshold/types@0.1.0#[method]refresh-session.set-round2-local-json")] - unsafe extern "C" fn - export_method_refresh_session_set_round2_local_json(arg0 : * mut - u8, arg1 : * mut u8, arg2 : usize,) { unsafe { - $($path_to_types)*:: - _export_method_refresh_session_set_round2_local_json_cabi::<<$ty - as $($path_to_types)*:: Guest >::RefreshSession > (arg0, arg1, - arg2) } } #[unsafe (export_name = - "component:threshold/types@0.1.0#[method]refresh-session.get-round2-local-json")] - unsafe extern "C" fn - export_method_refresh_session_get_round2_local_json(arg0 : * mut - u8,) -> * mut u8 { unsafe { $($path_to_types)*:: - _export_method_refresh_session_get_round2_local_json_cabi::<<$ty - as $($path_to_types)*:: Guest >::RefreshSession > (arg0) } } - #[unsafe (export_name = - "cabi_post_component:threshold/types@0.1.0#[method]refresh-session.get-round2-local-json")] - unsafe extern "C" fn - _post_return_method_refresh_session_get_round2_local_json(arg0 : - * mut u8,) { unsafe { $($path_to_types)*:: - __post_return_method_refresh_session_get_round2_local_json::<<$ty - as $($path_to_types)*:: Guest >::RefreshSession > (arg0) } } - #[unsafe (export_name = - "component:threshold/types@0.1.0#[method]refresh-session.is-round2-local-empty")] - unsafe extern "C" fn - export_method_refresh_session_is_round2_local_empty(arg0 : * mut - u8,) -> i32 { unsafe { $($path_to_types)*:: - _export_method_refresh_session_is_round2_local_empty_cabi::<<$ty - as $($path_to_types)*:: Guest >::RefreshSession > (arg0) } } - #[unsafe (export_name = - "component:threshold/types@0.1.0#[method]refresh-session.insert-relay-packages")] - unsafe extern "C" fn - export_method_refresh_session_insert_relay_packages(arg0 : * mut - u8, arg1 : * mut u8, arg2 : usize, arg3 : * mut u8, arg4 : - usize,) { unsafe { $($path_to_types)*:: - _export_method_refresh_session_insert_relay_packages_cabi::<<$ty - as $($path_to_types)*:: Guest >::RefreshSession > (arg0, arg1, - arg2, arg3, arg4) } } #[unsafe (export_name = - "component:threshold/types@0.1.0#[method]refresh-session.insert-relay-from-local")] - unsafe extern "C" fn - export_method_refresh_session_insert_relay_from_local(arg0 : * - mut u8, arg1 : * mut u8, arg2 : usize,) { unsafe { - $($path_to_types)*:: - _export_method_refresh_session_insert_relay_from_local_cabi::<<$ty - as $($path_to_types)*:: Guest >::RefreshSession > (arg0, arg1, - arg2) } } #[unsafe (export_name = - "component:threshold/types@0.1.0#[method]refresh-session.relay-sender-count")] - unsafe extern "C" fn - export_method_refresh_session_relay_sender_count(arg0 : * mut - u8,) -> i32 { unsafe { $($path_to_types)*:: - _export_method_refresh_session_relay_sender_count_cabi::<<$ty as - $($path_to_types)*:: Guest >::RefreshSession > (arg0) } } - #[unsafe (export_name = - "component:threshold/types@0.1.0#[method]refresh-session.get-relay-packages-for")] - unsafe extern "C" fn - export_method_refresh_session_get_relay_packages_for(arg0 : * mut - u8, arg1 : * mut u8, arg2 : usize,) -> * mut u8 { unsafe { - $($path_to_types)*:: - _export_method_refresh_session_get_relay_packages_for_cabi::<<$ty - as $($path_to_types)*:: Guest >::RefreshSession > (arg0, arg1, - arg2) } } #[unsafe (export_name = - "cabi_post_component:threshold/types@0.1.0#[method]refresh-session.get-relay-packages-for")] - unsafe extern "C" fn - _post_return_method_refresh_session_get_relay_packages_for(arg0 : - * mut u8,) { unsafe { $($path_to_types)*:: - __post_return_method_refresh_session_get_relay_packages_for::<<$ty - as $($path_to_types)*:: Guest >::RefreshSession > (arg0) } } - #[unsafe (export_name = - "component:threshold/types@0.1.0#[method]refresh-session.set-refresh-creation-time-ms")] - unsafe extern "C" fn - export_method_refresh_session_set_refresh_creation_time_ms(arg0 : - * mut u8, arg1 : i64,) { unsafe { $($path_to_types)*:: - _export_method_refresh_session_set_refresh_creation_time_ms_cabi::<<$ty - as $($path_to_types)*:: Guest >::RefreshSession > (arg0, arg1) } - } #[unsafe (export_name = - "component:threshold/types@0.1.0#[method]refresh-session.get-refresh-creation-time-ms")] - unsafe extern "C" fn - export_method_refresh_session_get_refresh_creation_time_ms(arg0 : - * mut u8,) -> i64 { unsafe { $($path_to_types)*:: - _export_method_refresh_session_get_refresh_creation_time_ms_cabi::<<$ty - as $($path_to_types)*:: Guest >::RefreshSession > (arg0) } } - #[unsafe (export_name = - "component:threshold/types@0.1.0#[method]refresh-session.set-refresh-id")] - unsafe extern "C" fn - export_method_refresh_session_set_refresh_id(arg0 : * mut u8, - arg1 : * mut u8, arg2 : usize,) { unsafe { $($path_to_types)*:: - _export_method_refresh_session_set_refresh_id_cabi::<<$ty as - $($path_to_types)*:: Guest >::RefreshSession > (arg0, arg1, arg2) - } } #[unsafe (export_name = - "component:threshold/types@0.1.0#[method]refresh-session.get-refresh-id")] - unsafe extern "C" fn - export_method_refresh_session_get_refresh_id(arg0 : * mut u8,) -> - * mut u8 { unsafe { $($path_to_types)*:: - _export_method_refresh_session_get_refresh_id_cabi::<<$ty as - $($path_to_types)*:: Guest >::RefreshSession > (arg0) } } - #[unsafe (export_name = - "cabi_post_component:threshold/types@0.1.0#[method]refresh-session.get-refresh-id")] - unsafe extern "C" fn - _post_return_method_refresh_session_get_refresh_id(arg0 : * mut - u8,) { unsafe { $($path_to_types)*:: - __post_return_method_refresh_session_get_refresh_id::<<$ty as - $($path_to_types)*:: Guest >::RefreshSession > (arg0) } } - #[unsafe (export_name = - "component:threshold/types@0.1.0#[method]refresh-session.set-refresh-threshold-amount")] - unsafe extern "C" fn - export_method_refresh_session_set_refresh_threshold_amount(arg0 : - * mut u8, arg1 : i64,) { unsafe { $($path_to_types)*:: - _export_method_refresh_session_set_refresh_threshold_amount_cabi::<<$ty - as $($path_to_types)*:: Guest >::RefreshSession > (arg0, arg1) } - } #[unsafe (export_name = - "component:threshold/types@0.1.0#[method]refresh-session.get-refresh-threshold-amount")] - unsafe extern "C" fn - export_method_refresh_session_get_refresh_threshold_amount(arg0 : - * mut u8,) -> i64 { unsafe { $($path_to_types)*:: - _export_method_refresh_session_get_refresh_threshold_amount_cabi::<<$ty - as $($path_to_types)*:: Guest >::RefreshSession > (arg0) } } - #[unsafe (export_name = - "component:threshold/types@0.1.0#[method]refresh-session.set-refresh-interval")] - unsafe extern "C" fn - export_method_refresh_session_set_refresh_interval(arg0 : * mut - u8, arg1 : i64,) { unsafe { $($path_to_types)*:: - _export_method_refresh_session_set_refresh_interval_cabi::<<$ty - as $($path_to_types)*:: Guest >::RefreshSession > (arg0, arg1) } - } #[unsafe (export_name = - "component:threshold/types@0.1.0#[method]refresh-session.get-refresh-interval")] - unsafe extern "C" fn - export_method_refresh_session_get_refresh_interval(arg0 : * mut - u8,) -> i64 { unsafe { $($path_to_types)*:: - _export_method_refresh_session_get_refresh_interval_cabi::<<$ty - as $($path_to_types)*:: Guest >::RefreshSession > (arg0) } } - #[unsafe (export_name = - "component:threshold/types@0.1.0#[constructor]auth-signer")] - unsafe extern "C" fn export_constructor_auth_signer(arg0 : * mut - u8, arg1 : usize,) -> i32 { unsafe { $($path_to_types)*:: - _export_constructor_auth_signer_cabi::<<$ty as - $($path_to_types)*:: Guest >::AuthSigner > (arg0, arg1) } } - #[unsafe (export_name = - "component:threshold/types@0.1.0#[method]auth-signer.sign")] - unsafe extern "C" fn export_method_auth_signer_sign(arg0 : * mut - u8, arg1 : * mut u8, arg2 : usize,) -> * mut u8 { unsafe { - $($path_to_types)*:: _export_method_auth_signer_sign_cabi::<<$ty - as $($path_to_types)*:: Guest >::AuthSigner > (arg0, arg1, arg2) - } } #[unsafe (export_name = - "cabi_post_component:threshold/types@0.1.0#[method]auth-signer.sign")] - unsafe extern "C" fn _post_return_method_auth_signer_sign(arg0 : - * mut u8,) { unsafe { $($path_to_types)*:: - __post_return_method_auth_signer_sign::<<$ty as - $($path_to_types)*:: Guest >::AuthSigner > (arg0) } } #[unsafe - (export_name = - "component:threshold/types@0.1.0#[method]auth-signer.public-key")] - unsafe extern "C" fn export_method_auth_signer_public_key(arg0 : - * mut u8,) -> * mut u8 { unsafe { $($path_to_types)*:: - _export_method_auth_signer_public_key_cabi::<<$ty as - $($path_to_types)*:: Guest >::AuthSigner > (arg0) } } #[unsafe - (export_name = - "cabi_post_component:threshold/types@0.1.0#[method]auth-signer.public-key")] - unsafe extern "C" fn - _post_return_method_auth_signer_public_key(arg0 : * mut u8,) { - unsafe { $($path_to_types)*:: - __post_return_method_auth_signer_public_key::<<$ty as - $($path_to_types)*:: Guest >::AuthSigner > (arg0) } } #[unsafe - (export_name = - "component:threshold/types@0.1.0#[constructor]threshold-session")] - unsafe extern "C" fn export_constructor_threshold_session() -> - i32 { unsafe { $($path_to_types)*:: - _export_constructor_threshold_session_cabi::<<$ty as - $($path_to_types)*:: Guest >::ThresholdSession > () } } #[unsafe - (export_name = - "component:threshold/types@0.1.0#[method]threshold-session.dkg-part1")] - unsafe extern "C" fn - export_method_threshold_session_dkg_part1(arg0 : * mut u8, arg1 : - i32, arg2 : i32, arg3 : * mut u8, arg4 : usize, arg5 : * mut u8, - arg6 : usize,) -> * mut u8 { unsafe { $($path_to_types)*:: - _export_method_threshold_session_dkg_part1_cabi::<<$ty as - $($path_to_types)*:: Guest >::ThresholdSession > (arg0, arg1, - arg2, arg3, arg4, arg5, arg6) } } #[unsafe (export_name = - "cabi_post_component:threshold/types@0.1.0#[method]threshold-session.dkg-part1")] - unsafe extern "C" fn - _post_return_method_threshold_session_dkg_part1(arg0 : * mut u8,) - { unsafe { $($path_to_types)*:: - __post_return_method_threshold_session_dkg_part1::<<$ty as - $($path_to_types)*:: Guest >::ThresholdSession > (arg0) } } - #[unsafe (export_name = - "component:threshold/types@0.1.0#[method]threshold-session.dkg-part2")] - unsafe extern "C" fn - export_method_threshold_session_dkg_part2(arg0 : * mut u8, arg1 : - i32, arg2 : * mut u8, arg3 : usize, arg4 : * mut u8, arg5 : - usize,) -> * mut u8 { unsafe { $($path_to_types)*:: - _export_method_threshold_session_dkg_part2_cabi::<<$ty as - $($path_to_types)*:: Guest >::ThresholdSession > (arg0, arg1, - arg2, arg3, arg4, arg5) } } #[unsafe (export_name = - "cabi_post_component:threshold/types@0.1.0#[method]threshold-session.dkg-part2")] - unsafe extern "C" fn - _post_return_method_threshold_session_dkg_part2(arg0 : * mut u8,) - { unsafe { $($path_to_types)*:: - __post_return_method_threshold_session_dkg_part2::<<$ty as - $($path_to_types)*:: Guest >::ThresholdSession > (arg0) } } - #[unsafe (export_name = - "component:threshold/types@0.1.0#[method]threshold-session.dkg-part3")] - unsafe extern "C" fn - export_method_threshold_session_dkg_part3(arg0 : * mut u8, arg1 : - i32, arg2 : * mut u8, arg3 : usize, arg4 : * mut u8, arg5 : - usize, arg6 : * mut u8, arg7 : usize,) -> * mut u8 { unsafe { - $($path_to_types)*:: - _export_method_threshold_session_dkg_part3_cabi::<<$ty as - $($path_to_types)*:: Guest >::ThresholdSession > (arg0, arg1, - arg2, arg3, arg4, arg5, arg6, arg7) } } #[unsafe (export_name = - "cabi_post_component:threshold/types@0.1.0#[method]threshold-session.dkg-part3")] - unsafe extern "C" fn - _post_return_method_threshold_session_dkg_part3(arg0 : * mut u8,) - { unsafe { $($path_to_types)*:: - __post_return_method_threshold_session_dkg_part3::<<$ty as - $($path_to_types)*:: Guest >::ThresholdSession > (arg0) } } - #[unsafe (export_name = - "component:threshold/types@0.1.0#[method]threshold-session.dkg-part3-receive")] - unsafe extern "C" fn - export_method_threshold_session_dkg_part3_receive(arg0 : * mut - u8, arg1 : * mut u8, arg2 : usize, arg3 : * mut u8, arg4 : usize, - arg5 : * mut u8, arg6 : usize, arg7 : i32, arg8 : i32, arg9 : * - mut u8, arg10 : usize,) -> * mut u8 { unsafe { - $($path_to_types)*:: - _export_method_threshold_session_dkg_part3_receive_cabi::<<$ty as - $($path_to_types)*:: Guest >::ThresholdSession > (arg0, arg1, - arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10) } } - #[unsafe (export_name = - "cabi_post_component:threshold/types@0.1.0#[method]threshold-session.dkg-part3-receive")] - unsafe extern "C" fn - _post_return_method_threshold_session_dkg_part3_receive(arg0 : * - mut u8,) { unsafe { $($path_to_types)*:: - __post_return_method_threshold_session_dkg_part3_receive::<<$ty - as $($path_to_types)*:: Guest >::ThresholdSession > (arg0) } } - #[unsafe (export_name = - "component:threshold/types@0.1.0#[method]threshold-session.dkg-refresh-part1")] - unsafe extern "C" fn - export_method_threshold_session_dkg_refresh_part1(arg0 : * mut - u8, arg1 : * mut u8, arg2 : usize, arg3 : i32, arg4 : i32, arg5 : - * mut u8, arg6 : usize,) -> * mut u8 { unsafe { - $($path_to_types)*:: - _export_method_threshold_session_dkg_refresh_part1_cabi::<<$ty as - $($path_to_types)*:: Guest >::ThresholdSession > (arg0, arg1, - arg2, arg3, arg4, arg5, arg6) } } #[unsafe (export_name = - "cabi_post_component:threshold/types@0.1.0#[method]threshold-session.dkg-refresh-part1")] - unsafe extern "C" fn - _post_return_method_threshold_session_dkg_refresh_part1(arg0 : * - mut u8,) { unsafe { $($path_to_types)*:: - __post_return_method_threshold_session_dkg_refresh_part1::<<$ty - as $($path_to_types)*:: Guest >::ThresholdSession > (arg0) } } - #[unsafe (export_name = - "component:threshold/types@0.1.0#[method]threshold-session.dkg-refresh-part2")] - unsafe extern "C" fn - export_method_threshold_session_dkg_refresh_part2(arg0 : * mut - u8, arg1 : i32, arg2 : * mut u8, arg3 : usize,) -> * mut u8 { - unsafe { $($path_to_types)*:: - _export_method_threshold_session_dkg_refresh_part2_cabi::<<$ty as - $($path_to_types)*:: Guest >::ThresholdSession > (arg0, arg1, - arg2, arg3) } } #[unsafe (export_name = - "cabi_post_component:threshold/types@0.1.0#[method]threshold-session.dkg-refresh-part2")] - unsafe extern "C" fn - _post_return_method_threshold_session_dkg_refresh_part2(arg0 : * - mut u8,) { unsafe { $($path_to_types)*:: - __post_return_method_threshold_session_dkg_refresh_part2::<<$ty - as $($path_to_types)*:: Guest >::ThresholdSession > (arg0) } } - #[unsafe (export_name = - "component:threshold/types@0.1.0#[method]threshold-session.dkg-refresh-part3")] - unsafe extern "C" fn - export_method_threshold_session_dkg_refresh_part3(arg0 : * mut - u8, arg1 : i32, arg2 : * mut u8, arg3 : usize, arg4 : * mut u8, - arg5 : usize, arg6 : * mut u8, arg7 : usize, arg8 : * mut u8, - arg9 : usize,) -> * mut u8 { unsafe { $($path_to_types)*:: - _export_method_threshold_session_dkg_refresh_part3_cabi::<<$ty as - $($path_to_types)*:: Guest >::ThresholdSession > (arg0, arg1, - arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) } } #[unsafe - (export_name = - "cabi_post_component:threshold/types@0.1.0#[method]threshold-session.dkg-refresh-part3")] - unsafe extern "C" fn - _post_return_method_threshold_session_dkg_refresh_part3(arg0 : * - mut u8,) { unsafe { $($path_to_types)*:: - __post_return_method_threshold_session_dkg_refresh_part3::<<$ty - as $($path_to_types)*:: Guest >::ThresholdSession > (arg0) } } - #[unsafe (export_name = - "component:threshold/types@0.1.0#[method]threshold-session.new-nonce")] - unsafe extern "C" fn - export_method_threshold_session_new_nonce(arg0 : * mut u8, arg1 : - * mut u8, arg2 : usize,) -> * mut u8 { unsafe { - $($path_to_types)*:: - _export_method_threshold_session_new_nonce_cabi::<<$ty as - $($path_to_types)*:: Guest >::ThresholdSession > (arg0, arg1, - arg2) } } #[unsafe (export_name = - "cabi_post_component:threshold/types@0.1.0#[method]threshold-session.new-nonce")] - unsafe extern "C" fn - _post_return_method_threshold_session_new_nonce(arg0 : * mut u8,) - { unsafe { $($path_to_types)*:: - __post_return_method_threshold_session_new_nonce::<<$ty as - $($path_to_types)*:: Guest >::ThresholdSession > (arg0) } } - #[unsafe (export_name = - "component:threshold/types@0.1.0#[method]threshold-session.frost-sign")] - unsafe extern "C" fn - export_method_threshold_session_frost_sign(arg0 : * mut u8, arg1 - : * mut u8, arg2 : usize, arg3 : i32, arg4 : * mut u8, arg5 : - usize,) -> * mut u8 { unsafe { $($path_to_types)*:: - _export_method_threshold_session_frost_sign_cabi::<<$ty as - $($path_to_types)*:: Guest >::ThresholdSession > (arg0, arg1, - arg2, arg3, arg4, arg5) } } #[unsafe (export_name = - "cabi_post_component:threshold/types@0.1.0#[method]threshold-session.frost-sign")] - unsafe extern "C" fn - _post_return_method_threshold_session_frost_sign(arg0 : * mut - u8,) { unsafe { $($path_to_types)*:: - __post_return_method_threshold_session_frost_sign::<<$ty as - $($path_to_types)*:: Guest >::ThresholdSession > (arg0) } } - #[unsafe (export_name = - "component:threshold/types@0.1.0#[method]threshold-session.frost-aggregate")] - unsafe extern "C" fn - export_method_threshold_session_frost_aggregate(arg0 : * mut u8, - arg1 : * mut u8, arg2 : usize, arg3 : * mut u8, arg4 : usize, - arg5 : * mut u8, arg6 : usize,) -> * mut u8 { unsafe { - $($path_to_types)*:: - _export_method_threshold_session_frost_aggregate_cabi::<<$ty as - $($path_to_types)*:: Guest >::ThresholdSession > (arg0, arg1, - arg2, arg3, arg4, arg5, arg6) } } #[unsafe (export_name = - "cabi_post_component:threshold/types@0.1.0#[method]threshold-session.frost-aggregate")] - unsafe extern "C" fn - _post_return_method_threshold_session_frost_aggregate(arg0 : * - mut u8,) { unsafe { $($path_to_types)*:: - __post_return_method_threshold_session_frost_aggregate::<<$ty as - $($path_to_types)*:: Guest >::ThresholdSession > (arg0) } } - #[unsafe (export_name = - "component:threshold/types@0.1.0#[method]threshold-session.key-package-tweak")] - unsafe extern "C" fn - export_method_threshold_session_key_package_tweak(arg0 : * mut - u8, arg1 : * mut u8, arg2 : usize, arg3 : i32, arg4 : * mut u8, - arg5 : usize,) -> * mut u8 { unsafe { $($path_to_types)*:: - _export_method_threshold_session_key_package_tweak_cabi::<<$ty as - $($path_to_types)*:: Guest >::ThresholdSession > (arg0, arg1, - arg2, arg3, arg4, arg5) } } #[unsafe (export_name = - "cabi_post_component:threshold/types@0.1.0#[method]threshold-session.key-package-tweak")] - unsafe extern "C" fn - _post_return_method_threshold_session_key_package_tweak(arg0 : * - mut u8,) { unsafe { $($path_to_types)*:: - __post_return_method_threshold_session_key_package_tweak::<<$ty - as $($path_to_types)*:: Guest >::ThresholdSession > (arg0) } } - #[unsafe (export_name = - "component:threshold/types@0.1.0#[method]threshold-session.pub-key-package-tweak")] - unsafe extern "C" fn - export_method_threshold_session_pub_key_package_tweak(arg0 : * - mut u8, arg1 : * mut u8, arg2 : usize, arg3 : i32, arg4 : * mut - u8, arg5 : usize,) -> * mut u8 { unsafe { $($path_to_types)*:: - _export_method_threshold_session_pub_key_package_tweak_cabi::<<$ty - as $($path_to_types)*:: Guest >::ThresholdSession > (arg0, arg1, - arg2, arg3, arg4, arg5) } } #[unsafe (export_name = - "cabi_post_component:threshold/types@0.1.0#[method]threshold-session.pub-key-package-tweak")] - unsafe extern "C" fn - _post_return_method_threshold_session_pub_key_package_tweak(arg0 - : * mut u8,) { unsafe { $($path_to_types)*:: - __post_return_method_threshold_session_pub_key_package_tweak::<<$ty - as $($path_to_types)*:: Guest >::ThresholdSession > (arg0) } } - #[unsafe (export_name = - "component:threshold/types@0.1.0#[method]threshold-session.key-package-into-even-y")] - unsafe extern "C" fn - export_method_threshold_session_key_package_into_even_y(arg0 : * - mut u8, arg1 : * mut u8, arg2 : usize,) -> * mut u8 { unsafe { - $($path_to_types)*:: - _export_method_threshold_session_key_package_into_even_y_cabi::<<$ty - as $($path_to_types)*:: Guest >::ThresholdSession > (arg0, arg1, - arg2) } } #[unsafe (export_name = - "cabi_post_component:threshold/types@0.1.0#[method]threshold-session.key-package-into-even-y")] - unsafe extern "C" fn - _post_return_method_threshold_session_key_package_into_even_y(arg0 - : * mut u8,) { unsafe { $($path_to_types)*:: - __post_return_method_threshold_session_key_package_into_even_y::<<$ty - as $($path_to_types)*:: Guest >::ThresholdSession > (arg0) } } - #[unsafe (export_name = - "component:threshold/types@0.1.0#[method]threshold-session.pub-key-package-into-even-y")] - unsafe extern "C" fn - export_method_threshold_session_pub_key_package_into_even_y(arg0 - : * mut u8, arg1 : * mut u8, arg2 : usize,) -> * mut u8 { unsafe - { $($path_to_types)*:: - _export_method_threshold_session_pub_key_package_into_even_y_cabi::<<$ty - as $($path_to_types)*:: Guest >::ThresholdSession > (arg0, arg1, - arg2) } } #[unsafe (export_name = - "cabi_post_component:threshold/types@0.1.0#[method]threshold-session.pub-key-package-into-even-y")] - unsafe extern "C" fn - _post_return_method_threshold_session_pub_key_package_into_even_y(arg0 - : * mut u8,) { unsafe { $($path_to_types)*:: - __post_return_method_threshold_session_pub_key_package_into_even_y::<<$ty - as $($path_to_types)*:: Guest >::ThresholdSession > (arg0) } } - #[unsafe (export_name = - "component:threshold/types@0.1.0#[method]threshold-session.verify-schnorr-signature")] - unsafe extern "C" fn - export_method_threshold_session_verify_schnorr_signature(arg0 : * - mut u8, arg1 : * mut u8, arg2 : usize, arg3 : * mut u8, arg4 : - usize, arg5 : * mut u8, arg6 : usize,) -> * mut u8 { unsafe { - $($path_to_types)*:: - _export_method_threshold_session_verify_schnorr_signature_cabi::<<$ty - as $($path_to_types)*:: Guest >::ThresholdSession > (arg0, arg1, - arg2, arg3, arg4, arg5, arg6) } } #[unsafe (export_name = - "cabi_post_component:threshold/types@0.1.0#[method]threshold-session.verify-schnorr-signature")] - unsafe extern "C" fn - _post_return_method_threshold_session_verify_schnorr_signature(arg0 - : * mut u8,) { unsafe { $($path_to_types)*:: - __post_return_method_threshold_session_verify_schnorr_signature::<<$ty - as $($path_to_types)*:: Guest >::ThresholdSession > (arg0) } } - #[unsafe (export_name = - "component:threshold/types@0.1.0#[method]threshold-session.ark-default-vtxo-script-pubkey")] - unsafe extern "C" fn - export_method_threshold_session_ark_default_vtxo_script_pubkey(arg0 - : * mut u8, arg1 : * mut u8, arg2 : usize, arg3 : * mut u8, arg4 - : usize, arg5 : i32,) -> * mut u8 { unsafe { $($path_to_types)*:: - _export_method_threshold_session_ark_default_vtxo_script_pubkey_cabi::<<$ty - as $($path_to_types)*:: Guest >::ThresholdSession > (arg0, arg1, - arg2, arg3, arg4, arg5) } } #[unsafe (export_name = - "cabi_post_component:threshold/types@0.1.0#[method]threshold-session.ark-default-vtxo-script-pubkey")] - unsafe extern "C" fn - _post_return_method_threshold_session_ark_default_vtxo_script_pubkey(arg0 - : * mut u8,) { unsafe { $($path_to_types)*:: - __post_return_method_threshold_session_ark_default_vtxo_script_pubkey::<<$ty - as $($path_to_types)*:: Guest >::ThresholdSession > (arg0) } } - #[unsafe (export_name = - "component:threshold/types@0.1.0#[method]threshold-session.ark-forfeit-spend-info")] - unsafe extern "C" fn - export_method_threshold_session_ark_forfeit_spend_info(arg0 : * - mut u8, arg1 : * mut u8, arg2 : usize, arg3 : * mut u8, arg4 : - usize, arg5 : i32,) -> * mut u8 { unsafe { $($path_to_types)*:: - _export_method_threshold_session_ark_forfeit_spend_info_cabi::<<$ty - as $($path_to_types)*:: Guest >::ThresholdSession > (arg0, arg1, - arg2, arg3, arg4, arg5) } } #[unsafe (export_name = - "cabi_post_component:threshold/types@0.1.0#[method]threshold-session.ark-forfeit-spend-info")] - unsafe extern "C" fn - _post_return_method_threshold_session_ark_forfeit_spend_info(arg0 - : * mut u8,) { unsafe { $($path_to_types)*:: - __post_return_method_threshold_session_ark_forfeit_spend_info::<<$ty - as $($path_to_types)*:: Guest >::ThresholdSession > (arg0) } } - #[unsafe (export_name = - "component:threshold/types@0.1.0#[method]threshold-session.ark-exit-spend-info")] - unsafe extern "C" fn - export_method_threshold_session_ark_exit_spend_info(arg0 : * mut - u8, arg1 : * mut u8, arg2 : usize, arg3 : * mut u8, arg4 : usize, - arg5 : i32,) -> * mut u8 { unsafe { $($path_to_types)*:: - _export_method_threshold_session_ark_exit_spend_info_cabi::<<$ty - as $($path_to_types)*:: Guest >::ThresholdSession > (arg0, arg1, - arg2, arg3, arg4, arg5) } } #[unsafe (export_name = - "cabi_post_component:threshold/types@0.1.0#[method]threshold-session.ark-exit-spend-info")] - unsafe extern "C" fn - _post_return_method_threshold_session_ark_exit_spend_info(arg0 : - * mut u8,) { unsafe { $($path_to_types)*:: - __post_return_method_threshold_session_ark_exit_spend_info::<<$ty - as $($path_to_types)*:: Guest >::ThresholdSession > (arg0) } } - #[unsafe (export_name = - "component:threshold/types@0.1.0#[method]threshold-session.identifier-derive")] - unsafe extern "C" fn - export_method_threshold_session_identifier_derive(arg0 : * mut - u8, arg1 : * mut u8, arg2 : usize,) -> * mut u8 { unsafe { - $($path_to_types)*:: - _export_method_threshold_session_identifier_derive_cabi::<<$ty as - $($path_to_types)*:: Guest >::ThresholdSession > (arg0, arg1, - arg2) } } #[unsafe (export_name = - "cabi_post_component:threshold/types@0.1.0#[method]threshold-session.identifier-derive")] - unsafe extern "C" fn - _post_return_method_threshold_session_identifier_derive(arg0 : * - mut u8,) { unsafe { $($path_to_types)*:: - __post_return_method_threshold_session_identifier_derive::<<$ty - as $($path_to_types)*:: Guest >::ThresholdSession > (arg0) } } - #[unsafe (export_name = - "component:threshold/types@0.1.0#[method]threshold-session.identifier-from-bigint")] - unsafe extern "C" fn - export_method_threshold_session_identifier_from_bigint(arg0 : * - mut u8, arg1 : * mut u8, arg2 : usize,) -> * mut u8 { unsafe { - $($path_to_types)*:: - _export_method_threshold_session_identifier_from_bigint_cabi::<<$ty - as $($path_to_types)*:: Guest >::ThresholdSession > (arg0, arg1, - arg2) } } #[unsafe (export_name = - "cabi_post_component:threshold/types@0.1.0#[method]threshold-session.identifier-from-bigint")] - unsafe extern "C" fn - _post_return_method_threshold_session_identifier_from_bigint(arg0 - : * mut u8,) { unsafe { $($path_to_types)*:: - __post_return_method_threshold_session_identifier_from_bigint::<<$ty - as $($path_to_types)*:: Guest >::ThresholdSession > (arg0) } } - #[unsafe (export_name = - "component:threshold/types@0.1.0#[method]threshold-session.generate-coefficients")] - unsafe extern "C" fn - export_method_threshold_session_generate_coefficients(arg0 : * - mut u8, arg1 : i32, arg2 : * mut u8, arg3 : usize,) -> * mut u8 { - unsafe { $($path_to_types)*:: - _export_method_threshold_session_generate_coefficients_cabi::<<$ty - as $($path_to_types)*:: Guest >::ThresholdSession > (arg0, arg1, - arg2, arg3) } } #[unsafe (export_name = - "cabi_post_component:threshold/types@0.1.0#[method]threshold-session.generate-coefficients")] - unsafe extern "C" fn - _post_return_method_threshold_session_generate_coefficients(arg0 - : * mut u8,) { unsafe { $($path_to_types)*:: - __post_return_method_threshold_session_generate_coefficients::<<$ty - as $($path_to_types)*:: Guest >::ThresholdSession > (arg0) } } - #[unsafe (export_name = - "component:threshold/types@0.1.0#[method]threshold-session.evaluate-polynomial")] - unsafe extern "C" fn - export_method_threshold_session_evaluate_polynomial(arg0 : * mut - u8, arg1 : * mut u8, arg2 : usize, arg3 : * mut u8, arg4 : - usize,) -> * mut u8 { unsafe { $($path_to_types)*:: - _export_method_threshold_session_evaluate_polynomial_cabi::<<$ty - as $($path_to_types)*:: Guest >::ThresholdSession > (arg0, arg1, - arg2, arg3, arg4) } } #[unsafe (export_name = - "cabi_post_component:threshold/types@0.1.0#[method]threshold-session.evaluate-polynomial")] - unsafe extern "C" fn - _post_return_method_threshold_session_evaluate_polynomial(arg0 : - * mut u8,) { unsafe { $($path_to_types)*:: - __post_return_method_threshold_session_evaluate_polynomial::<<$ty - as $($path_to_types)*:: Guest >::ThresholdSession > (arg0) } } - #[unsafe (export_name = - "component:threshold/types@0.1.0#[method]threshold-session.mod-n-random")] - unsafe extern "C" fn - export_method_threshold_session_mod_n_random(arg0 : * mut u8,) -> - * mut u8 { unsafe { $($path_to_types)*:: - _export_method_threshold_session_mod_n_random_cabi::<<$ty as - $($path_to_types)*:: Guest >::ThresholdSession > (arg0) } } - #[unsafe (export_name = - "cabi_post_component:threshold/types@0.1.0#[method]threshold-session.mod-n-random")] - unsafe extern "C" fn - _post_return_method_threshold_session_mod_n_random(arg0 : * mut - u8,) { unsafe { $($path_to_types)*:: - __post_return_method_threshold_session_mod_n_random::<<$ty as - $($path_to_types)*:: Guest >::ThresholdSession > (arg0) } } - #[unsafe (export_name = - "component:threshold/types@0.1.0#[method]threshold-session.elem-base-mul")] - unsafe extern "C" fn - export_method_threshold_session_elem_base_mul(arg0 : * mut u8, - arg1 : * mut u8, arg2 : usize,) -> * mut u8 { unsafe { - $($path_to_types)*:: - _export_method_threshold_session_elem_base_mul_cabi::<<$ty as - $($path_to_types)*:: Guest >::ThresholdSession > (arg0, arg1, - arg2) } } #[unsafe (export_name = - "cabi_post_component:threshold/types@0.1.0#[method]threshold-session.elem-base-mul")] - unsafe extern "C" fn - _post_return_method_threshold_session_elem_base_mul(arg0 : * mut - u8,) { unsafe { $($path_to_types)*:: - __post_return_method_threshold_session_elem_base_mul::<<$ty as - $($path_to_types)*:: Guest >::ThresholdSession > (arg0) } } const - _ : () = { #[doc(hidden)] #[unsafe (export_name = - "component:threshold/types@0.1.0#[dtor]round1-secret")] - #[allow(non_snake_case)] unsafe extern "C" fn dtor(rep : * mut - u8) { unsafe { $($path_to_types)*:: Round1Secret::dtor::< <$ty as - $($path_to_types)*:: Guest >::Round1Secret > (rep) } } }; const _ - : () = { #[doc(hidden)] #[unsafe (export_name = - "component:threshold/types@0.1.0#[dtor]round2-secret")] - #[allow(non_snake_case)] unsafe extern "C" fn dtor(rep : * mut - u8) { unsafe { $($path_to_types)*:: Round2Secret::dtor::< <$ty as - $($path_to_types)*:: Guest >::Round2Secret > (rep) } } }; const _ - : () = { #[doc(hidden)] #[unsafe (export_name = - "component:threshold/types@0.1.0#[dtor]signing-nonce")] - #[allow(non_snake_case)] unsafe extern "C" fn dtor(rep : * mut - u8) { unsafe { $($path_to_types)*:: SigningNonce::dtor::< <$ty as - $($path_to_types)*:: Guest >::SigningNonce > (rep) } } }; const _ - : () = { #[doc(hidden)] #[unsafe (export_name = - "component:threshold/types@0.1.0#[dtor]dkg-session")] - #[allow(non_snake_case)] unsafe extern "C" fn dtor(rep : * mut - u8) { unsafe { $($path_to_types)*:: DkgSession::dtor::< <$ty as - $($path_to_types)*:: Guest >::DkgSession > (rep) } } }; const _ : - () = { #[doc(hidden)] #[unsafe (export_name = - "component:threshold/types@0.1.0#[dtor]signing-session")] - #[allow(non_snake_case)] unsafe extern "C" fn dtor(rep : * mut - u8) { unsafe { $($path_to_types)*:: SigningSession::dtor::< <$ty - as $($path_to_types)*:: Guest >::SigningSession > (rep) } } }; - const _ : () = { #[doc(hidden)] #[unsafe (export_name = - "component:threshold/types@0.1.0#[dtor]refresh-session")] - #[allow(non_snake_case)] unsafe extern "C" fn dtor(rep : * mut - u8) { unsafe { $($path_to_types)*:: RefreshSession::dtor::< <$ty - as $($path_to_types)*:: Guest >::RefreshSession > (rep) } } }; - const _ : () = { #[doc(hidden)] #[unsafe (export_name = - "component:threshold/types@0.1.0#[dtor]auth-signer")] - #[allow(non_snake_case)] unsafe extern "C" fn dtor(rep : * mut - u8) { unsafe { $($path_to_types)*:: AuthSigner::dtor::< <$ty as - $($path_to_types)*:: Guest >::AuthSigner > (rep) } } }; const _ : - () = { #[doc(hidden)] #[unsafe (export_name = - "component:threshold/types@0.1.0#[dtor]threshold-session")] - #[allow(non_snake_case)] unsafe extern "C" fn dtor(rep : * mut - u8) { unsafe { $($path_to_types)*:: ThresholdSession::dtor::< - <$ty as $($path_to_types)*:: Guest >::ThresholdSession > (rep) } - } }; }; - }; - } - #[doc(hidden)] - pub(crate) use __export_component_threshold_types_0_1_0_cabi; - #[cfg_attr(target_pointer_width = "64", repr(align(8)))] - #[cfg_attr(target_pointer_width = "32", repr(align(4)))] - struct _RetArea( - [::core::mem::MaybeUninit< - u8, - >; 6 * ::core::mem::size_of::<*const u8>()], - ); - static mut _RET_AREA: _RetArea = _RetArea( - [::core::mem::MaybeUninit::uninit(); 6 - * ::core::mem::size_of::<*const u8>()], - ); - } - } - } -} -#[rustfmt::skip] -mod _rt { - #![allow(dead_code, clippy::all)] - pub use alloc_crate::string::String; - use core::fmt; - use core::marker; - use core::sync::atomic::{AtomicU32, Ordering::Relaxed}; - /// A type which represents a component model resource, either imported or - /// exported into this component. - /// - /// This is a low-level wrapper which handles the lifetime of the resource - /// (namely this has a destructor). The `T` provided defines the component model - /// intrinsics that this wrapper uses. - /// - /// One of the chief purposes of this type is to provide `Deref` implementations - /// to access the underlying data when it is owned. - /// - /// This type is primarily used in generated code for exported and imported - /// resources. - #[repr(transparent)] - pub struct Resource { - handle: AtomicU32, - _marker: marker::PhantomData, - } - /// A trait which all wasm resources implement, namely providing the ability to - /// drop a resource. - /// - /// This generally is implemented by generated code, not user-facing code. - #[allow(clippy::missing_safety_doc)] - pub unsafe trait WasmResource { - /// Invokes the `[resource-drop]...` intrinsic. - unsafe fn drop(handle: u32); - } - impl Resource { - #[doc(hidden)] - pub unsafe fn from_handle(handle: u32) -> Self { - debug_assert!(handle != u32::MAX); - Self { - handle: AtomicU32::new(handle), - _marker: marker::PhantomData, - } - } - /// Takes ownership of the handle owned by `resource`. - /// - /// Note that this ideally would be `into_handle` taking `Resource` by - /// ownership. The code generator does not enable that in all situations, - /// unfortunately, so this is provided instead. - /// - /// Also note that `take_handle` is in theory only ever called on values - /// owned by a generated function. For example a generated function might - /// take `Resource` as an argument but then call `take_handle` on a - /// reference to that argument. In that sense the dynamic nature of - /// `take_handle` should only be exposed internally to generated code, not - /// to user code. - #[doc(hidden)] - pub fn take_handle(resource: &Resource) -> u32 { - resource.handle.swap(u32::MAX, Relaxed) - } - #[doc(hidden)] - pub fn handle(resource: &Resource) -> u32 { - resource.handle.load(Relaxed) - } - } - impl fmt::Debug for Resource { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - f.debug_struct("Resource").field("handle", &self.handle).finish() - } - } - impl Drop for Resource { - fn drop(&mut self) { - unsafe { - match self.handle.load(Relaxed) { - u32::MAX => {} - other => T::drop(other), - } - } - } - } - pub use alloc_crate::boxed::Box; - #[cfg(target_arch = "wasm32")] - pub fn run_ctors_once() { - wit_bindgen_rt::run_ctors_once(); - } - pub use alloc_crate::vec::Vec; - pub unsafe fn string_lift(bytes: Vec) -> String { - if cfg!(debug_assertions) { - String::from_utf8(bytes).unwrap() - } else { - String::from_utf8_unchecked(bytes) - } - } - pub fn as_i32(t: T) -> i32 { - t.as_i32() - } - pub trait AsI32 { - fn as_i32(self) -> i32; - } - impl<'a, T: Copy + AsI32> AsI32 for &'a T { - fn as_i32(self) -> i32 { - (*self).as_i32() - } - } - impl AsI32 for i32 { - #[inline] - fn as_i32(self) -> i32 { - self as i32 - } - } - impl AsI32 for u32 { - #[inline] - fn as_i32(self) -> i32 { - self as i32 - } - } - impl AsI32 for i16 { - #[inline] - fn as_i32(self) -> i32 { - self as i32 - } - } - impl AsI32 for u16 { - #[inline] - fn as_i32(self) -> i32 { - self as i32 - } - } - impl AsI32 for i8 { - #[inline] - fn as_i32(self) -> i32 { - self as i32 - } - } - impl AsI32 for u8 { - #[inline] - fn as_i32(self) -> i32 { - self as i32 - } - } - impl AsI32 for char { - #[inline] - fn as_i32(self) -> i32 { - self as i32 - } - } - impl AsI32 for usize { - #[inline] - fn as_i32(self) -> i32 { - self as i32 - } - } - pub unsafe fn cabi_dealloc(ptr: *mut u8, size: usize, align: usize) { - if size == 0 { - return; - } - let layout = alloc::Layout::from_size_align_unchecked(size, align); - alloc::dealloc(ptr, layout); - } - pub fn as_i64(t: T) -> i64 { - t.as_i64() - } - pub trait AsI64 { - fn as_i64(self) -> i64; - } - impl<'a, T: Copy + AsI64> AsI64 for &'a T { - fn as_i64(self) -> i64 { - (*self).as_i64() - } - } - impl AsI64 for i64 { - #[inline] - fn as_i64(self) -> i64 { - self as i64 - } - } - impl AsI64 for u64 { - #[inline] - fn as_i64(self) -> i64 { - self as i64 - } - } - pub unsafe fn invalid_enum_discriminant() -> T { - if cfg!(debug_assertions) { - panic!("invalid enum discriminant") - } else { - unsafe { core::hint::unreachable_unchecked() } - } - } - extern crate alloc as alloc_crate; - pub use alloc_crate::alloc; -} -/// Generates `#[unsafe(no_mangle)]` functions to export the specified type as -/// the root implementation of all generated traits. -/// -/// For more information see the documentation of `wit_bindgen::generate!`. -/// -/// ```rust -/// # macro_rules! export{ ($($t:tt)*) => (); } -/// # trait Guest {} -/// struct MyType; -/// -/// impl Guest for MyType { -/// // ... -/// } -/// -/// export!(MyType); -/// ``` -#[allow(unused_macros)] -#[doc(hidden)] -macro_rules! __export_threshold_world_impl { - ($ty:ident) => { - self::export!($ty with_types_in self); - }; - ($ty:ident with_types_in $($path_to_types_root:tt)*) => { - $($path_to_types_root)*:: - exports::component::threshold::types::__export_component_threshold_types_0_1_0_cabi!($ty - with_types_in $($path_to_types_root)*:: exports::component::threshold::types); - }; -} -#[doc(inline)] -pub(crate) use __export_threshold_world_impl as export; -#[cfg(target_arch = "wasm32")] -#[unsafe( - link_section = "component-type:wit-bindgen:0.41.0:component:threshold@0.1.0:threshold-world:encoded world" -)] -#[doc(hidden)] -#[allow(clippy::octal_escapes)] -pub static __WIT_BINDGEN_COMPONENT_TYPE: [u8; 7461] = *b"\ -\0asm\x0d\0\x01\0\0\x19\x16wit-component-encoding\x04\0\x07\x9f9\x01A\x02\x01A\x02\ -\x01B\xd6\x01\x01q\x03\x0dinvalid-input\x01s\0\x0ccrypto-error\x01s\0\x13seriali\ -zation-error\x01s\0\x04\0\x0fthreshold-error\x03\0\0\x04\0\x0dround1-secret\x03\x01\ -\x04\0\x0dround2-secret\x03\x01\x04\0\x0dsigning-nonce\x03\x01\x04\0\x0bdkg-sess\ -ion\x03\x01\x04\0\x0fsigning-session\x03\x01\x04\0\x0frefresh-session\x03\x01\x04\ -\0\x0bauth-signer\x03\x01\x01i\x02\x01r\x02\x13round1-package-jsons\x06secret\x09\ -\x04\0\x11dkg-round1-output\x03\0\x0a\x01r\x03\x13round1-package-jsons\x11coeffi\ -cients-jsons\x06secret\x09\x04\0\x19dkg-refresh-round1-output\x03\0\x0c\x01i\x03\ -\x01r\x02\x14round2-packages-jsons\x06secret\x0e\x04\0\x11dkg-round2-output\x03\0\ -\x0f\x01r\x02\x10key-package-jsons\x17public-key-package-jsons\x04\0\x11dkg-roun\ -d3-output\x03\0\x11\x01i\x04\x01r\x02\x10commitments-jsons\x05nonce\x13\x04\0\x0c\ -nonce-output\x03\0\x14\x04\0\x11threshold-session\x03\x01\x01i\x05\x01@\0\0\x17\x04\ -\0\x18[constructor]dkg-session\x01\x18\x01h\x05\x01@\x01\x04self\x19\x01\0\x04\0\ -\x19[method]dkg-session.reset\x01\x1a\x01@\x03\x04self\x19\x06id-hexs\x08pkg-jso\ -ns\x01\0\x04\0)[method]dkg-session.insert-round1-package\x01\x1b\x01@\x02\x04sel\ -f\x19\x06id-hexs\x01\0\x04\0.[method]dkg-session.insert-receiver-identifier\x01\x1c\ -\x01@\x01\x04self\x19\0y\x04\0&[method]dkg-session.total-participants\x01\x1d\x01\ -@\x02\x04self\x19\x06id-hexs\0\x7f\x04\0\x1f[method]dkg-session.is-receiver\x01\x1e\ -\x01@\x01\x04self\x19\0s\x04\0,[method]dkg-session.get-round1-packages-json\x01\x1f\ -\x01@\x02\x04self\x19\x0eexclude-id-hexs\0s\x04\06[method]dkg-session.get-round1\ --packages-excluding-json\x01\x20\x04\0)[method]dkg-session.get-receiver-ids-json\ -\x01\x1f\x01@\x02\x04self\x19\x0dserver-id-hexs\x01\0\x04\0![method]dkg-session.\ -set-server-id\x01!\x04\0![method]dkg-session.get-server-id\x01\x1f\x01@\x02\x04s\ -elf\x19\x0asecret-hexs\x01\0\x04\02[method]dkg-session.set-server-internal-secre\ -t-hex\x01\"\x04\02[method]dkg-session.get-server-internal-secret-hex\x01\x1f\x01\ -@\x03\x04self\x19\x0dsender-id-hexs\x08pkg-jsons\x01\0\x04\0*[method]dkg-session\ -.insert-round2-received\x01#\x04\0,[method]dkg-session.get-round2-received-json\x01\ -\x1f\x01@\x02\x04self\x19\x04jsons\x01\0\x04\0)[method]dkg-session.set-round2-lo\ -cal-json\x01$\x04\0)[method]dkg-session.get-round2-local-json\x01\x1f\x01@\x01\x04\ -self\x19\0\x7f\x04\0)[method]dkg-session.is-round2-local-empty\x01%\x01@\x03\x04\ -self\x19\x0dsender-id-hexs\x0dpackages-jsons\x01\0\x04\0)[method]dkg-session.ins\ -ert-relay-packages\x01&\x04\0+[method]dkg-session.insert-relay-from-local\x01!\x04\ -\0&[method]dkg-session.relay-sender-count\x01\x1d\x01@\x02\x04self\x19\x10recipi\ -ent-id-hexs\0s\x04\0*[method]dkg-session.get-relay-packages-for\x01'\x01i\x06\x01\ -@\0\0(\x04\0\x1c[constructor]signing-session\x01)\x01h\x06\x01@\x01\x04self*\x01\ -\0\x04\0\x1d[method]signing-session.reset\x01+\x01@\x02\x04self*\x03hexs\x01\0\x04\ -\0+[method]signing-session.set-user-hiding-hex\x01,\x01@\x01\x04self*\0s\x04\0+[\ -method]signing-session.get-user-hiding-hex\x01-\x04\0,[method]signing-session.se\ -t-user-binding-hex\x01,\x04\0,[method]signing-session.get-user-binding-hex\x01-\x01\ -@\x02\x04self*\x07msg-hexs\x01\0\x04\0+[method]signing-session.set-message-to-si\ -gn\x01.\x04\0+[method]signing-session.get-message-to-sign\x01-\x01@\x01\x04self*\ -\0\x7f\x04\0#[method]signing-session.has-message\x01/\x01@\x02\x04self*\x04jsons\ -\x01\0\x04\03[method]signing-session.set-server-commitments-json\x010\x04\03[met\ -hod]signing-session.get-server-commitments-json\x01-\x04\0.[method]signing-sessi\ -on.has-server-commitments\x01/\x01@\x03\x04self*\x06id-hexs\x10commitments-jsons\ -\x01\0\x04\0)[method]signing-session.insert-commitment\x011\x04\0,[method]signin\ -g-session.get-commitments-json\x01-\x01@\x03\x04self*\x06id-hexs\x09share-hexs\x01\ -\0\x04\0$[method]signing-session.insert-share\x012\x01@\x02\x04self*\x06id-hexs\0\ -\x7f\x04\0![method]signing-session.has-share\x013\x01@\x01\x04self*\0y\x04\0#[me\ -thod]signing-session.share-count\x014\x04\0'[method]signing-session.get-shares-j\ -son\x01-\x01@\x02\x04self*\x02ids\x01\0\x04\0-[method]signing-session.set-curren\ -t-policy-id\x015\x04\0-[method]signing-session.get-current-policy-id\x01-\x01@\x02\ -\x04self*\x06amountx\x01\0\x04\0*[method]signing-session.set-pending-amount\x016\ -\x01@\x01\x04self*\0x\x04\0*[method]signing-session.get-pending-amount\x017\x01i\ -\x07\x01@\0\08\x04\0\x1c[constructor]refresh-session\x019\x01h\x07\x01@\x01\x04s\ -elf:\x01\0\x04\0\x1d[method]refresh-session.reset\x01;\x01@\x03\x04self:\x06id-h\ -exs\x08pkg-jsons\x01\0\x04\0-[method]refresh-session.insert-round1-package\x01<\x01\ -@\x01\x04self:\0y\x04\0$[method]refresh-session.round1-count\x01=\x01@\x01\x04se\ -lf:\0s\x04\00[method]refresh-session.get-round1-packages-json\x01>\x01@\x02\x04s\ -elf:\x0eexclude-id-hexs\0s\x04\0:[method]refresh-session.get-round1-packages-exc\ -luding-json\x01?\x01@\x02\x04self:\x0dserver-id-hexs\x01\0\x04\0%[method]refresh\ --session.set-server-id\x01@\x04\0%[method]refresh-session.get-server-id\x01>\x01\ -@\x02\x04self:\x06id-hexs\x01\0\x04\01[method]refresh-session.set-server-identif\ -ier-hex\x01A\x04\01[method]refresh-session.get-server-identifier-hex\x01>\x01@\x03\ -\x04self:\x0dsender-id-hexs\x08pkg-jsons\x01\0\x04\0.[method]refresh-session.ins\ -ert-round2-received\x01B\x04\00[method]refresh-session.get-round2-received-json\x01\ ->\x01@\x02\x04self:\x04jsons\x01\0\x04\0-[method]refresh-session.set-round2-loca\ -l-json\x01C\x04\0-[method]refresh-session.get-round2-local-json\x01>\x01@\x01\x04\ -self:\0\x7f\x04\0-[method]refresh-session.is-round2-local-empty\x01D\x01@\x03\x04\ -self:\x0dsender-id-hexs\x0dpackages-jsons\x01\0\x04\0-[method]refresh-session.in\ -sert-relay-packages\x01E\x04\0/[method]refresh-session.insert-relay-from-local\x01\ -@\x04\0*[method]refresh-session.relay-sender-count\x01=\x01@\x02\x04self:\x10rec\ -ipient-id-hexs\0s\x04\0.[method]refresh-session.get-relay-packages-for\x01F\x01@\ -\x02\x04self:\x02msx\x01\0\x04\04[method]refresh-session.set-refresh-creation-ti\ -me-ms\x01G\x01@\x01\x04self:\0x\x04\04[method]refresh-session.get-refresh-creati\ -on-time-ms\x01H\x01@\x02\x04self:\x02ids\x01\0\x04\0&[method]refresh-session.set\ --refresh-id\x01I\x04\0&[method]refresh-session.get-refresh-id\x01>\x01@\x02\x04s\ -elf:\x06amountx\x01\0\x04\04[method]refresh-session.set-refresh-threshold-amount\ -\x01J\x04\04[method]refresh-session.get-refresh-threshold-amount\x01H\x01@\x02\x04\ -self:\x08intervalx\x01\0\x04\0,[method]refresh-session.set-refresh-interval\x01K\ -\x04\0,[method]refresh-session.get-refresh-interval\x01H\x01i\x08\x01@\x01\x0ase\ -cret-hexs\0\xcc\0\x04\0\x18[constructor]auth-signer\x01M\x01h\x08\x01p}\x01j\x01\ -s\x01\x01\x01@\x02\x04self\xce\0\x07message\xcf\0\0\xd0\0\x04\0\x18[method]auth-\ -signer.sign\x01Q\x01@\x01\x04self\xce\0\0\xd0\0\x04\0\x1e[method]auth-signer.pub\ -lic-key\x01R\x01i\x16\x01@\0\0\xd3\0\x04\0\x1e[constructor]threshold-session\x01\ -T\x01h\x16\x01j\x01\x0b\x01\x01\x01@\x05\x04self\xd5\0\x0bmax-signersy\x0bmin-si\ -gnersy\x0asecret-hexs\x11coefficients-jsons\0\xd6\0\x04\0#[method]threshold-sess\ -ion.dkg-part1\x01W\x01j\x01\x10\x01\x01\x01@\x04\x04self\xd5\0\x06secret\x09\x14\ -round1-packages-jsons\x11receiver-ids-jsons\0\xd8\0\x04\0#[method]threshold-sess\ -ion.dkg-part2\x01Y\x01j\x01\x12\x01\x01\x01@\x05\x04self\xd5\0\x09r2-secret\x0e\x14\ -round1-packages-jsons\x14round2-packages-jsons\x11receiver-ids-jsons\0\xda\0\x04\ -\0#[method]threshold-session.dkg-part3\x01[\x01@\x07\x04self\xd5\0\x09my-id-hexs\ -\x0edealer-r1-jsons\x0bshares-jsons\x0bmin-signersy\x0bmax-signersy\x0call-ids-j\ -sons\0\xda\0\x04\0+[method]threshold-session.dkg-part3-receive\x01\\\x01j\x01\x0d\ -\x01\x01\x01@\x05\x04self\xd5\0\x06id-hexs\x0bmax-signersy\x0bmin-signersy\x04se\ -ed\xcf\0\0\xdd\0\x04\0+[method]threshold-session.dkg-refresh-part1\x01^\x01@\x03\ -\x04self\xd5\0\x06secret\x09\x14round1-packages-jsons\0\xd8\0\x04\0+[method]thre\ -shold-session.dkg-refresh-part2\x01_\x01@\x06\x04self\xd5\0\x09r2-secret\x0e\x14\ -round1-packages-jsons\x14round2-packages-jsons\x0cold-pkp-jsons\x0bold-kp-jsons\0\ -\xda\0\x04\0+[method]threshold-session.dkg-refresh-part3\x01`\x01j\x01\x15\x01\x01\ -\x01@\x02\x04self\xd5\0\x0asecret-hexs\0\xe1\0\x04\0#[method]threshold-session.n\ -ew-nonce\x01b\x01@\x04\x04self\xd5\0\x14signing-package-jsons\x05nonce\x13\x10ke\ -y-package-jsons\0\xd0\0\x04\0$[method]threshold-session.frost-sign\x01c\x01@\x04\ -\x04self\xd5\0\x14signing-package-jsons\x0bshares-jsons\x17public-key-package-js\ -ons\0\xd0\0\x04\0)[method]threshold-session.frost-aggregate\x01d\x01k\xcf\0\x01@\ -\x03\x04self\xd5\0\x07kp-jsons\x0bmerkle-root\xe5\0\0\xd0\0\x04\0+[method]thresh\ -old-session.key-package-tweak\x01f\x01@\x03\x04self\xd5\0\x08pkp-jsons\x0bmerkle\ --root\xe5\0\0\xd0\0\x04\0/[method]threshold-session.pub-key-package-tweak\x01g\x01\ -@\x02\x04self\xd5\0\x07kp-jsons\0\xd0\0\x04\01[method]threshold-session.key-pack\ -age-into-even-y\x01h\x01@\x02\x04self\xd5\0\x08pkp-jsons\0\xd0\0\x04\05[method]t\ -hreshold-session.pub-key-package-into-even-y\x01i\x01j\x01\x7f\x01\x01\x01@\x04\x04\ -self\xd5\0\x06pk-hexs\x07message\xcf\0\x07sig-hexs\0\xea\0\x04\02[method]thresho\ -ld-session.verify-schnorr-signature\x01k\x01@\x04\x04self\xd5\0\x0dserver-pk-hex\ -s\x0cowner-pk-hexs\x0aexit-delayy\0\xd0\0\x04\08[method]threshold-session.ark-de\ -fault-vtxo-script-pubkey\x01l\x04\00[method]threshold-session.ark-forfeit-spend-\ -info\x01l\x04\0-[method]threshold-session.ark-exit-spend-info\x01l\x01@\x02\x04s\ -elf\xd5\0\x07message\xcf\0\0\xd0\0\x04\0+[method]threshold-session.identifier-de\ -rive\x01m\x01@\x02\x04self\xd5\0\x07hex-strs\0\xd0\0\x04\00[method]threshold-ses\ -sion.identifier-from-bigint\x01n\x01@\x03\x04self\xd5\0\x05county\x04seed\xcf\0\0\ -\xd0\0\x04\0/[method]threshold-session.generate-coefficients\x01o\x01@\x03\x04se\ -lf\xd5\0\x06id-hexs\x11coefficients-jsons\0\xd0\0\x04\0-[method]threshold-sessio\ -n.evaluate-polynomial\x01p\x01@\x01\x04self\xd5\0\0\xd0\0\x04\0&[method]threshol\ -d-session.mod-n-random\x01q\x01@\x02\x04self\xd5\0\x0ascalar-hexs\0\xd0\0\x04\0'\ -[method]threshold-session.elem-base-mul\x01r\x04\0\x1fcomponent:threshold/types@\ -0.1.0\x05\0\x04\0)component:threshold/threshold-world@0.1.0\x04\0\x0b\x15\x01\0\x0f\ -threshold-world\x03\0\0\0G\x09producers\x01\x0cprocessed-by\x02\x0dwit-component\ -\x070.227.1\x10wit-bindgen-rust\x060.41.0"; -#[inline(never)] -#[doc(hidden)] -pub fn __link_custom_section_describing_imports() { - wit_bindgen_rt::maybe_link_cabi_realloc(); -} diff --git a/cosigner/src/convert.rs b/cosigner/src/convert.rs index fec17861..b1e1caad 100644 --- a/cosigner/src/convert.rs +++ b/cosigner/src/convert.rs @@ -6,7 +6,7 @@ use threshold::dkg::{Round1Package, Round2Package}; use threshold::identifier::Identifier; use threshold::scalar::{scalar_from_bytes, scalar_from_bytes_allow_zero}; -use crate::bindings::exports::component::threshold::types::ThresholdError; +use crate::exports::component::threshold::types::ThresholdError; pub fn hex_encode(bytes: &[u8]) -> String { bytes.iter().map(|b| format!("{:02x}", b)).collect() diff --git a/cosigner/src/dkg_ops.rs b/cosigner/src/dkg_ops.rs index f5f6351a..5f0cb0e9 100644 --- a/cosigner/src/dkg_ops.rs +++ b/cosigner/src/dkg_ops.rs @@ -7,7 +7,7 @@ use threshold::dkg; use threshold::random; use threshold::scalar::scalar_to_bytes; -use crate::bindings::exports::component::threshold::types::*; +use crate::exports::component::threshold::types::*; use crate::convert; use crate::{Round1SecretState, Round2SecretState}; diff --git a/cosigner/src/key_ops.rs b/cosigner/src/key_ops.rs index fca662db..95db8fd8 100644 --- a/cosigner/src/key_ops.rs +++ b/cosigner/src/key_ops.rs @@ -2,7 +2,7 @@ use threshold::keys::{KeyPackage, PublicKeyPackage}; -use crate::bindings::exports::component::threshold::types::ThresholdError; +use crate::exports::component::threshold::types::ThresholdError; use crate::convert; pub fn key_package_tweak( diff --git a/cosigner/src/lib.rs b/cosigner/src/lib.rs index 44c27a6d..677a8860 100644 --- a/cosigner/src/lib.rs +++ b/cosigner/src/lib.rs @@ -1,5 +1,7 @@ -#[allow(warnings)] -mod bindings; +wit_bindgen::generate!({ + world: "threshold-world", + path: "wit", +}); mod ark_ops; mod convert; @@ -12,7 +14,7 @@ mod session_state; use std::cell::RefCell; -use bindings::exports::component::threshold::types::*; +use crate::exports::component::threshold::types::*; struct Component; @@ -286,4 +288,4 @@ impl Guest for Component { type RefreshSession = session_state::RefreshSessionState; } -bindings::export!(Component with_types_in bindings); +export!(Component); diff --git a/cosigner/src/session_state.rs b/cosigner/src/session_state.rs index 79933f1b..567d1bf7 100644 --- a/cosigner/src/session_state.rs +++ b/cosigner/src/session_state.rs @@ -6,7 +6,7 @@ use std::cell::RefCell; use std::collections::{HashMap, HashSet}; -use crate::bindings::exports::component::threshold::types::*; +use crate::exports::component::threshold::types::*; // --------------------------------------------------------------------------- // Helpers diff --git a/cosigner/src/signing_ops.rs b/cosigner/src/signing_ops.rs index 6295045a..1ccfda11 100644 --- a/cosigner/src/signing_ops.rs +++ b/cosigner/src/signing_ops.rs @@ -11,7 +11,7 @@ use threshold::point; use threshold::scalar::scalar_to_bytes; use threshold::signing; -use crate::bindings::exports::component::threshold::types::*; +use crate::exports::component::threshold::types::*; use crate::convert; use crate::SigningNonceState; diff --git a/cosigner/src/util_ops.rs b/cosigner/src/util_ops.rs index ac9d042e..fe01d711 100644 --- a/cosigner/src/util_ops.rs +++ b/cosigner/src/util_ops.rs @@ -7,7 +7,7 @@ use threshold::polynomial; use threshold::random; use threshold::scalar::scalar_to_bytes; -use crate::bindings::exports::component::threshold::types::ThresholdError; +use crate::exports::component::threshold::types::ThresholdError; use crate::convert; pub fn identifier_derive(message: Vec) -> Result { diff --git a/e2e/test/ark_e2e_test.dart b/e2e/test/ark_e2e_test.dart index 823184e0..bdb9dd6b 100644 --- a/e2e/test/ark_e2e_test.dart +++ b/e2e/test/ark_e2e_test.dart @@ -108,7 +108,7 @@ Future startCosignerRuntime( '../cosigner-runtime/target/release/cosigner-runtime', [ '--wasm', - '../cosigner/target/wasm32-wasip1/release/cosigner.wasm', + '../cosigner/target/wasm32-wasip2/release/cosigner.wasm', '--port', port.toString(), ], diff --git a/e2e/test/full_system_test.dart b/e2e/test/full_system_test.dart index c72c05f5..a36ed6d9 100644 --- a/e2e/test/full_system_test.dart +++ b/e2e/test/full_system_test.dart @@ -93,7 +93,7 @@ void main() { serverProcess = await Process.start( '../cosigner-runtime/target/release/cosigner-runtime', [ - '--wasm', '../cosigner/target/wasm32-wasip1/release/cosigner.wasm', + '--wasm', '../cosigner/target/wasm32-wasip2/release/cosigner.wasm', '--port', serverPort.toString(), ], mode: ProcessStartMode.normal, diff --git a/e2e/test/mutinynet_ark_e2e_test.dart b/e2e/test/mutinynet_ark_e2e_test.dart index e8cb20de..a293a4fc 100644 --- a/e2e/test/mutinynet_ark_e2e_test.dart +++ b/e2e/test/mutinynet_ark_e2e_test.dart @@ -78,7 +78,7 @@ void main() { serverProcess = await Process.start( '../cosigner-runtime/target/release/cosigner-runtime', [ - '--wasm', '../cosigner/target/wasm32-wasip1/release/cosigner.wasm', + '--wasm', '../cosigner/target/wasm32-wasip2/release/cosigner.wasm', '--port', serverPort.toString(), ], mode: ProcessStartMode.normal, diff --git a/e2e/test/mutinynet_e2e_test.dart b/e2e/test/mutinynet_e2e_test.dart index 5be50a38..035a20e3 100644 --- a/e2e/test/mutinynet_e2e_test.dart +++ b/e2e/test/mutinynet_e2e_test.dart @@ -76,7 +76,7 @@ void main() { serverProcess = await Process.start( '../cosigner-runtime/target/release/cosigner-runtime', [ - '--wasm', '../cosigner/target/wasm32-wasip1/release/cosigner.wasm', + '--wasm', '../cosigner/target/wasm32-wasip2/release/cosigner.wasm', '--port', serverPort.toString(), ], mode: ProcessStartMode.normal, diff --git a/e2e/test/software_signer_e2e_test.dart b/e2e/test/software_signer_e2e_test.dart index bc656d60..cbe0e24d 100644 --- a/e2e/test/software_signer_e2e_test.dart +++ b/e2e/test/software_signer_e2e_test.dart @@ -84,7 +84,7 @@ void main() { serverProcess = await Process.start( '../cosigner-runtime/target/release/cosigner-runtime', [ - '--wasm', '../cosigner/target/wasm32-wasip1/release/cosigner.wasm', + '--wasm', '../cosigner/target/wasm32-wasip2/release/cosigner.wasm', '--port', serverPort.toString(), ], mode: ProcessStartMode.normal,