//! # Synor Privacy Layer
//!
//! This crate provides cryptographic primitives for privacy-preserving transactions
//! on the Synor blockchain.
//!
//! ## Features
//!
//! - **Pedersen Commitments**: Cryptographic commitments that hide values while
//!   allowing homomorphic addition (for balance verification)
//!
//! - **Bulletproofs Range Proofs**: Zero-knowledge proofs that a committed value
//!   lies within a valid range (e.g., 0 to 2^64 - 1) without revealing the value
//!
//! - **Stealth Addresses**: One-time addresses derived from a recipient's public
//!   key, making transactions unlinkable on the blockchain
//!
//! - **Ring Signatures**: Allow signing on behalf of a group (ring) without
//!   revealing which member actually signed
//!
//! ## Architecture
//!
//! ```text
//! ┌─────────────────────────────────────────────────────────────┐
//! │                    Confidential Transaction                  │
//! │  ┌─────────────┐  ┌─────────────┐  ┌─────────────────────┐ │
//! │  │   Inputs    │  │   Outputs   │  │      Proofs         │ │
//! │  │ (Ring Sigs) │  │  (Stealth)  │  │   (Bulletproofs)    │ │
//! │  └──────┬──────┘  └──────┬──────┘  └──────────┬──────────┘ │
//! │         │                │                    │            │
//! │         ▼                ▼                    ▼            │
//! │  ┌─────────────────────────────────────────────────────┐   │
//! │  │              Pedersen Commitments                    │   │
//! │  │           C = g^value * h^blinding                   │   │
//! │  └─────────────────────────────────────────────────────┘   │
//! └─────────────────────────────────────────────────────────────┘
//! ```
//!
//! ## Example
//!
//! ```rust,ignore
//! use synor_privacy::{
//!     pedersen::PedersenCommitment,
//!     bulletproofs::RangeProof,
//!     stealth::StealthAddress,
//!     ring::RingSignature,
//! };
//!
//! // Create a commitment to hide a value
//! let (commitment, blinding) = PedersenCommitment::commit(1000);
//!
//! // Prove the value is in valid range
//! let proof = RangeProof::prove(&commitment, 1000, &blinding);
//!
//! // Generate a stealth address for the recipient
//! let stealth = StealthAddress::generate(&recipient_public_key);
//! ```

#![cfg_attr(not(feature = "std"), no_std)]

extern crate alloc;

pub mod pedersen;
pub mod bulletproofs;
pub mod stealth;
pub mod ring;
pub mod confidential;
pub mod error;

pub use error::{Error, Result};

// Re-export main types
pub use pedersen::{PedersenCommitment, BlindingFactor};
pub use bulletproofs::RangeProof;
pub use stealth::{StealthAddress, StealthKeyPair, ViewKey, SpendKey};
pub use ring::{RingSignature, KeyImage};
pub use confidential::{ConfidentialTransaction, ConfidentialInput, ConfidentialOutput};

/// Domain separator for Synor privacy operations
pub const DOMAIN_SEPARATOR: &[u8] = b"SYNOR_PRIVACY_v1";

/// Maximum value that can be committed (2^64 - 1)
pub const MAX_VALUE: u64 = u64::MAX;

/// Number of bits in range proofs
pub const RANGE_PROOF_BITS: usize = 64;

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn test_domain_separator() {
        assert_eq!(DOMAIN_SEPARATOR, b"SYNOR_PRIVACY_v1");
    }
}
