Diff
checker
टेक्स्ट
टेक्स्ट
छवियां
दस्तावेज़
Excel
फ़ोल्डर्स
Legal
Enterprise
डेस्कटॉप
मूल्य
साइन इन करें
Diffchecker डेस्कटॉप डाउनलोड करें
टेक्स्ट की तुलना करें
दो टेक्स्ट फ़ाइलों के बीच अंतर ढूंढें
उपकरण
इतिहास
रियल-टाइम एडिटर
अपरिवर्तित संक्षिप्त करें
लाइन रैप बंद
लेआउट
विभाजित
संयुक्त
परिवर्तन हाइलाइट करें
स्मार्ट
शब्द
अक्षर
सिंटैक्स हाइलाइटिंग
सिंटैक्स चुनें
अनदेखा करें
टेक्स्ट बदलें
पहले अंतर पर जाएँ
इनपुट संपादित करें
Diffchecker Desktop
Diffchecker चलाने का सबसे सुरक्षित तरीका। Diffchecker Desktop ऐप पाएं: आपके diffs कभी आपके कंप्यूटर से बाहर नहीं जाते!
Desktop पाएं
Untitled diff
बनाया गया
7 वर्ष पहले
Diff कभी समाप्त नहीं होता
साफ़
निर्यात करें
शेयर करें
समझाएं
82 हटाए गए
लाइनें
कुल
हटाया गया
अक्षर
कुल
हटाया गया
इस सुविधा का उपयोग जारी रखने के लिए, अपग्रेड करें
Diff
checker
Pro
मूल्य देखें
118 लाइनें
सभी को कॉपी करें
33 जोड़े गए
लाइनें
कुल
जोड़ा गया
अक्षर
कुल
जोड़ा गया
इस सुविधा का उपयोग जारी रखने के लिए, अपग्रेड करें
Diff
checker
Pro
मूल्य देखें
60 लाइनें
सभी को कॉपी करें
pub enum WalletCommand {
pub enum WalletCommand {
Open(Config, // config
Open(Config, // config
Credentials, // credentials
Credentials, // credentials
Box<dyn Fn(IndyResult<WalletHandle>) + Send>),
Box<dyn Fn(IndyResult<WalletHandle>) + Send>),
कॉपी
कॉपी हुआ
कॉपी
कॉपी हुआ
OpenContinue(WalletHandle,
DeriveKeyResult<(MasterKey, Option<MasterKey>)>, // derive_key_result
),
DeriveKey(KeyDerivationData,
Box<dyn Fn(DeriveKeyResult<MasterKey>) + Send>),
}
macro_rules! get_cb {
($self_:ident, $e:expr) => (match $self_.pending_callbacks.borrow_mut().remove(&$e) {
Some(val) => val,
None => return error!("No pending command for id: {}", $e)
});
}
}
pub struct WalletCommandExecutor {
pub struct WalletCommandExecutor {
wallet_service: Rc<WalletService>,
wallet_service: Rc<WalletService>,
crypto_service: Rc<CryptoService>,
crypto_service: Rc<CryptoService>,
कॉपी
कॉपी हुआ
कॉपी
कॉपी हुआ
open_callbacks: RefCell<HashMap<WalletHandle, Box<dyn Fn(IndyResult<WalletHandle>) + Send>>>,
pending_callbacks: RefCell<HashMap<CallbackHandle, Box<dyn Fn(IndyResult<()>) + Send>>>
}
}
impl WalletCommandExecutor {
impl WalletCommandExecutor {
pub fn new(wallet_service: Rc<WalletService>, crypto_service: Rc<CryptoService>) -> WalletCommandExecutor {
pub fn new(wallet_service: Rc<WalletService>, crypto_service: Rc<CryptoService>) -> WalletCommandExecutor {
WalletCommandExecutor {
WalletCommandExecutor {
wallet_service,
wallet_service,
crypto_service,
crypto_service,
कॉपी
कॉपी हुआ
कॉपी
कॉपी हुआ
open_callbacks: RefCell::new(HashMap::new()),
pending_callbacks: RefCell::new(HashMap::new())
}
}
}
}
कॉपी
कॉपी हुआ
कॉपी
कॉपी हुआ
pub
fn execute(&self, command: WalletCommand) {
pub
async
fn execute(&self, command: WalletCommand) {
match command {
match command {
WalletCommand::Open(config, credentials, cb) => {
WalletCommand::Open(config, credentials, cb) => {
debug!(target: "wallet_command_executor", "Open command received");
debug!(target: "wallet_command_executor", "Open command received");
कॉपी
कॉपी हुआ
कॉपी
कॉपी हुआ
self._open(&config, &credentials
, cb);
cb(
self._open(&config, &credentials
).await);
}
WalletCommand::OpenContinue(wallet_handle, key_result) => {
debug!(target: "wallet_command_executor", "OpenContinue command received");
self._open_continue(wallet_handle, key_result)
}
WalletCommand::DeriveKey(key_data, cb) => {
debug!(target: "wallet_command_executor", "DeriveKey command received");
self._derive_key(key_data, cb);
}
}
};
};
}
}
कॉपी
कॉपी हुआ
कॉपी
कॉपी हुआ
fn _open
(&
self,
async
fn _open
<'a>(&'a
self,
config: &
Config,
config: &
'a
Config,
credentials: &
Credentials
,
credentials: &
'a
Credentials
) ->
IndyResult<WalletHandle>
{
cb: Box<dyn Fn(
IndyResult<WalletHandle>
) + Send>)
{
trace!("_open >>> config: {:?}, credentials: {:?}", config, secret!(credentials));
trace!("_open >>> config: {:?}, credentials: {:?}", config, secret!(credentials));
कॉपी
कॉपी हुआ
कॉपी
कॉपी हुआ
let (wallet_handle, key_derivation_data, rekey_data) =
try_cb!(
self.wallet_service.open_wallet_prepare(config, credentials)
, cb)
;
let (wallet_handle, key_derivation_data, rekey_data) =
self.wallet_service.open_wallet_prepare(config, credentials)
?
;
कॉपी
कॉपी हुआ
कॉपी
कॉपी हुआ
self.
open_callbacks.borrow_mut().insert(wallet_handle, cb)
;
let key =
self.
_derive_key(key_derivation_data).await?
;
कॉपी
कॉपी हुआ
कॉपी
कॉपी हुआ
CommandExecutor::instance().send(
let rekey = if let Some(rekey_data) = rekey_data {
Command::Wallet(WalletCommand::DeriveKey(
Some(self._derive_key(rekey_data).await?)
key_derivation_data,
} else {
Box::new(move |key_result| {
None
match (key_result, rekey_data.clone()) {
};
(Ok(key_result), Some(rekey_data)) => {
WalletCommandExecutor::_derive_rekey_and_continue(wallet_handle, key_result, rekey_data)
}
(key_result, _) => {
let key_result = key_result.map(|kr| (kr, None));
WalletCommandExecutor::_send_open_continue(wallet_handle, key_result)
}
}
}),
))
).unwrap();
कॉपी
कॉपी हुआ
कॉपी
कॉपी हुआ
let res =
wallet_handle
;
let res =
self.wallet_service.open_wallet_continue(
wallet_handle
, (&key, rekey.as_ref()))
;
trace!("_open <<< res: {:?}", res);
trace!("_open <<< res: {:?}", res);
कॉपी
कॉपी हुआ
कॉपी
कॉपी हुआ
}
fn _derive_rekey_and_continue(wallet_handle: WalletHandle, key_result: MasterKey, rekey_data: KeyDerivationData) {
CommandExecutor::instance().send(
Command::Wallet(WalletCommand::DeriveKey(
rekey_data,
Box::new(move |rekey_result| {
let key_result = key_result.clone();
let key_result = rekey_result.map(move |rekey_result| (key_result, Some(rekey_result)));
WalletCommandExecutor::_send_open_continue(wallet_handle, key_result)
}),
))
).unwrap();
}
fn _send_open_continue(wallet_handle: WalletHandle, key_result: DeriveKeyResult<(MasterKey, Option<MasterKey>)>) {
CommandExecutor::instance().send(
Command::Wallet(WalletCommand::OpenContinue(
wallet_handle,
key_result,
))
).unwrap();
}
कॉपी
कॉपी हुआ
कॉपी
कॉपी हुआ
fn _open_continue(&self,
res
wallet_handle: WalletHandle,
key_result: DeriveKeyResult<(MasterKey, Option<MasterKey>)>) {
let cb = self.open_callbacks.borrow_mut().remove(&wallet_handle).unwrap();
cb(key_result
.and_then(|(key, rekey)| self.wallet_service.open_wallet_continue(wallet_handle, (&key, rekey.as_ref()))))
}
}
कॉपी
कॉपी हुआ
कॉपी
कॉपी हुआ
fn _derive_key(&self, key_data: KeyDerivationData
, cb: Box<dyn Fn(DeriveKeyResult
<MasterKey>
) + Send>)
{
async
fn _derive_key(&self, key_data: KeyDerivationData
) -> IndyResult
<MasterKey>
{
::commands::THREADPOOL.lock().unwrap().execute(move ||
cb(
key_data.calc_master_key()
));
let (s, r) = futures::channel::oneshot::channel();
crate
::commands::THREADPOOL.lock().unwrap().execute(move ||
{
let res =
key_data.calc_master_key()
;
s.send(res).unwrap();
});
r.await.unwrap()
}
}
}
}
कॉपी
कॉपी हुआ
कॉपी
कॉपी हुआ
सेव किए गए Diffs
ऑरिजनल टेक्स्ट
फ़ाइल खोलें
pub enum WalletCommand { Open(Config, // config Credentials, // credentials Box<dyn Fn(IndyResult<WalletHandle>) + Send>), OpenContinue(WalletHandle, DeriveKeyResult<(MasterKey, Option<MasterKey>)>, // derive_key_result ), DeriveKey(KeyDerivationData, Box<dyn Fn(DeriveKeyResult<MasterKey>) + Send>), } macro_rules! get_cb { ($self_:ident, $e:expr) => (match $self_.pending_callbacks.borrow_mut().remove(&$e) { Some(val) => val, None => return error!("No pending command for id: {}", $e) }); } pub struct WalletCommandExecutor { wallet_service: Rc<WalletService>, crypto_service: Rc<CryptoService>, open_callbacks: RefCell<HashMap<WalletHandle, Box<dyn Fn(IndyResult<WalletHandle>) + Send>>>, pending_callbacks: RefCell<HashMap<CallbackHandle, Box<dyn Fn(IndyResult<()>) + Send>>> } impl WalletCommandExecutor { pub fn new(wallet_service: Rc<WalletService>, crypto_service: Rc<CryptoService>) -> WalletCommandExecutor { WalletCommandExecutor { wallet_service, crypto_service, open_callbacks: RefCell::new(HashMap::new()), pending_callbacks: RefCell::new(HashMap::new()) } } pub fn execute(&self, command: WalletCommand) { match command { WalletCommand::Open(config, credentials, cb) => { debug!(target: "wallet_command_executor", "Open command received"); self._open(&config, &credentials, cb); } WalletCommand::OpenContinue(wallet_handle, key_result) => { debug!(target: "wallet_command_executor", "OpenContinue command received"); self._open_continue(wallet_handle, key_result) } WalletCommand::DeriveKey(key_data, cb) => { debug!(target: "wallet_command_executor", "DeriveKey command received"); self._derive_key(key_data, cb); } }; } fn _open(&self, config: &Config, credentials: &Credentials, cb: Box<dyn Fn(IndyResult<WalletHandle>) + Send>) { trace!("_open >>> config: {:?}, credentials: {:?}", config, secret!(credentials)); let (wallet_handle, key_derivation_data, rekey_data) = try_cb!(self.wallet_service.open_wallet_prepare(config, credentials), cb); self.open_callbacks.borrow_mut().insert(wallet_handle, cb); CommandExecutor::instance().send( Command::Wallet(WalletCommand::DeriveKey( key_derivation_data, Box::new(move |key_result| { match (key_result, rekey_data.clone()) { (Ok(key_result), Some(rekey_data)) => { WalletCommandExecutor::_derive_rekey_and_continue(wallet_handle, key_result, rekey_data) } (key_result, _) => { let key_result = key_result.map(|kr| (kr, None)); WalletCommandExecutor::_send_open_continue(wallet_handle, key_result) } } }), )) ).unwrap(); let res = wallet_handle; trace!("_open <<< res: {:?}", res); } fn _derive_rekey_and_continue(wallet_handle: WalletHandle, key_result: MasterKey, rekey_data: KeyDerivationData) { CommandExecutor::instance().send( Command::Wallet(WalletCommand::DeriveKey( rekey_data, Box::new(move |rekey_result| { let key_result = key_result.clone(); let key_result = rekey_result.map(move |rekey_result| (key_result, Some(rekey_result))); WalletCommandExecutor::_send_open_continue(wallet_handle, key_result) }), )) ).unwrap(); } fn _send_open_continue(wallet_handle: WalletHandle, key_result: DeriveKeyResult<(MasterKey, Option<MasterKey>)>) { CommandExecutor::instance().send( Command::Wallet(WalletCommand::OpenContinue( wallet_handle, key_result, )) ).unwrap(); } fn _open_continue(&self, wallet_handle: WalletHandle, key_result: DeriveKeyResult<(MasterKey, Option<MasterKey>)>) { let cb = self.open_callbacks.borrow_mut().remove(&wallet_handle).unwrap(); cb(key_result .and_then(|(key, rekey)| self.wallet_service.open_wallet_continue(wallet_handle, (&key, rekey.as_ref())))) } fn _derive_key(&self, key_data: KeyDerivationData, cb: Box<dyn Fn(DeriveKeyResult<MasterKey>) + Send>){ ::commands::THREADPOOL.lock().unwrap().execute(move || cb(key_data.calc_master_key())); } }
परिवर्तित टेक्स्ट
फ़ाइल खोलें
pub enum WalletCommand { Open(Config, // config Credentials, // credentials Box<dyn Fn(IndyResult<WalletHandle>) + Send>), } pub struct WalletCommandExecutor { wallet_service: Rc<WalletService>, crypto_service: Rc<CryptoService>, } impl WalletCommandExecutor { pub fn new(wallet_service: Rc<WalletService>, crypto_service: Rc<CryptoService>) -> WalletCommandExecutor { WalletCommandExecutor { wallet_service, crypto_service, } } pub async fn execute(&self, command: WalletCommand) { match command { WalletCommand::Open(config, credentials, cb) => { debug!(target: "wallet_command_executor", "Open command received"); cb(self._open(&config, &credentials).await); } }; } async fn _open<'a>(&'a self, config: &'a Config, credentials: &'a Credentials) -> IndyResult<WalletHandle> { trace!("_open >>> config: {:?}, credentials: {:?}", config, secret!(credentials)); let (wallet_handle, key_derivation_data, rekey_data) = self.wallet_service.open_wallet_prepare(config, credentials)?; let key = self._derive_key(key_derivation_data).await?; let rekey = if let Some(rekey_data) = rekey_data { Some(self._derive_key(rekey_data).await?) } else { None }; let res = self.wallet_service.open_wallet_continue(wallet_handle, (&key, rekey.as_ref())); trace!("_open <<< res: {:?}", res); res } async fn _derive_key(&self, key_data: KeyDerivationData) -> IndyResult<MasterKey> { let (s, r) = futures::channel::oneshot::channel(); crate::commands::THREADPOOL.lock().unwrap().execute(move || { let res = key_data.calc_master_key(); s.send(res).unwrap(); }); r.await.unwrap() } }
अंतर खोजें