本文整理汇总了Python中indy.wallet.close_wallet方法的典型用法代码示例。如果您正苦于以下问题:Python wallet.close_wallet方法的具体用法?Python wallet.close_wallet怎么用?Python wallet.close_wallet使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类indy.wallet
的用法示例。
在下文中一共展示了wallet.close_wallet方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: sdk_wallet_handle
# 需要导入模块: from indy import wallet [as 别名]
# 或者: from indy.wallet import close_wallet [as 别名]
def sdk_wallet_handle(looper, sdk_wallet_data):
wallet_handle = looper.loop.run_until_complete(_gen_wallet_handler(sdk_wallet_data))
yield wallet_handle
looper.loop.run_until_complete(close_wallet(wallet_handle))
示例2: disconnect_wallet
# 需要导入模块: from indy import wallet [as 别名]
# 或者: from indy.wallet import close_wallet [as 别名]
def disconnect_wallet(self):
""" Close the wallet and set back state to non initialised.
"""
if self.wallet_handle:
await wallet.close_wallet(self.wallet_handle)
self.initialized = False
self.owner = ''
self.wallet_handle = None
示例3: wallet_handle
# 需要导入模块: from indy import wallet [as 别名]
# 或者: from indy.wallet import close_wallet [as 别名]
def wallet_handle(config, logger):
wallet_config = (
json.dumps({
'id': config.wallet_name,
'storage_config': {
'path': config.wallet_path
}
}),
json.dumps({'key': 'test-agent'})
)
# Initialization steps
# -- Create wallet
logger.debug('Creating wallet: {}'.format(config.wallet_name))
try:
await wallet.create_wallet(*wallet_config)
except:
pass
# -- Open a wallet
logger.debug('Opening wallet: {}'.format(config.wallet_name))
wallet_handle = await wallet.open_wallet(*wallet_config)
yield wallet_handle
# Cleanup
if config.clear_wallets:
logger.debug("Closing wallet")
await wallet.close_wallet(wallet_handle)
logger.debug("deleting wallet")
await wallet.delete_wallet(*wallet_config)
logger.debug("removing wallet directory")
os.rmdir(config.wallet_path)
示例4: wallet_destructor
# 需要导入模块: from indy import wallet [as 别名]
# 或者: from indy.wallet import close_wallet [as 别名]
def wallet_destructor(wallet_handle, wallet_config, wallet_credentials):
await wallet.close_wallet(wallet_handle)
await wallet.delete_wallet(wallet_config, wallet_credentials)
示例5: wallet_close
# 需要导入模块: from indy import wallet [as 别名]
# 或者: from indy.wallet import close_wallet [as 别名]
def wallet_close(self, wallet_h):
await wallet.close_wallet(wallet_h)
示例6: stop_test
# 需要导入模块: from indy import wallet [as 别名]
# 或者: from indy.wallet import close_wallet [as 别名]
def stop_test(self):
self._logger.info("stop_test...")
self._closing = True
if len(self._send_q) > 0:
await asyncio.gather(*self._send_q, return_exceptions=True)
if len(self._gen_q) > 0:
await asyncio.gather(*self._gen_q, return_exceptions=True)
self._logger.info("stopping queues done")
try:
if self._wallet_handle is not None:
await self.wallet_close(self._wallet_handle)
self._logger.info("wallet closed")
except Exception as e:
self._logger.exception("close_wallet exception: {}".format(e))
try:
if self._pool_handle is not None:
await self.pool_close_pool(self._pool_handle)
self._logger.info("pool closed")
except Exception as e:
self._logger.exception("close_pool_ledger exception: {}".format(e))
self._loop.call_soon_threadsafe(self._loop.stop)
self._logger.info("looper stopped")
dirs_to_dlt = []
if self._wallet_name is not None and self._wallet_name != "":
dirs_to_dlt.append(os.path.join(os.path.expanduser("~/.indy_client/wallet"), self._wallet_name))
if self._pool_name is not None and self._pool_name != "":
dirs_to_dlt.append(os.path.join(os.path.expanduser("~/.indy_client/pool"), self._pool_name))
for d in dirs_to_dlt:
if os.path.isdir(d):
shutil.rmtree(d, ignore_errors=True)
self._logger.info("dirs {} deleted".format(dirs_to_dlt))
示例7: connect_wallet
# 需要导入模块: from indy import wallet [as 别名]
# 或者: from indy.wallet import close_wallet [as 别名]
def connect_wallet(self, agent_name, passphrase, ephemeral=False):
""" Create if not already exists and open wallet.
"""
self.owner = agent_name
wallet_suffix = "wallet"
if ephemeral:
wallet_suffix = "ephemeral_wallet"
wallet_name = '{}-{}'.format(self.owner, wallet_suffix)
wallet_config = json.dumps({"id": wallet_name})
wallet_credentials = json.dumps({"key": passphrase})
# Handle ephemeral wallets
if ephemeral:
try:
await wallet.delete_wallet(wallet_config, wallet_credentials)
print("Removing ephemeral wallet.")
except error.IndyError as e:
if e.error_code is error.ErrorCode.WalletNotFoundError:
pass # This is ok, and expected.
else:
print("Unexpected Indy Error: {}".format(e))
except Exception as e:
print(e)
# pylint: disable=bare-except
try:
await wallet.create_wallet(wallet_config, wallet_credentials)
except error.IndyError as e:
if e.error_code is error.ErrorCode.WalletAlreadyExistsError:
pass # This is ok, and expected.
else:
print("Unexpected Indy Error: {}".format(e))
except Exception as e:
print(e)
try:
if self.wallet_handle:
await wallet.close_wallet(self.wallet_handle)
self.wallet_handle = await wallet.open_wallet(
wallet_config,
wallet_credentials
)
(_, self.endpoint_vk) = await did.create_and_store_my_did(self.wallet_handle, "{}")
self.initialized = True
except Exception as e:
print(e)
print("Could not open wallet!")
raise WalletConnectionException