Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "libpep"
edition = "2021"
version = "0.11.1"
version = "0.12.0"
authors = ["Bernard van Gastel <bvgastel@bitpowder.com>", "Job Doesburg <job@jobdoesburg.nl>"]
homepage = "https://github.com/NOLAI/libpep"
repository = "https://github.com/NOLAI/libpep"
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nolai/libpep-wasm",
"version": "0.11.1",
"version": "0.12.0",
"description": "Library for polymorphic encryption and pseudonymization (in WASM)",
"repository": {
"type": "git",
Expand Down
19 changes: 18 additions & 1 deletion src/lib/client/batch.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! Batch operations for encryption and decryption.

use crate::data::traits::{Encryptable, Encrypted};
use crate::data::traits::{BatchEncryptable, Encryptable, Encrypted};
use crate::transcryptor::batch::BatchError;
use rand_core::{CryptoRng, Rng};

Expand All @@ -17,6 +17,23 @@ pub fn encrypt_batch<M, R>(
public_key: &M::PublicKeyType,
rng: &mut R,
) -> Result<Vec<M::EncryptedType>, BatchError>
where
M: BatchEncryptable,
R: Rng + CryptoRng,
{
let preprocessed = M::preprocess_batch(messages)?;
Ok(preprocessed
.iter()
.map(|x| x.encrypt(public_key, rng))
.collect())
}

#[cfg(feature = "insecure")]
pub fn encrypt_batch_raw<M, R>(
messages: &[M],
public_key: &M::PublicKeyType,
rng: &mut R,
) -> Result<Vec<M::EncryptedType>, BatchError>
where
M: Encryptable,
R: Rng + CryptoRng,
Expand Down
3 changes: 2 additions & 1 deletion src/lib/client/functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ where
/// # Examples
/// ```rust,ignore
/// let pseudonym = decrypt(&encrypted_pseudonym, &pseudonym_key);
/// let attribute = decrypt(&encrypted_attribute, &attribute_key);
/// let attribute = decrypt(&encrypted_attribute,
/// &attribute_key);
/// ```
#[cfg(not(feature = "elgamal3"))]
pub fn decrypt<E>(encrypted: &E, secret_key: &E::SecretKeyType) -> E::UnencryptedType
Expand Down
Loading
Loading