Skip to content

Commit 3218f1a

Browse files
committed
chore: Fix encryption, inject catalogs to local runtime enviro
1 parent 07a5bf2 commit 3218f1a

11 files changed

Lines changed: 339 additions & 59 deletions

File tree

Cargo.lock

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

Cargo.toml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,14 @@ resolver = "2"
55
[workspace.package]
66
edition = "2021"
77
version = "0.3.13"
8-
9-
10-
118
description = "Tower is the best way to host Python data apps in production"
129
rust-version = "1.77"
1310
authors = ["Brad Heller <brad@tower.dev>"]
1411
license = "MIT"
1512
repository = "https://github.com/tower/tower-cli"
1613

1714
[workspace.dependencies]
15+
aes-gcm = "0.10"
1816
anyhow = "1.0.95"
1917
async-compression = { version = "0.4", features = ["tokio", "gzip"] }
2018
base64 = "0.22"

crates/crypto/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@ version = { workspace = true }
44
edition = "2021"
55

66
[dependencies]
7+
aes-gcm = { workspace = true }
78
base64 = { workspace = true }
89
pem = { workspace = true }
910
rand = { workspace = true }
1011
rsa = { workspace = true }
1112
sha2 = { workspace = true }
13+
snafu = { workspace = true }
1214
testutils = { workspace = true }

crates/crypto/src/errors.rs

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
use snafu::prelude::*;
2+
3+
#[derive(Debug, Snafu)]
4+
pub enum Error {
5+
#[snafu(display("invalid message"))]
6+
InvalidMessage,
7+
8+
#[snafu(display("invalid encoding"))]
9+
InvalidEncoding,
10+
11+
#[snafu(display("cryptography error"))]
12+
CryptographyError,
13+
14+
#[snafu(display("base64 error"))]
15+
Base64Error,
16+
}
17+
18+
impl From<std::string::FromUtf8Error> for Error {
19+
fn from(_error: std::string::FromUtf8Error) -> Self {
20+
Self::InvalidEncoding
21+
}
22+
}
23+
24+
impl From<aes_gcm::Error> for Error {
25+
fn from(_error: aes_gcm::Error) -> Self {
26+
Self::CryptographyError
27+
}
28+
}
29+
30+
impl From<rsa::Error> for Error {
31+
fn from(_error: rsa::Error) -> Self {
32+
Self::CryptographyError
33+
}
34+
}
35+
36+
impl From<base64::DecodeError> for Error {
37+
fn from(_error: base64::DecodeError) -> Self {
38+
Self::Base64Error
39+
}
40+
}

0 commit comments

Comments
 (0)