auths_cli/commands/device/
mod.rs1pub mod authorization;
2pub mod pair;
3pub mod verify_attestation;
4
5pub use authorization::{DeviceCommand, DeviceSubcommand, handle_device};
6pub use pair::{PairCommand, handle_pair};
7pub use verify_attestation::{VerifyCommand, handle_verify};
8
9use crate::commands::executable::ExecutableCommand;
10use crate::config::CliConfig;
11use anyhow::{Context, Result};
12
13impl ExecutableCommand for PairCommand {
14 fn execute(&self, ctx: &CliConfig) -> Result<()> {
15 let env_config = match &ctx.repo_path {
20 Some(_) => {
21 let registry = auths_sdk::storage_layout::resolve_repo_path(ctx.repo_path.clone())
22 .context("Failed to resolve the repository path for the pairing store")?;
23 let mut scoped = ctx.env_config.clone();
24 scoped.auths_home = Some(registry);
25 scoped
26 }
27 None => ctx.env_config.clone(),
28 };
29
30 handle_pair(self.clone(), ctx.passphrase_provider.clone(), &env_config)
31 }
32}
33
34impl ExecutableCommand for DeviceCommand {
35 fn execute(&self, ctx: &CliConfig) -> Result<()> {
36 handle_device(
37 self.clone(),
38 ctx.repo_path.clone(),
39 self.overrides.identity_ref.clone(),
40 self.overrides.identity_blob.clone(),
41 self.overrides.attestation_prefix.clone(),
42 self.overrides.attestation_blob.clone(),
43 ctx.passphrase_provider.clone(),
44 &ctx.env_config,
45 )
46 }
47}