diff --git a/implementations/rust/ockam/ockam_api/src/cli_state/trust.rs b/implementations/rust/ockam/ockam_api/src/cli_state/trust.rs index d77976bad11..9eabfa03c28 100644 --- a/implementations/rust/ockam/ockam_api/src/cli_state/trust.rs +++ b/implementations/rust/ockam/ockam_api/src/cli_state/trust.rs @@ -4,6 +4,7 @@ use crate::nodes::service::{ }; use crate::nodes::NodeManager; use crate::{multiaddr_to_transport_route, ApiError, CliState}; +use ockam::identity::models::ChangeHistory; use ockam::identity::{IdentitiesVerification, RemoteCredentialRetrieverInfo}; use ockam_core::errcode::{Kind, Origin}; use ockam_core::{Error, Result}; @@ -178,11 +179,11 @@ impl CliState { /// 1. Either we explicitly know the Authority identity that we trust, and optionally route to its node to request /// a new credential /// 2. Or we know the project name (or have default one) that contains identity and route to the Authority node - #[instrument(skip_all, fields(project_name = project_name.clone(), authority_identity = authority_identity.clone(), authority_route = authority_route.clone().map_or("n/a".to_string(), |r| r.to_string())))] + #[instrument(skip_all, fields(project_name = project_name.clone(), authority_identity = authority_identity.as_ref().map(|a| a.to_string()).unwrap_or("n/a".to_string()), authority_route = authority_route.clone().map_or("n/a".to_string(), |r| r.to_string())))] pub async fn retrieve_trust_options( &self, project_name: &Option, - authority_identity: &Option, + authority_identity: &Option, authority_route: &Option, credential_scope: &Option, ) -> Result { @@ -206,7 +207,7 @@ impl CliState { if let Some(authority_identity) = authority_identity { return self .retrieve_trust_options_explicit_project_authority( - authority_identity, + &authority_identity.to_string(), authority_route, credential_scope, ) diff --git a/implementations/rust/ockam/ockam_api/src/nodes/service/in_memory_node.rs b/implementations/rust/ockam/ockam_api/src/nodes/service/in_memory_node.rs index f6c611b0d96..d99e2e40712 100644 --- a/implementations/rust/ockam/ockam_api/src/nodes/service/in_memory_node.rs +++ b/implementations/rust/ockam/ockam_api/src/nodes/service/in_memory_node.rs @@ -4,6 +4,7 @@ use std::time::Duration; use futures::executor; use miette::IntoDiagnostic; +use ockam::identity::models::ChangeHistory; use ockam::identity::{Identifier, SecureChannels}; use ockam::tcp::{TcpListenerOptions, TcpTransport}; use ockam::{Context, Result}; @@ -126,7 +127,7 @@ impl InMemoryNode { identity_name: &str, http_server_port: Option, project_name: Option, - authority_identity: Option, + authority_identity: Option, authority_route: Option, ) -> miette::Result { let defaults = NodeManagerDefaults::default(); diff --git a/implementations/rust/ockam/ockam_command/src/authority/create.rs b/implementations/rust/ockam/ockam_command/src/authority/create.rs index a5c9d8e2be4..d4f7f0e8805 100644 --- a/implementations/rust/ockam/ockam_command/src/authority/create.rs +++ b/implementations/rust/ockam/ockam_command/src/authority/create.rs @@ -10,6 +10,7 @@ use tokio_retry::strategy::FixedInterval; use tokio_retry::Retry; use tracing::{debug, error, info}; +use ockam::identity::models::ChangeHistory; use ockam::identity::utils::now; use ockam::identity::{Identifier, Identity, TimestampInSeconds, Vault}; use ockam::Context; @@ -116,8 +117,8 @@ pub struct CreateCommand { /// Full, hex-encoded Identity (change history) of the account authority to trust /// for account and project administrator credentials. - #[arg(long, value_name = "ACCOUNT_AUTHORITY_CHANGE_HISTORY", default_value = None)] - account_authority: Option, + #[arg(long, value_name = "ACCOUNT_AUTHORITY_CHANGE_HISTORY", default_value = None, value_parser = ChangeHistory::import_from_string)] + account_authority: Option, /// Enforce distinction between admins and enrollers #[arg(long, value_name = "ENFORCE_ADMIN_CHECKS", default_value_t = false)] @@ -222,7 +223,7 @@ impl CreateCommand { } if let Some(acc_auth_identity) = &self.account_authority { args.push("--account-authority".to_string()); - args.push(acc_auth_identity.clone()); + args.push(acc_auth_identity.to_string()); } if self.enforce_admin_checks { args.push("--enforce-admin-checks".to_string()); @@ -332,7 +333,7 @@ impl CreateCommand { Some(account_authority_change_history) => Some( Identity::import_from_string( None, - account_authority_change_history.as_str(), + &account_authority_change_history.to_string(), Vault::create_verifying_vault(), ) .await diff --git a/implementations/rust/ockam/ockam_command/src/node/util.rs b/implementations/rust/ockam/ockam_command/src/node/util.rs index 240fa212dea..760208fe51a 100644 --- a/implementations/rust/ockam/ockam_command/src/node/util.rs +++ b/implementations/rust/ockam/ockam_command/src/node/util.rs @@ -132,7 +132,7 @@ pub async fn spawn_node(opts: &CommandGlobalOpts, cmd: CreateCommand) -> miette: if let Some(authority_identity) = authority_identity { args.push("--authority-identity".to_string()); - args.push(authority_identity); + args.push(authority_identity.to_string()); } if let Some(authority_route) = authority_route { diff --git a/implementations/rust/ockam/ockam_command/src/shared_args.rs b/implementations/rust/ockam/ockam_command/src/shared_args.rs index 4262e243b87..f6c8932d749 100644 --- a/implementations/rust/ockam/ockam_command/src/shared_args.rs +++ b/implementations/rust/ockam/ockam_command/src/shared_args.rs @@ -1,5 +1,6 @@ use crate::util::parsers::duration_parser; use clap::Args; +use ockam::identity::models::ChangeHistory; use ockam_core::env::get_env; use ockam_multiaddr::MultiAddr; use std::time::Duration; @@ -18,8 +19,8 @@ pub struct TrustOpts { pub project_name: Option, /// Hex encoded Identity - #[arg(long, value_name = "IDENTITY")] - pub authority_identity: Option, + #[arg(long, value_name = "IDENTITY", value_parser = ChangeHistory::import_from_string)] + pub authority_identity: Option, /// Address to the Authority node #[arg(long)]