electron_sys/interface/
certificate_principal.rs

1use js_sys::JsString;
2use wasm_bindgen::prelude::*;
3
4#[wasm_bindgen]
5#[derive(Clone, Debug, PartialEq)]
6pub struct CertificatePrincipal {
7    common_name: JsString,
8    country: JsString,
9    locality: JsString,
10    organization_units: Box<[JsValue]>,
11    organizations: Box<[JsValue]>,
12    state: JsString,
13}
14
15#[wasm_bindgen]
16impl CertificatePrincipal {
17    #[wasm_bindgen(constructor)]
18    pub fn new(
19        common_name: JsString,
20        country: JsString,
21        locality: JsString,
22        organization_units: Box<[JsValue]>,
23        organizations: Box<[JsValue]>,
24        state: JsString,
25    ) -> CertificatePrincipal {
26        CertificatePrincipal {
27            common_name,
28            country,
29            locality,
30            organization_units,
31            organizations,
32            state,
33        }
34    }
35
36    #[wasm_bindgen(getter, js_name = "commonName")]
37    pub fn common_name(&self) -> JsString {
38        self.common_name.clone()
39    }
40
41    #[wasm_bindgen(setter)]
42    pub fn set_common_name(&mut self, value: JsString) {
43        self.common_name = value;
44    }
45
46    #[wasm_bindgen(getter)]
47    pub fn country(&self) -> JsString {
48        self.country.clone()
49    }
50
51    #[wasm_bindgen(setter)]
52    pub fn set_country(&mut self, value: JsString) {
53        self.country = value;
54    }
55
56    #[wasm_bindgen(getter)]
57    pub fn locality(&self) -> JsString {
58        self.locality.clone()
59    }
60
61    #[wasm_bindgen(setter)]
62    pub fn set_locality(&mut self, value: JsString) {
63        self.locality = value;
64    }
65
66    #[wasm_bindgen(getter, js_name = "organizationUnits")]
67    pub fn organization_units(&self) -> Box<[JsValue]> {
68        self.organization_units.clone()
69    }
70
71    #[wasm_bindgen(setter)]
72    pub fn set_organization_units(&mut self, value: Box<[JsValue]>) {
73        self.organization_units = value;
74    }
75
76    #[wasm_bindgen(getter)]
77    pub fn organizations(&self) -> Box<[JsValue]> {
78        self.organizations.clone()
79    }
80
81    #[wasm_bindgen(setter)]
82    pub fn set_organizations(&mut self, value: Box<[JsValue]>) {
83        self.organizations = value;
84    }
85
86    #[wasm_bindgen(getter)]
87    pub fn state(&self) -> JsString {
88        self.state.clone()
89    }
90
91    #[wasm_bindgen(setter)]
92    pub fn set_state(&mut self, value: JsString) {
93        self.state = value;
94    }
95}