Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3116019
D4362.id13861.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
D4362.id13861.diff
View Options
diff --git a/services/identity/src/config.rs b/services/identity/src/config.rs
--- a/services/identity/src/config.rs
+++ b/services/identity/src/config.rs
@@ -1,9 +1,10 @@
-use opaque_ke::{errors::PakeError, keypair::Key};
+use curve25519_dalek::ristretto::RistrettoPoint;
+use opaque_ke::{errors::PakeError, keypair::KeyPair};
use std::{env, fs, io, path::Path};
-#[derive(Default, Debug)]
+#[derive(Debug, Clone)]
pub struct Config {
- server_secret_key: Option<Key>,
+ pub server_keypair: KeyPair<RistrettoPoint>,
}
impl Config {
@@ -12,9 +13,9 @@
path.push("secrets");
path.push("secret_key");
path.set_extension("txt");
- let key = get_key_from_file(path)?;
+ let keypair = get_keypair_from_file(path)?;
Ok(Self {
- server_secret_key: Some(key),
+ server_keypair: keypair,
})
}
}
@@ -29,7 +30,10 @@
IO(io::Error),
}
-fn get_key_from_file<P: AsRef<Path>>(path: P) -> Result<Key, Error> {
+fn get_keypair_from_file<P: AsRef<Path>>(
+ path: P,
+) -> Result<KeyPair<RistrettoPoint>, Error> {
let bytes = fs::read(path)?;
- Key::from_bytes(&bytes).map_err(Error::Pake)
+ KeyPair::from_private_key_slice(&bytes)
+ .map_err(|e| Error::Pake(PakeError::CryptoError(e)))
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Nov 1, 9:42 PM (20 h, 20 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2402250
Default Alt Text
D4362.id13861.diff (1 KB)
Attached To
Mode
D4362: [services][identity] update Config struct to hold keypair instead of just private key
Attached
Detach File
Event Timeline
Log In to Comment