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