Skip to main content

derive_notification_keys

Function derive_notification_keys 

Source
pub fn derive_notification_keys(
    shared_secret: &[u8; 32],
    publisher_pub: &[u8; 32],
    subscriber_pub: &[u8; 32],
) -> EnvelopeResult<NotificationKeys>
Expand description

Derive notification keys (enc_key and mac_key) from DH shared secret.

Uses the crypto backend (Blake3 or HKDF-SHA256) with:

  • IKM: shared_secret || salt (where salt = XOR of publisher_pub and subscriber_pub)
  • Context: notification-specific domain separation strings

§Arguments

  • shared_secret - 32-byte DH shared secret
  • publisher_pub - Publisher’s ephemeral Ristretto public key (32 bytes)
  • subscriber_pub - Subscriber’s (possibly blinded) Ristretto public key (32 bytes)

§Errors

Returns EnvelopeError::KeyExchange if publisher and subscriber keys are identical.