pub struct ArkoorBuilder<'a, T: Clone> {
pub input: &'a Vtxo,
pub user_nonce: &'a PublicNonce,
pub outputs: Cow<'a, [T]>,
}Expand description
This types helps both the client and server with building arkoor txs in a synchronized way. It’s purely a functional type, initialized with the parameters that will make up the arkoor: the input vtxo to be spent and the desired outputs.
The flow works as follows:
- sender uses the constructor to check the request for validity
- server uses the contructor to check the request for validity
- server uses ArkoorBuilder::server_cosign to construct a ArkoorCosignResponse to send back to the sender
- sender passes the response into ArkoorBuilder::build_vtxos to construct the signed resulting VTXOs
Fields§
§input: &'a Vtxo§user_nonce: &'a PublicNonce§outputs: Cow<'a, [T]>Implementations§
Source§impl<'a, T: Borrow<VtxoRequest> + Clone> ArkoorBuilder<'a, T>
impl<'a, T: Borrow<VtxoRequest> + Clone> ArkoorBuilder<'a, T>
Sourcepub fn new(
input: &'a Vtxo,
user_nonce: &'a PublicNonce,
outputs: impl Into<Cow<'a, [T]>>,
) -> Result<Self, ArkoorError>
pub fn new( input: &'a Vtxo, user_nonce: &'a PublicNonce, outputs: impl Into<Cow<'a, [T]>>, ) -> Result<Self, ArkoorError>
Construct a generic arkoor builder for the given input and outputs.
Sourcepub fn txouts(&self) -> Vec<TxOut>
pub fn txouts(&self) -> Vec<TxOut>
Construct the transaction outputs of the resulting arkoor tx.
pub fn unsigned_transaction(&self) -> Transaction
pub fn sighash(&self) -> TapSighash
pub fn total_weight(&self) -> Weight
Sourcepub fn server_cosign(&self, keypair: &Keypair) -> ArkoorCosignResponse
pub fn server_cosign(&self, keypair: &Keypair) -> ArkoorCosignResponse
Used by the Ark server to cosign the arkoor request.
Sourcepub fn verify_cosign_response(
&self,
server_cosign: &ArkoorCosignResponse,
) -> bool
pub fn verify_cosign_response( &self, server_cosign: &ArkoorCosignResponse, ) -> bool
Validate the server’s partial signature.
Sourcepub fn unsigned_output_vtxos(&self) -> Vec<Vtxo>
pub fn unsigned_output_vtxos(&self) -> Vec<Vtxo>
Construct the vtxos of the outputs of this OOR tx.
These vtxos are not valid vtxos because they lack the signature.
Sourcepub fn build_vtxos(
&self,
user_sec_nonce: SecretNonce,
user_key: &Keypair,
cosign_resp: &ArkoorCosignResponse,
) -> Result<Vec<Vtxo>, IncorrectSigningKeyError>
pub fn build_vtxos( &self, user_sec_nonce: SecretNonce, user_key: &Keypair, cosign_resp: &ArkoorCosignResponse, ) -> Result<Vec<Vtxo>, IncorrectSigningKeyError>
Finish the arkoor process.
Returns the resulting vtxos and the signed arkoor tx.
Auto Trait Implementations§
impl<'a, T> Freeze for ArkoorBuilder<'a, T>
impl<'a, T> RefUnwindSafe for ArkoorBuilder<'a, T>where
T: RefUnwindSafe,
impl<'a, T> Send for ArkoorBuilder<'a, T>
impl<'a, T> Sync for ArkoorBuilder<'a, T>where
T: Sync,
impl<'a, T> Unpin for ArkoorBuilder<'a, T>where
T: Unpin,
impl<'a, T> UnwindSafe for ArkoorBuilder<'a, T>where
T: RefUnwindSafe + UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more