etopay_sdk/types/
users.rs1use super::{
2 newtypes::{EncryptedPassword, EncryptionSalt},
3 transactions::WalletTxInfo,
4};
5use crate::{
6 types::viviswap::ViviswapState,
7 wallet_manager::{WalletManager, WalletManagerImpl},
8};
9use serde::{Deserialize, Serialize};
10
11#[derive(Debug, Deserialize, Serialize, Clone)]
13#[cfg_attr(test, derive(PartialEq))]
14pub struct UserEntity {
15 pub user_id: Option<String>,
17 pub username: String,
19 pub encrypted_password: Option<EncryptedPassword>,
21 pub salt: EncryptionSalt,
23 pub is_kyc_verified: bool,
25 pub kyc_type: KycType,
27 pub viviswap_state: Option<ViviswapState>,
29
30 pub local_share: Option<String>,
32
33 pub wallet_transactions: Vec<WalletTxInfo>,
35}
36
37#[derive(Debug)]
39pub struct ActiveUser {
40 pub username: String,
42
43 pub wallet_manager: Box<dyn WalletManager + Send + Sync + 'static>,
45}
46
47impl From<UserEntity> for ActiveUser {
48 fn from(entity: UserEntity) -> Self {
49 ActiveUser {
50 wallet_manager: Box::new(WalletManagerImpl::new(&entity.username)),
51 username: entity.username,
52 }
53 }
54}
55
56#[derive(Debug, Eq, PartialEq, Deserialize, Serialize, Clone)]
58pub enum KycType {
59 Undefined,
61
62 #[cfg(feature = "postident")]
64 Postident,
65
66 #[cfg(feature = "viviswap-kyc")]
68 Viviswap,
69}