dpp/identity/identity_public_key/accessors/
mod.rs

1use crate::identity::contract_bounds::ContractBounds;
2use crate::identity::identity_public_key::accessors::v0::{
3    IdentityPublicKeyGettersV0, IdentityPublicKeySettersV0,
4};
5use crate::identity::KeyType;
6use crate::identity::Purpose;
7use crate::identity::SecurityLevel;
8use crate::identity::{IdentityPublicKey, KeyID, TimestampMillis};
9use platform_value::BinaryData;
10
11pub mod v0;
12
13impl IdentityPublicKeyGettersV0 for IdentityPublicKey {
14    fn id(&self) -> KeyID {
15        match self {
16            IdentityPublicKey::V0(v0) => v0.id(),
17        }
18    }
19
20    fn purpose(&self) -> Purpose {
21        match self {
22            IdentityPublicKey::V0(v0) => v0.purpose(),
23        }
24    }
25
26    fn security_level(&self) -> SecurityLevel {
27        match self {
28            IdentityPublicKey::V0(v0) => v0.security_level(),
29        }
30    }
31
32    fn key_type(&self) -> KeyType {
33        match self {
34            IdentityPublicKey::V0(v0) => v0.key_type(),
35        }
36    }
37
38    fn read_only(&self) -> bool {
39        match self {
40            IdentityPublicKey::V0(v0) => v0.read_only(),
41        }
42    }
43
44    fn data(&self) -> &BinaryData {
45        match self {
46            IdentityPublicKey::V0(v0) => v0.data(),
47        }
48    }
49
50    fn data_owned(self) -> BinaryData {
51        match self {
52            IdentityPublicKey::V0(v0) => v0.data_owned(),
53        }
54    }
55
56    fn disabled_at(&self) -> Option<TimestampMillis> {
57        match self {
58            IdentityPublicKey::V0(v0) => v0.disabled_at(),
59        }
60    }
61
62    fn is_disabled(&self) -> bool {
63        match self {
64            IdentityPublicKey::V0(v0) => v0.is_disabled(),
65        }
66    }
67
68    fn contract_bounds(&self) -> Option<&ContractBounds> {
69        match self {
70            IdentityPublicKey::V0(v0) => v0.contract_bounds(),
71        }
72    }
73}
74
75impl IdentityPublicKeySettersV0 for IdentityPublicKey {
76    fn set_id(&mut self, id: KeyID) {
77        match self {
78            IdentityPublicKey::V0(v0) => {
79                v0.set_id(id);
80            }
81        }
82    }
83
84    fn set_purpose(&mut self, purpose: Purpose) {
85        match self {
86            IdentityPublicKey::V0(v0) => {
87                v0.set_purpose(purpose);
88            }
89        }
90    }
91
92    fn set_security_level(&mut self, security_level: SecurityLevel) {
93        match self {
94            IdentityPublicKey::V0(v0) => {
95                v0.set_security_level(security_level);
96            }
97        }
98    }
99
100    fn set_key_type(&mut self, key_type: KeyType) {
101        match self {
102            IdentityPublicKey::V0(v0) => {
103                v0.set_key_type(key_type);
104            }
105        }
106    }
107
108    fn set_read_only(&mut self, read_only: bool) {
109        match self {
110            IdentityPublicKey::V0(v0) => {
111                v0.set_read_only(read_only);
112            }
113        }
114    }
115
116    fn set_data(&mut self, data: BinaryData) {
117        match self {
118            IdentityPublicKey::V0(v0) => {
119                v0.set_data(data);
120            }
121        }
122    }
123
124    fn set_disabled_at(&mut self, timestamp_millis: u64) {
125        match self {
126            IdentityPublicKey::V0(v0) => {
127                v0.set_disabled_at(timestamp_millis);
128            }
129        }
130    }
131
132    fn remove_disabled_at(&mut self) {
133        match self {
134            IdentityPublicKey::V0(v0) => {
135                v0.remove_disabled_at();
136            }
137        }
138    }
139}