pub struct PaykitAppRegistry { /* private fields */ }Expand description
Public registry shared by every application using one Paykit identity.
Implementations§
Source§impl PaykitAppRegistry
impl PaykitAppRegistry
Sourcepub fn new(noise_public_key: Option<PublicKey>) -> Self
pub fn new(noise_public_key: Option<PublicKey>) -> Self
Create an empty registry with an optional identity-wide Noise public key.
Public-only identities can publish applications and Payment Endpoints before a private-capable application initializes the Noise key.
Sourcepub fn key_generation(&self) -> u64
pub fn key_generation(&self) -> u64
Return the advertised generation; verify the signed Noise key authorization before use.
Sourcepub fn noise_public_key(&self) -> Option<&PublicKey>
pub fn noise_public_key(&self) -> Option<&PublicKey>
Return the advertised Noise public key, when initialized. This is discovery metadata, not identity-signed authorization.
Sourcepub fn set_noise_public_key(
&mut self,
noise_public_key: PublicKey,
key_generation: u64,
) -> Result<()>
pub fn set_noise_public_key( &mut self, noise_public_key: PublicKey, key_generation: u64, ) -> Result<()>
Initialize or verify the identity-wide Noise public key and its generation.
Sourcepub fn rotate_noise_public_key(
&mut self,
noise_public_key: PublicKey,
key_generation: u64,
) -> Result<()>
pub fn rotate_noise_public_key( &mut self, noise_public_key: PublicKey, key_generation: u64, ) -> Result<()>
Rotate the identity-wide Noise public key to the next key generation.
Sourcepub fn apps(&self) -> &HashMap<PaykitAppId, PaykitApp>
pub fn apps(&self) -> &HashMap<PaykitAppId, PaykitApp>
Return all registered applications keyed by App ID.
Sourcepub fn default_app_id(&self) -> Option<&PaykitAppId>
pub fn default_app_id(&self) -> Option<&PaykitAppId>
Return the identity-wide default App ID.
Sourcepub fn default_apps_by_endpoint(
&self,
) -> &HashMap<PaymentEndpointIdentifier, PaykitAppId>
pub fn default_apps_by_endpoint( &self, ) -> &HashMap<PaymentEndpointIdentifier, PaykitAppId>
Return per-endpoint default applications.
Sourcepub fn preferred_app_for_endpoint(
&self,
identifier: &PaymentEndpointIdentifier,
) -> Option<&PaykitAppId>
pub fn preferred_app_for_endpoint( &self, identifier: &PaymentEndpointIdentifier, ) -> Option<&PaykitAppId>
Return the preferred application for one Payment Endpoint Identifier.
An endpoint-specific default takes precedence over the identity-wide default application.
Sourcepub fn register_app(
&mut self,
app_id: PaykitAppId,
app: PaykitApp,
) -> Result<()>
pub fn register_app( &mut self, app_id: PaykitAppId, app: PaykitApp, ) -> Result<()>
Add or replace one application registration.
Sourcepub fn remove_app(&mut self, app_id: &PaykitAppId) -> Option<PaykitApp>
pub fn remove_app(&mut self, app_id: &PaykitAppId) -> Option<PaykitApp>
Remove an application and defaults that refer to it.
Sourcepub fn set_default_app(&mut self, app_id: Option<PaykitAppId>) -> Result<()>
pub fn set_default_app(&mut self, app_id: Option<PaykitAppId>) -> Result<()>
Set or clear the identity-wide default application.
Sourcepub fn set_default_app_for_endpoint(
&mut self,
identifier: PaymentEndpointIdentifier,
app_id: PaykitAppId,
) -> Result<()>
pub fn set_default_app_for_endpoint( &mut self, identifier: PaymentEndpointIdentifier, app_id: PaykitAppId, ) -> Result<()>
Set the default application for one Payment Endpoint Identifier.
Sourcepub fn clear_default_app_for_endpoint(
&mut self,
identifier: &PaymentEndpointIdentifier,
) -> Option<PaykitAppId>
pub fn clear_default_app_for_endpoint( &mut self, identifier: &PaymentEndpointIdentifier, ) -> Option<PaykitAppId>
Clear the default application for one Payment Endpoint Identifier.