-
Notifications
You must be signed in to change notification settings - Fork 237
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4827 from nymtech/feature/ticketbook-utils
revamped ticketbook serialisation and exposed additional cli methods
- Loading branch information
Showing
92 changed files
with
2,184 additions
and
406 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
16 changes: 16 additions & 0 deletions
16
clients/native/src/commands/ecash/import_coin_index_signatures.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Copyright 2024 - Nym Technologies SA <[email protected]> | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
use crate::commands::CliNativeClient; | ||
use crate::error::ClientError; | ||
use nym_client_core::cli_helpers::client_import_coin_index_signatures::{ | ||
import_coin_index_signatures, CommonClientImportCoinIndexSignaturesArgs, | ||
}; | ||
|
||
pub(crate) async fn execute( | ||
args: CommonClientImportCoinIndexSignaturesArgs, | ||
) -> Result<(), ClientError> { | ||
import_coin_index_signatures::<CliNativeClient, _>(args).await?; | ||
println!("successfully imported coin index signatures!"); | ||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
clients/native/src/commands/ecash/import_expiration_date_signatures.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Copyright 2024 - Nym Technologies SA <[email protected]> | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
use crate::commands::CliNativeClient; | ||
use crate::error::ClientError; | ||
use nym_client_core::cli_helpers::client_import_expiration_date_signatures::{ | ||
import_expiration_date_signatures, CommonClientImportExpirationDateSignaturesArgs, | ||
}; | ||
|
||
pub(crate) async fn execute( | ||
args: CommonClientImportExpirationDateSignaturesArgs, | ||
) -> Result<(), ClientError> { | ||
import_expiration_date_signatures::<CliNativeClient, _>(args).await?; | ||
println!("successfully imported expiration date signatures!"); | ||
Ok(()) | ||
} |
16 changes: 16 additions & 0 deletions
16
clients/native/src/commands/ecash/import_master_verification_key.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Copyright 2024 - Nym Technologies SA <[email protected]> | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
use crate::commands::CliNativeClient; | ||
use crate::error::ClientError; | ||
use nym_client_core::cli_helpers::client_import_master_verification_key::{ | ||
import_master_verification_key, CommonClientImportMasterVerificationKeyArgs, | ||
}; | ||
|
||
pub(crate) async fn execute( | ||
args: CommonClientImportMasterVerificationKeyArgs, | ||
) -> Result<(), ClientError> { | ||
import_master_verification_key::<CliNativeClient, _>(args).await?; | ||
println!("successfully imported master verification key!"); | ||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
// Copyright 2024 - Nym Technologies SA <[email protected]> | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
use clap::{Args, Subcommand}; | ||
use nym_client_core::cli_helpers::client_import_coin_index_signatures::CommonClientImportCoinIndexSignaturesArgs; | ||
use nym_client_core::cli_helpers::client_import_credential::CommonClientImportTicketBookArgs; | ||
use nym_client_core::cli_helpers::client_import_expiration_date_signatures::CommonClientImportExpirationDateSignaturesArgs; | ||
use nym_client_core::cli_helpers::client_import_master_verification_key::CommonClientImportMasterVerificationKeyArgs; | ||
use std::error::Error; | ||
|
||
pub(crate) mod import_coin_index_signatures; | ||
pub(crate) mod import_credential; | ||
pub(crate) mod import_expiration_date_signatures; | ||
pub(crate) mod import_master_verification_key; | ||
pub(crate) mod show_ticketbooks; | ||
|
||
#[derive(Args)] | ||
#[clap(args_conflicts_with_subcommands = true, subcommand_required = true)] | ||
pub struct Ecash { | ||
#[clap(subcommand)] | ||
pub command: EcashCommands, | ||
} | ||
|
||
impl Ecash { | ||
pub async fn execute(self) -> Result<(), Box<dyn Error + Send + Sync>> { | ||
match self.command { | ||
EcashCommands::ShowTicketBooks(args) => show_ticketbooks::execute(args).await?, | ||
EcashCommands::ImportTicketBook(args) => import_credential::execute(args).await?, | ||
EcashCommands::ImportCoinIndexSignatures(args) => { | ||
import_coin_index_signatures::execute(args).await? | ||
} | ||
EcashCommands::ImportExpirationDateSignatures(args) => { | ||
import_expiration_date_signatures::execute(args).await? | ||
} | ||
EcashCommands::ImportMasterVerificationKey(args) => { | ||
import_master_verification_key::execute(args).await? | ||
} | ||
} | ||
Ok(()) | ||
} | ||
} | ||
|
||
#[derive(Subcommand)] | ||
pub enum EcashCommands { | ||
/// Display information associated with the imported ticketbooks, | ||
ShowTicketBooks(show_ticketbooks::Args), | ||
|
||
/// Import a pre-generated ticketbook | ||
ImportTicketBook(CommonClientImportTicketBookArgs), | ||
|
||
/// Import coin index signatures needed for ticketbooks | ||
ImportCoinIndexSignatures(CommonClientImportCoinIndexSignaturesArgs), | ||
|
||
/// Import expiration date signatures needed for ticketbooks | ||
ImportExpirationDateSignatures(CommonClientImportExpirationDateSignaturesArgs), | ||
|
||
/// Import master verification key needed for ticketbooks | ||
ImportMasterVerificationKey(CommonClientImportMasterVerificationKeyArgs), | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
clients/socks5/src/commands/ecash/import_coin_index_signatures.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Copyright 2024 - Nym Technologies SA <[email protected]> | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
use crate::commands::CliSocks5Client; | ||
use crate::error::Socks5ClientError; | ||
use nym_client_core::cli_helpers::client_import_coin_index_signatures::{ | ||
import_coin_index_signatures, CommonClientImportCoinIndexSignaturesArgs, | ||
}; | ||
|
||
pub(crate) async fn execute( | ||
args: CommonClientImportCoinIndexSignaturesArgs, | ||
) -> Result<(), Socks5ClientError> { | ||
import_coin_index_signatures::<CliSocks5Client, _>(args).await?; | ||
println!("successfully imported coin index signatures!"); | ||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
clients/socks5/src/commands/ecash/import_expiration_date_signatures.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Copyright 2024 - Nym Technologies SA <[email protected]> | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
use crate::commands::CliSocks5Client; | ||
use crate::error::Socks5ClientError; | ||
use nym_client_core::cli_helpers::client_import_expiration_date_signatures::{ | ||
import_expiration_date_signatures, CommonClientImportExpirationDateSignaturesArgs, | ||
}; | ||
|
||
pub(crate) async fn execute( | ||
args: CommonClientImportExpirationDateSignaturesArgs, | ||
) -> Result<(), Socks5ClientError> { | ||
import_expiration_date_signatures::<CliSocks5Client, _>(args).await?; | ||
println!("successfully imported expiration date signatures!"); | ||
Ok(()) | ||
} |
16 changes: 16 additions & 0 deletions
16
clients/socks5/src/commands/ecash/import_master_verification_key.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Copyright 2024 - Nym Technologies SA <[email protected]> | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
use crate::commands::CliSocks5Client; | ||
use crate::error::Socks5ClientError; | ||
use nym_client_core::cli_helpers::client_import_master_verification_key::{ | ||
import_master_verification_key, CommonClientImportMasterVerificationKeyArgs, | ||
}; | ||
|
||
pub(crate) async fn execute( | ||
args: CommonClientImportMasterVerificationKeyArgs, | ||
) -> Result<(), Socks5ClientError> { | ||
import_master_verification_key::<CliSocks5Client, _>(args).await?; | ||
println!("successfully imported master verification key!"); | ||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
// Copyright 2024 - Nym Technologies SA <[email protected]> | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
use clap::{Args, Subcommand}; | ||
use nym_client_core::cli_helpers::client_import_coin_index_signatures::CommonClientImportCoinIndexSignaturesArgs; | ||
use nym_client_core::cli_helpers::client_import_credential::CommonClientImportTicketBookArgs; | ||
use nym_client_core::cli_helpers::client_import_expiration_date_signatures::CommonClientImportExpirationDateSignaturesArgs; | ||
use nym_client_core::cli_helpers::client_import_master_verification_key::CommonClientImportMasterVerificationKeyArgs; | ||
use std::error::Error; | ||
|
||
pub(crate) mod import_coin_index_signatures; | ||
pub(crate) mod import_credential; | ||
pub(crate) mod import_expiration_date_signatures; | ||
pub(crate) mod import_master_verification_key; | ||
pub(crate) mod show_ticketbooks; | ||
|
||
#[derive(Args)] | ||
#[clap(args_conflicts_with_subcommands = true, subcommand_required = true)] | ||
pub struct Ecash { | ||
#[clap(subcommand)] | ||
pub command: EcashCommands, | ||
} | ||
|
||
impl Ecash { | ||
pub async fn execute(self) -> Result<(), Box<dyn Error + Send + Sync>> { | ||
match self.command { | ||
EcashCommands::ShowTicketBooks(args) => show_ticketbooks::execute(args).await?, | ||
EcashCommands::ImportTicketBook(args) => import_credential::execute(args).await?, | ||
EcashCommands::ImportCoinIndexSignatures(args) => { | ||
import_coin_index_signatures::execute(args).await? | ||
} | ||
EcashCommands::ImportExpirationDateSignatures(args) => { | ||
import_expiration_date_signatures::execute(args).await? | ||
} | ||
EcashCommands::ImportMasterVerificationKey(args) => { | ||
import_master_verification_key::execute(args).await? | ||
} | ||
} | ||
Ok(()) | ||
} | ||
} | ||
|
||
#[derive(Subcommand)] | ||
pub enum EcashCommands { | ||
/// Display information associated with the imported ticketbooks, | ||
ShowTicketBooks(show_ticketbooks::Args), | ||
|
||
/// Import a pre-generated ticketbook | ||
ImportTicketBook(CommonClientImportTicketBookArgs), | ||
|
||
/// Import coin index signatures needed for ticketbooks | ||
ImportCoinIndexSignatures(CommonClientImportCoinIndexSignaturesArgs), | ||
|
||
/// Import expiration date signatures needed for ticketbooks | ||
ImportExpirationDateSignatures(CommonClientImportExpirationDateSignaturesArgs), | ||
|
||
/// Import master verification key needed for ticketbooks | ||
ImportMasterVerificationKey(CommonClientImportMasterVerificationKeyArgs), | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.