dpp/identity/identity_public_key/accessors/v0/
mod.rs

1use crate::identity::contract_bounds::ContractBounds;
2use crate::identity::identity_public_key::KeyID;
3use crate::identity::KeyType;
4use crate::identity::Purpose;
5use crate::identity::SecurityLevel;
6use crate::identity::TimestampMillis;
7use platform_value::BinaryData;
8
9/// Trait for getters in IdentityPublicKeyV0
10pub trait IdentityPublicKeyGettersV0 {
11    /// Returns the KeyID
12    fn id(&self) -> KeyID;
13
14    /// Returns the Purpose
15    fn purpose(&self) -> Purpose;
16
17    /// Returns the SecurityLevel
18    fn security_level(&self) -> SecurityLevel;
19
20    /// Returns the KeyType
21    fn key_type(&self) -> KeyType;
22
23    /// Returns the read_only flag
24    fn read_only(&self) -> bool;
25
26    /// Returns the data as BinaryData
27    fn data(&self) -> &BinaryData;
28
29    /// Returns the data as BinaryData
30    fn data_owned(self) -> BinaryData;
31
32    /// Returns the disabled_at timestamp as Option
33    fn disabled_at(&self) -> Option<TimestampMillis>;
34
35    /// Is public key disabled
36    fn is_disabled(&self) -> bool;
37
38    /// Contract bounds
39    fn contract_bounds(&self) -> Option<&ContractBounds>;
40}
41
42/// Trait for setters in IdentityPublicKeyV0
43pub trait IdentityPublicKeySettersV0 {
44    /// Sets the KeyID
45    fn set_id(&mut self, id: KeyID);
46
47    /// Sets the Purpose
48    fn set_purpose(&mut self, purpose: Purpose);
49
50    /// Sets the SecurityLevel
51    fn set_security_level(&mut self, security_level: SecurityLevel);
52
53    /// Sets the KeyType
54    fn set_key_type(&mut self, key_type: KeyType);
55
56    /// Sets the read_only flag
57    fn set_read_only(&mut self, read_only: bool);
58
59    /// Sets the data as BinaryData
60    fn set_data(&mut self, data: BinaryData);
61
62    /// Sets the disabled_at timestamp
63    fn set_disabled_at(&mut self, timestamp_millis: u64);
64    fn remove_disabled_at(&mut self);
65}