This commit is contained in:
parent
2271a899c1
commit
862f9748f7
924
Cargo.lock
generated
924
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "light-openid"
|
name = "light-openid"
|
||||||
version = "1.0.2"
|
version = "1.0.3"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
repository = "https://gitea.communiquons.org/pierre/light-openid"
|
repository = "https://gitea.communiquons.org/pierre/light-openid"
|
||||||
authors = ["Pierre HUBERT <pierre.git@communiquons.org>"]
|
authors = ["Pierre HUBERT <pierre.git@communiquons.org>"]
|
||||||
@ -21,7 +21,7 @@ urlencoding = "2.1.3"
|
|||||||
# Dependencies for crypto wrapper
|
# Dependencies for crypto wrapper
|
||||||
bincode = { version = "2.0.0-rc.3", optional = true }
|
bincode = { version = "2.0.0-rc.3", optional = true }
|
||||||
aes-gcm = { version = "0.10.3", optional = true }
|
aes-gcm = { version = "0.10.3", optional = true }
|
||||||
rand = { version = "0.8.5", optional = true }
|
rand = { version = "0.9.0", optional = true }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
crypto-wrapper = ["bincode", "aes-gcm", "rand"]
|
crypto-wrapper = ["bincode", "aes-gcm", "rand"]
|
||||||
|
@ -28,7 +28,7 @@ impl CryptoWrapper {
|
|||||||
/// Encrypt some data, returning the result as a base64-encoded string
|
/// Encrypt some data, returning the result as a base64-encoded string
|
||||||
pub fn encrypt<T: Encode + Decode>(&self, data: &T) -> Result<String, Box<dyn Error>> {
|
pub fn encrypt<T: Encode + Decode>(&self, data: &T) -> Result<String, Box<dyn Error>> {
|
||||||
let aes_key = Aes256Gcm::new(&self.key);
|
let aes_key = Aes256Gcm::new(&self.key);
|
||||||
let nonce_bytes = rand::thread_rng().gen::<[u8; NONCE_LEN]>();
|
let nonce_bytes = rand::rng().random::<[u8; NONCE_LEN]>();
|
||||||
|
|
||||||
let serialized_data = bincode::encode_to_vec(data, bincode::config::standard())?;
|
let serialized_data = bincode::encode_to_vec(data, bincode::config::standard())?;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user