Module bbs_plus

Module bbs_plus 

Source
Expand description

BBS+ Signatures for selective disclosure and privacy-preserving credentials.

BBS+ is a pairing-based signature scheme that allows signing multiple messages at once and later creating zero-knowledge proofs that selectively disclose some of the signed messages while keeping others hidden.

§Features

  • Multi-message signing (sign N attributes simultaneously)
  • Selective disclosure (reveal only M < N attributes)
  • Zero-knowledge proof of signature validity
  • Unlinkable presentations (different proofs are unlinkable)
  • Perfect for privacy-preserving credentials

§Use Cases in CHIE Protocol

  • Creator credentials with selective attribute disclosure
  • Privacy-preserving bandwidth credits (reveal amount but not identity)
  • Anonymous content access with verifiable permissions
  • Selective disclosure of reputation scores

§Example

use chie_crypto::bbs_plus::{BbsPlusKeypair, sign_messages, create_proof, verify_proof};

// Setup
let keypair = BbsPlusKeypair::generate(5); // Support for 5 messages
let messages = vec![
    b"user_id: alice".to_vec(),
    b"role: premium".to_vec(),
    b"credit: 1000".to_vec(),
    b"expiry: 2026-12".to_vec(),
    b"tier: gold".to_vec(),
];

// Sign all messages
let signature = sign_messages(&keypair.secret_key(), &messages).unwrap();

// Create a proof that reveals only messages at indices 1 and 2 (role and credit)
let revealed_indices = vec![1, 2];
let proof = create_proof(
    &keypair.public_key(),
    &signature,
    &messages,
    &revealed_indices,
    b"presentation-context",
).unwrap();

// Verifier checks the proof (only sees revealed messages)
let revealed_messages: Vec<Vec<u8>> = revealed_indices.iter()
    .map(|&i| messages[i].clone())
    .collect();
assert!(verify_proof(
    &keypair.public_key(),
    &proof,
    &revealed_indices,
    &revealed_messages,
    b"presentation-context",
).unwrap());

Structs§

BbsPlusKeypair
BBS+ keypair containing both secret and public keys.
BbsPlusProof
Proof of knowledge for selective disclosure.
BbsPlusPublicKey
BBS+ public key for verification.
BbsPlusSecretKey
BBS+ secret key for signing.
BbsPlusSignature
BBS+ signature on multiple messages.

Enums§

BbsPlusError
Errors that can occur in BBS+ operations.

Functions§

create_proof
Create a selective disclosure proof revealing only specified message indices.
sign_messages
Sign multiple messages using BBS+ signature scheme.
verify_proof
Verify a selective disclosure proof.
verify_signature
Verify a BBS+ signature on multiple messages.

Type Aliases§

BbsPlusResult