Skip to content

Commit e8c344a

Browse files
authored
Misc tweaks (#13)
* - More docs in the `coconut-crypto`, especially for modules - Make `helpers` private in `coconut-crypto`, and move `OwnedPairs` and `Pairs` to `dock_crypto_utils` along with macros. - Make `SeqValidator` implementations more generic (these changes are fully backward-compatible though) * Minor improvements
1 parent 2c98ebc commit e8c344a

File tree

42 files changed

+148
-113
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+148
-113
lines changed

bbs_plus/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ digest.workspace = true
2020
rayon = {workspace = true, optional = true}
2121
itertools = "0.10.5"
2222
schnorr_pok = { version = "0.10.0", default-features = false, path = "../schnorr_pok" }
23-
dock_crypto_utils = { version = "0.10.0", default-features = false, path = "../utils" }
23+
dock_crypto_utils = { version = "0.11.0", default-features = false, path = "../utils" }
2424
serde.workspace = true
2525
serde_with.workspace = true
2626
zeroize.workspace = true

benches/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ serde.workspace = true
1818
serde_with.workspace = true
1919
blake2 = { version = "0.10", default-features = false }
2020
itertools = "0.10.5"
21-
coconut-crypto = { version = "0.1.0", default-features = false, path = "../coconut" }
21+
coconut-crypto = { version = "0.2.0", default-features = false, path = "../coconut" }
2222
dock_crypto_utils = { default-features = false, path = "../utils" }
2323
zeroize.workspace = true
2424

coconut/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
[package]
22
name = "coconut-crypto"
3-
version = "0.1.0"
3+
version = "0.2.0"
44
edition.workspace = true
55
authors.workspace = true
66
license.workspace = true
77
repository.workspace = true
8-
description = "Threshold anonymous credentials based on the paper [Security Analysis of Coconut, an Attribute-Based Credential Scheme with Threshold Issuance](https://eprint.iacr.org/2022/011)"
8+
description = "Threshold anonymous credentials based on the paper https://eprint.iacr.org/2022/011"
99

1010
[lib]
1111
path = "src/lib.rs"
@@ -22,7 +22,7 @@ itertools = "0.10.5"
2222
zeroize.workspace = true
2323
serde_with.workspace = true
2424
rayon = { workspace = true, optional = true }
25-
utils = { package = "dock_crypto_utils", version = "0.10.0", default-features = false, path = "../utils" }
25+
utils = { package = "dock_crypto_utils", version = "0.11.0", default-features = false, path = "../utils" }
2626
schnorr_pok = { version = "0.10.0", default-features = false, path = "../schnorr_pok" }
2727
secret_sharing_and_dkg = { version = "0.3.0", default-features = false, path = "../secret_sharing_and_dkg" }
2828

coconut/src/helpers/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//! Miscellaneous helpers and re-exports from `dock_crypto_utils`.
2+
13
use alloc::{format, string::String, vec::Vec};
24

35
use ark_ff::PrimeField;
@@ -9,20 +11,18 @@ use ark_std::{cfg_into_iter, cfg_iter};
911

1012
use schnorr_pok::error::SchnorrError;
1113

12-
pub mod owned_pairs;
13-
pub mod pairs;
1414
pub mod with_schnorr_and_blindings;
1515
pub mod with_schnorr_response;
1616

1717
pub use iter::*;
18-
pub use owned_pairs::*;
19-
pub use pairs::*;
2018
pub use try_iter::*;
2119
pub use utils::{
2220
aliases::*,
2321
extend_some::*,
2422
iter::{self, *},
2523
misc::*,
24+
owned_pairs::*,
25+
pairs::*,
2626
try_iter::{self, *},
2727
};
2828
pub use with_schnorr_and_blindings::*;

coconut/src/lib.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1+
//! Threshold anonymous credentials based on the paper [Security Analysis of Coconut, an Attribute-Based Credential Scheme with Threshold Issuance](https://eprint.iacr.org/2022/011).
2+
13
#![cfg_attr(not(feature = "std"), no_std)]
24

35
extern crate alloc;
46

5-
pub mod helpers;
6-
pub mod macros;
7+
mod helpers;
78
pub mod proof;
89
pub mod setup;
910
pub mod signature;
@@ -12,4 +13,5 @@ pub mod signature;
1213
mod tests;
1314

1415
pub use proof::*;
16+
pub use setup::{keygen, PublicKey, SecretKey};
1517
pub use signature::*;

coconut/src/macros.rs

Lines changed: 0 additions & 35 deletions
This file was deleted.

coconut/src/proof/messages_pok/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ use utils::join;
1515
use super::UnpackedBlindedMessages;
1616
use crate::{
1717
helpers::{schnorr_error, DoubleEndedExactSizeIterator, WithSchnorrAndBlindings},
18-
pairs,
1918
setup::SignatureParams,
2019
signature::message_commitment::MessageCommitmentRandomness,
2120
CommitMessage,
2221
};
22+
use utils::pairs;
2323

2424
pub mod error;
2525
pub mod multi_message_commitment;

coconut/src/proof/messages_pok/multi_message_commitment.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,15 @@ use crate::{
1919
/// `g * o + \sum_{i}(h_{i} * m_{i})`
2020
#[serde_as]
2121
#[derive(
22-
Clone, Debug, PartialEq, Eq, CanonicalSerialize, CanonicalDeserialize, Serialize, Deserialize,
22+
Clone,
23+
Copy,
24+
Debug,
25+
PartialEq,
26+
Eq,
27+
CanonicalSerialize,
28+
CanonicalDeserialize,
29+
Serialize,
30+
Deserialize,
2331
)]
2432
pub struct MultiMessageCommitment<E: Pairing>(#[serde_as(as = "ArkObjectBytes")] E::G1Affine);
2533
utils::impl_deref! { MultiMessageCommitment<E: Pairing>(E::G1Affine) }

coconut/src/proof/messages_pok/witnesses.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,8 @@ use alloc::vec::Vec;
33
use ark_ec::pairing::Pairing;
44
use ark_std::rand::RngCore;
55

6-
use crate::{
7-
helpers::{n_rand, rand, OwnedPairs},
8-
owned_pairs,
9-
};
6+
use crate::helpers::{n_rand, rand, OwnedPairs};
7+
use utils::owned_pairs;
108

119
/// Witnesses for `MessagesPoK`.
1210
#[derive(Clone, Debug, PartialEq, Eq)]

coconut/src/proof/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
//! Proofs of knowledge for the signature and messages.
2+
23
use alloc::vec::Vec;
34

45
pub mod messages_pok;

0 commit comments

Comments
 (0)