Skip to content

Commit

Permalink
add exportable flag to hashicorp::upload
Browse files Browse the repository at this point in the history
  • Loading branch information
mkaczanowski committed Jan 15, 2024
1 parent 13f6900 commit fef8bf6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/commands/hashicorp/upload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ pub struct UploadCommand {
/// verify that provided key name is defined in the config
#[clap(long = "no-check-defined-key")]
no_check_defined_key: bool,

/// this allows for all the valid keys in the key ring to be exported. Once set, this cannot be disabled.
#[clap(long = "exportable")]
exportable: bool,
}

/// Import Secret Key Request
Expand Down Expand Up @@ -184,6 +188,7 @@ impl UploadCommand {
&self.key_name,
client::CreateKeyType::Ed25519,
&base64::encode(wrapped_aes),
self.exportable,
)
.expect("import key error!");
}
Expand Down Expand Up @@ -297,6 +302,7 @@ mod tests {
payload: Some(ED25519.into()),
payload_file: None,
no_check_defined_key: false,
exportable: false,
};

let config = HashiCorpConfig {
Expand Down
3 changes: 3 additions & 0 deletions src/keyring/providers/hashicorp/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ pub(crate) struct ImportRequest {
pub r#type: String,
pub ciphertext: String,
pub hash_function: String,
pub exportable: bool,
}

#[allow(dead_code)]
Expand Down Expand Up @@ -365,11 +366,13 @@ impl TendermintValidatorApp {
key_name: &str,
key_type: CreateKeyType,
ciphertext: &str,
exportable: bool,
) -> Result<(), Error> {
let body = ImportRequest {
r#type: key_type.to_string(),
ciphertext: ciphertext.into(),
hash_function: "SHA256".into(),
exportable,
};

let _ = self
Expand Down

0 comments on commit fef8bf6

Please sign in to comment.