silent_payments_core/lib.rs
1//! # silent-payments-core
2//!
3//! Core primitives for [BIP 352](https://github.com/bitcoin/bips/blob/master/bip-0352.mediawiki)
4//! Silent Payments: error types, key newtypes with zeroization, address
5//! encoding, input classification, and cryptographic safety wrappers.
6//!
7//! This crate provides type-safe wrappers around `bdk-sp` with explicit
8//! error handling, zeroized secret key storage, and SEC-04 compliance
9//! (all EC operations via `bitcoin::secp256k1`).
10//!
11//! ## Main types
12//!
13//! - [`SpAddress`] -- BIP 352 Silent Payment address (parse, encode, construct)
14//! - [`ScanPublicKey`] / [`ScanSecretKey`] -- receiver's scan key pair
15//! - [`SpendPublicKey`] / [`SpendSecretKey`] -- receiver's spend key pair
16//! - [`ClassifiedInput`] / [`SpInputType`] -- transaction input classification
17//! - [`compute_shared_secret`], [`compute_output_pubkey`] -- ECDH and output derivation
18
19pub mod address;
20pub mod crypto;
21pub mod error;
22pub mod input;
23pub mod keys;
24
25pub use address::SpAddress;
26pub use crypto::{
27 compute_input_hash, compute_output_pubkey, compute_shared_secret, get_label_tweak,
28};
29pub use error::{AddressError, CryptoError, InputError};
30pub use input::{classify_input, collect_eligible_inputs, ClassifiedInput, SpInputType};
31pub use keys::{ScanPublicKey, ScanSecretKey, SpendPublicKey, SpendSecretKey};
32
33/// Common types and traits for convenient glob imports.
34///
35/// ```
36/// use silent_payments_core::prelude::*;
37/// ```
38pub mod prelude {
39 pub use crate::address::SpAddress;
40 pub use crate::crypto::{
41 compute_input_hash, compute_output_pubkey, compute_shared_secret, get_label_tweak,
42 };
43 pub use crate::error::{AddressError, CryptoError, InputError};
44 pub use crate::input::{classify_input, collect_eligible_inputs, ClassifiedInput, SpInputType};
45 pub use crate::keys::{ScanPublicKey, ScanSecretKey, SpendPublicKey, SpendSecretKey};
46}