Skip to content

Commit 0432a2a

Browse files
committed
chore(proxy): remove cipherstash-config dependency
We have known that config was a mess for a while. The straw that broke the camel's back was attempting to use a local cipherstash-client override which had the knock on effect of pulling in two copies of cipherstash-config.
1 parent 901f5fe commit 0432a2a

9 files changed

Lines changed: 67 additions & 40 deletions

File tree

Cargo.lock

Lines changed: 48 additions & 22 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/cipherstash-proxy/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ arc-swap = "1.7.1"
99
bytes = { version = "1.9", default-features = false }
1010
chrono = { version = "0.4.39", features = ["clock"] }
1111
cipherstash-client = { version = "0.20.0", features = ["tokio"] }
12-
cipherstash-config = "0.2.3"
1312
clap = { version = "4.5.31", features = ["derive", "env"] }
1413
config = { version = "0.15", features = [
1514
"async",

packages/cipherstash-proxy/src/encrypt/config/encrypt_config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use crate::{
33
error::{ConfigError, Error},
44
log::KEYSET,
55
};
6-
use cipherstash_config::{
6+
use cipherstash_client::schema::{
77
column::{Index, IndexType, TokenFilter, Tokenizer},
88
ColumnConfig, ColumnType,
99
};

packages/cipherstash-proxy/src/encrypt/config/manager.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use crate::{
77
log::ENCRYPT_CONFIG,
88
};
99
use arc_swap::ArcSwap;
10-
use cipherstash_config::ColumnConfig;
10+
use cipherstash_client::schema::ColumnConfig;
1111
use serde_json::Value;
1212
use std::{collections::HashMap, sync::Arc, time::Duration};
1313
use tokio::{task::JoinHandle, time};

packages/cipherstash-proxy/src/encrypt/mod.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ use cipherstash_client::{
1717
self, Encrypted, EncryptedEntry, EncryptedSteVecTerm, IndexTerm, Plaintext,
1818
PlaintextTarget, ReferencedPendingPipeline,
1919
},
20+
schema::ColumnConfig,
2021
ConsoleConfig, CtsConfig, ZeroKMSConfig,
2122
};
22-
use cipherstash_config::ColumnConfig;
2323
use config::EncryptConfigManager;
2424
use schema::SchemaManager;
2525
use std::{sync::Arc, vec};
@@ -201,7 +201,14 @@ async fn init_cipher(config: &TandemConfig) -> Result<ScopedCipher, Error> {
201201
// Not using with_env because the proxy config should take precedence
202202
let builder = ZeroKMSConfig::builder()
203203
.add_source(EnvSource::default())
204-
.workspace_id(&config.auth.workspace_id)
204+
.workspace_id(
205+
config
206+
.auth
207+
.workspace_id
208+
.to_owned()
209+
.try_into()
210+
.map_err(cipherstash_client::config::ConfigError::from)?,
211+
)
205212
.access_key(&config.auth.client_access_key)
206213
.try_with_client_id(&config.encrypt.client_id)?
207214
.try_with_client_key(&config.encrypt.client_key)?

packages/cipherstash-proxy/src/error.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ pub enum ConfigError {
104104
Certificate(#[from] rustls_pki_types::pem::Error),
105105

106106
#[error(transparent)]
107-
EncryptConfig(#[from] cipherstash_config::errors::ConfigError),
107+
EncryptConfig(#[from] cipherstash_client::config::errors::ConfigError),
108108

109109
#[error(transparent)]
110110
Database(#[from] tokio_postgres::Error),
@@ -285,12 +285,6 @@ impl From<config::ConfigError> for Error {
285285
}
286286
}
287287

288-
impl From<cipherstash_config::errors::ConfigError> for Error {
289-
fn from(e: cipherstash_config::errors::ConfigError) -> Self {
290-
Error::Config(e.into())
291-
}
292-
}
293-
294288
impl From<cipherstash_client::encryption::TypeParseError> for Error {
295289
fn from(e: cipherstash_client::encryption::TypeParseError) -> Self {
296290
Error::Encrypt(e.into())

packages/cipherstash-proxy/src/postgresql/context/column.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use cipherstash_config::{ColumnConfig, ColumnType};
1+
use cipherstash_client::schema::{ColumnConfig, ColumnType};
22
use postgres_types::Type;
33

44
use crate::Identifier;

packages/cipherstash-proxy/src/postgresql/data/from_sql.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ use crate::{
66
use bigdecimal::BigDecimal;
77
use bytes::BytesMut;
88
use chrono::NaiveDate;
9-
use cipherstash_client::encryption::Plaintext;
10-
use cipherstash_config::ColumnType;
9+
use cipherstash_client::{encryption::Plaintext, schema::ColumnType};
1110
use postgres_types::FromSql;
1211
use postgres_types::Type;
1312
use rust_decimal::Decimal;
@@ -342,8 +341,10 @@ mod tests {
342341
};
343342
use bytes::{BufMut, BytesMut};
344343
use chrono::NaiveDate;
345-
use cipherstash_client::encryption::Plaintext;
346-
use cipherstash_config::{ColumnConfig, ColumnMode, ColumnType};
344+
use cipherstash_client::{
345+
encryption::Plaintext,
346+
schema::{ColumnConfig, ColumnMode, ColumnType},
347+
};
347348
use postgres_types::{ToSql, Type};
348349

349350
fn to_message(s: &[u8]) -> BytesMut {

packages/cipherstash-proxy/src/postgresql/messages/parse.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ mod tests {
123123
Identifier,
124124
};
125125
use bytes::BytesMut;
126-
use cipherstash_config::{ColumnConfig, ColumnType};
126+
use cipherstash_client::schema::{ColumnConfig, ColumnType};
127127

128128
fn to_message(s: &[u8]) -> BytesMut {
129129
BytesMut::from(s)

0 commit comments

Comments
 (0)