diff options
author | Jesse Luehrs <doy@tozt.net> | 2020-05-02 19:35:39 -0400 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2020-05-02 19:35:39 -0400 |
commit | c16fa1c1e05f2586e2deca8faf32e519a9b50670 (patch) | |
tree | 09d9c8563a0b6f172c483c4e8a1046a7b7a80691 /src/bin/rbw-agent/actions.rs | |
parent | 8a81e826f0ec61eab9737ca443197865324b52bd (diff) | |
download | rbw-c16fa1c1e05f2586e2deca8faf32e519a9b50670.tar.gz rbw-c16fa1c1e05f2586e2deca8faf32e519a9b50670.zip |
expand the protocol to allow decrypting with organization keys
not implemented yet, just changing the interface
Diffstat (limited to 'src/bin/rbw-agent/actions.rs')
-rw-r--r-- | src/bin/rbw-agent/actions.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/bin/rbw-agent/actions.rs b/src/bin/rbw-agent/actions.rs index 52c34fa..afe76c8 100644 --- a/src/bin/rbw-agent/actions.rs +++ b/src/bin/rbw-agent/actions.rs @@ -211,9 +211,10 @@ pub async fn decrypt( sock: &mut crate::sock::Sock, state: std::sync::Arc<tokio::sync::RwLock<crate::agent::State>>, cipherstring: &str, + org_id: Option<&str>, ) -> anyhow::Result<()> { let state = state.read().await; - let keys = if let Some(keys) = &state.priv_key { + let keys = if let Some(keys) = state.key(org_id) { keys } else { return Err(anyhow::anyhow!( @@ -238,9 +239,10 @@ pub async fn encrypt( sock: &mut crate::sock::Sock, state: std::sync::Arc<tokio::sync::RwLock<crate::agent::State>>, plaintext: &str, + org_id: Option<&str>, ) -> anyhow::Result<()> { let state = state.read().await; - let keys = if let Some(keys) = &state.priv_key { + let keys = if let Some(keys) = state.key(org_id) { keys } else { return Err(anyhow::anyhow!( |