Skip to main content

coldstar_signer/
lib.rs

1//! Coldstar Secure Signer
2//!
3//! Memory-safe cryptographic signing with locked memory pages.
4//! Merged from the original coldstar-rs crate and devsyrem's secure_signer.
5//!
6//! - AES-256-GCM symmetric encryption
7//! - Argon2id key derivation
8//! - Ed25519 signing (Solana)
9//! - secp256k1 ECDSA signing (Base/EVM)
10//! - mlock'd secure buffers with auto-zeroize on drop
11//! - ZK proofs: ElGamal, ownership, range, equality, validity proofs
12
13pub mod crypto;
14pub mod error;
15pub mod secure_buffer;
16pub mod zk_proofs;
17
18// Re-exports from crypto (coldstar-rs original API)
19pub use crypto::{
20    decrypt_keypair, encrypt_keypair, sign_ed25519, sign_secp256k1, EncryptedContainer,
21};
22
23// Re-exports from crypto (devsyrem full pipeline API)
24pub use crypto::{
25    create_encrypted_key_container, decrypt_and_sign, sign_transaction, EncryptedKeyContainer,
26    SigningResult,
27};
28
29// Re-exports from error
30pub use error::SignerError;
31
32// Re-exports from secure_buffer
33pub use secure_buffer::{LockingMode, SecureBuffer, SecureGuard};
34
35// Re-exports from zk_proofs
36pub use zk_proofs::{
37    ConfidentialTransferProofBundle, ElGamalCiphertext, ElGamalKeypair, EqualityProof,
38    OwnershipProof, PedersenCommitment, RangeProof, ValidityProof,
39};
40
41/// Library version
42pub const VERSION: &str = env!("CARGO_PKG_VERSION");
43
44/// Convenience prelude for common imports
45pub mod prelude {
46    pub use crate::crypto::{
47        create_encrypted_key_container, decrypt_and_sign, decrypt_keypair, encrypt_keypair,
48        sign_ed25519, sign_secp256k1, sign_transaction, EncryptedContainer,
49        EncryptedKeyContainer, SigningResult,
50    };
51    pub use crate::error::SignerError;
52    pub use crate::secure_buffer::{LockingMode, SecureBuffer};
53    pub use crate::zk_proofs::{
54        ConfidentialTransferProofBundle, ElGamalCiphertext, ElGamalKeypair, OwnershipProof,
55    };
56}
57
58#[cfg(test)]
59mod tests {
60    use super::*;
61
62    #[test]
63    fn test_version() {
64        assert!(!VERSION.is_empty());
65    }
66}