Skip to main content

shielded_contact_index

Function shielded_contact_index 

Source
pub fn shielded_contact_index(
    index_key: &[u8; 32],
    owner_id: &[u8; 32],
    to_user_id: &[u8; 32],
    account_reference: u64,
) -> [u8; 11]
Expand description

The diversifier index of the shielded address a contact request carries, from the request’s unique key:

t = HMAC-SHA256(key = index_key,
                msg = "DashPay/shielded/contact-index/v1" || owner_id || to_user_id
                      || account_reference as u64 little-endian)
j = t[0..11], with bit 87 set

owner_id is the identity that sends the request and owns the address, to_user_id the contact, and account_reference the value the request publishes, never one recomputed locally. The index always lies in the per-contact range, from 2^87.

Before sending, the caller compares the index with those it has given to other contacts and, on a match, sends the request under another account_reference.