1#[cfg(target_family = "wasm")]
2use wasm_bindgen::prelude::*;
3
4#[derive(Debug, Clone, derive_more::From, derive_more::Into)]
5#[cfg_attr(target_family = "wasm", wasm_bindgen, derive(serde::Serialize, serde::Deserialize))]
6pub struct NewCrlDistributionPoints(Option<Vec<String>>);
7
8#[cfg(not(target_family = "wasm"))]
9uniffi::custom_newtype!(NewCrlDistributionPoints, Option<Vec<String>>);
10
11#[cfg(target_family = "wasm")]
12#[wasm_bindgen]
13impl NewCrlDistributionPoints {
14 pub fn as_strings(&self) -> Option<Vec<String>> {
15 self.0.as_ref().map(|p| p.iter().map(Clone::clone).collect())
16 }
17}
18
19impl From<core_crypto::e2e_identity::NewCrlDistributionPoints> for NewCrlDistributionPoints {
20 fn from(value: core_crypto::e2e_identity::NewCrlDistributionPoints) -> Self {
21 let value = value.into_iter().collect::<Vec<_>>();
22 let value = (!value.is_empty()).then_some(value);
23 Self(value)
24 }
25}
26
27#[derive(Debug, Clone, Copy, PartialEq, Eq)]
28#[cfg_attr(target_family = "wasm", wasm_bindgen, derive(serde::Serialize, serde::Deserialize))]
29#[cfg_attr(not(target_family = "wasm"), derive(uniffi::Record))]
30pub struct CrlRegistration {
32 pub dirty: bool,
34 pub expiration: Option<u64>,
36}
37
38impl From<core_crypto::e2e_identity::CrlRegistration> for CrlRegistration {
39 fn from(value: core_crypto::e2e_identity::CrlRegistration) -> Self {
40 Self {
41 dirty: value.dirty,
42 expiration: value.expiration,
43 }
44 }
45}
46
47#[cfg(target_family = "wasm")]
48#[wasm_bindgen]
49impl CrlRegistration {
50 #[wasm_bindgen(constructor)]
51 pub fn new(dirty: bool, expiration: Option<u64>) -> Self {
52 Self { dirty, expiration }
53 }
54}