lit_node_core/models/
resource_ability.rs

1use super::{LitAbility, ResourceType};
2
3/// A `LitResourceAbility` specifies a LIT-specific ability that
4/// is requested to be performed on a resource.
5///
6/// Since this struct can only be created from a LIT-specific resource
7/// (eg. `AccessControlConditionResource` or `PKPNFTResource`) it is
8/// guaranteed that the ability is compatible with the resource. For example,
9/// a `PKPNFTResource` can only be used for signing, and an `AccessControlConditionResource`
10/// can only be used for decryption or signing.
11///
12/// For example, to create a `LitResourceAbility` for a `PKPNFTResource` that
13/// can be used for signing:
14/// ```
15/// let resource = super::PKPNFTResource::new("123".to_string());
16/// let resource_ability = resource.sign_ability();
17/// ```
18#[derive(Debug, Clone)]
19pub struct LitResourceAbility {
20    pub(crate) resource: ResourceType,
21    pub(crate) ability: LitAbility,
22}
23
24impl LitResourceAbility {
25    pub fn get_resource(&self) -> &ResourceType {
26        &self.resource
27    }
28
29    pub fn get_ability(&self) -> &LitAbility {
30        &self.ability
31    }
32}