newton-core 0.4.16

newton protocol core sdk
//! Confidential-namespace key builders.
//!
//! Re-exports typed constructors from [`newton_state_tree::NamespaceKey`].
//! See `docs/PRIVATE_DATA_STORAGE.md` § 5.2 for the encoding schema.

use alloy::primitives::{Address, B256};
pub use newton_state_tree::NamespaceKey;

/// Build a confidential-namespace data key for one `(provider, domain_id, data_ref_id)` tuple.
#[inline]
pub fn confidential_data(provider: Address, domain_id: B256, data_ref_id: B256) -> NamespaceKey {
    NamespaceKey::confidential_data(provider, domain_id, data_ref_id)
}

/// Build a confidential-namespace grant key for one `(provider, policy_client, domain_id)` tuple.
///
/// Grants are domain-scoped: one grant authorizes the policy client to read every record
/// under the named domain from this provider (see spec § 5.2).
#[inline]
pub fn confidential_grant(provider: Address, policy_client: Address, domain_id: B256) -> NamespaceKey {
    NamespaceKey::confidential_grant(provider, policy_client, domain_id)
}