Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3353779
D3799.id11803.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D3799.id11803.diff
View Options
diff --git a/services/identity/Cargo.toml b/services/identity/Cargo.toml
--- a/services/identity/Cargo.toml
+++ b/services/identity/Cargo.toml
@@ -3,7 +3,17 @@
version = "0.1.0"
edition = "2021"
-# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
+[lib]
+name = "common"
+path = "src/lib.rs"
+
+[[bin]]
+name = "identity"
+path = "src/main.rs"
+
+[[bin]]
+name = "keygen"
+path = "scripts/keygen.rs"
[dependencies]
tonic = "0.6"
diff --git a/services/identity/Dockerfile b/services/identity/Dockerfile
--- a/services/identity/Dockerfile
+++ b/services/identity/Dockerfile
@@ -9,9 +9,10 @@
RUN cargo init --bin
COPY services/identity/Cargo.toml services/identity/Cargo.lock ./
+RUN touch src/lib.rs
# Cache build dependencies in a new layer
-RUN cargo build --release
+RUN cargo build --release --bin identity
RUN rm src/*.rs
COPY services/identity .
diff --git a/services/identity/scripts/keygen.rs b/services/identity/scripts/keygen.rs
new file mode 100644
--- /dev/null
+++ b/services/identity/scripts/keygen.rs
@@ -0,0 +1,17 @@
+use common::opaque::Cipher;
+use opaque_ke::{ciphersuite::CipherSuite, rand::rngs::OsRng};
+use std::{env, fs};
+
+fn main() {
+ let mut rng = OsRng;
+ let server_kp = Cipher::generate_random_keypair(&mut rng);
+ let mut path = env::current_dir().unwrap();
+ path.push("secrets");
+ if !path.exists() {
+ println!("Creating secrets directory {:?}", path);
+ fs::create_dir(&path).unwrap();
+ }
+ path.push("secret_key");
+ println!("Writing secret key to {:?}", path);
+ fs::write(&path, server_kp.private().to_arr()).unwrap();
+}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Nov 24, 11:21 AM (20 h, 57 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2575162
Default Alt Text
D3799.id11803.diff (1 KB)
Attached To
Mode
D3799: [Identity] Script to generate and persist a server keypair for PAKE
Attached
Detach File
Event Timeline
Log In to Comment