Page MenuHomePhabricator

D4362.id13815.diff
No OneTemporary

D4362.id13815.diff

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

Mime Type
text/plain
Expires
Fri, Nov 1, 9:41 PM (20 h, 7 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2402250
Default Alt Text
D4362.id13815.diff (1 KB)

Event Timeline