pub struct LabelManager { /* private fields */ }Expand description
Manages labeled Silent Payment addresses with O(1) per-output lookup.
BIP 352 labels allow a receiver to generate multiple addresses from a
single scan/spend key pair. Each label index m produces a distinct
address with a deterministic tweak.
Internally stores HashMap<PublicKey, (Scalar, u32)> where:
- Key:
label_scalar * G(the label public key) - Value:
(label_scalar, label_index_m)
Implementations§
Source§impl LabelManager
impl LabelManager
Sourcepub fn new() -> LabelManager
pub fn new() -> LabelManager
Create an empty label manager.
Sourcepub fn add_label(
&mut self,
scan_secret: &ScanSecretKey,
_spend_pubkey: &SpendPublicKey,
m: u32,
secp: &Secp256k1<All>,
) -> Result<(), CryptoError>
pub fn add_label( &mut self, scan_secret: &ScanSecretKey, _spend_pubkey: &SpendPublicKey, m: u32, secp: &Secp256k1<All>, ) -> Result<(), CryptoError>
Register a label index m for scanning.
Computes the label tweak scalar via BIP0352/Label(b_scan || m),
then derives the label public key (label_scalar * G) and stores
it for O(1) lookup during output scanning.
§Errors
Returns CryptoError if the label tweak produces an invalid
secret key (computationally unreachable).
Trait Implementations§
Source§impl Clone for LabelManager
impl Clone for LabelManager
Source§fn clone(&self) -> LabelManager
fn clone(&self) -> LabelManager
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for LabelManager
impl Debug for LabelManager
Source§impl Default for LabelManager
impl Default for LabelManager
Source§fn default() -> LabelManager
fn default() -> LabelManager
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for LabelManager
impl RefUnwindSafe for LabelManager
impl Send for LabelManager
impl Sync for LabelManager
impl Unpin for LabelManager
impl UnsafeUnpin for LabelManager
impl UnwindSafe for LabelManager
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more