From c16fa1c1e05f2586e2deca8faf32e519a9b50670 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Sat, 2 May 2020 19:35:39 -0400 Subject: expand the protocol to allow decrypting with organization keys not implemented yet, just changing the interface --- src/bin/rbw/actions.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/bin/rbw/actions.rs') diff --git a/src/bin/rbw/actions.rs b/src/bin/rbw/actions.rs index 399b7f3..6de2fc6 100644 --- a/src/bin/rbw/actions.rs +++ b/src/bin/rbw/actions.rs @@ -42,13 +42,17 @@ pub fn quit() -> anyhow::Result<()> { } } -pub fn decrypt(cipherstring: &str) -> anyhow::Result { +pub fn decrypt( + cipherstring: &str, + org_id: Option<&str>, +) -> anyhow::Result { let mut sock = crate::sock::Sock::connect() .context("failed to connect to rbw-agent")?; sock.send(&rbw::protocol::Request { tty: std::env::var("TTY").ok(), action: rbw::protocol::Action::Decrypt { cipherstring: cipherstring.to_string(), + org_id: org_id.map(std::string::ToString::to_string), }, })?; @@ -62,13 +66,17 @@ pub fn decrypt(cipherstring: &str) -> anyhow::Result { } } -pub fn encrypt(plaintext: &str) -> anyhow::Result { +pub fn encrypt( + plaintext: &str, + org_id: Option<&str>, +) -> anyhow::Result { let mut sock = crate::sock::Sock::connect() .context("failed to connect to rbw-agent")?; sock.send(&rbw::protocol::Request { tty: std::env::var("TTY").ok(), action: rbw::protocol::Action::Encrypt { plaintext: plaintext.to_string(), + org_id: org_id.map(std::string::ToString::to_string), }, })?; -- cgit v1.2.3-54-g00ecf