How to use the secretstorage.util.DBusAddressWrapper function in SecretStorage

To help you get started, we’ve selected a few SecretStorage examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mitya57 / secretstorage / secretstorage / util.py View on Github external
def exec_prompt(connection: DBusConnection,
	        prompt_path: str) -> Tuple[bool, List[str]]:
	"""Executes the prompt in a blocking mode.

	:returns: a tuple; the first element is a boolean value showing
	          whether the operation was dismissed, the second element
	          is a list of unlocked object paths
	"""
	prompt = DBusAddressWrapper(prompt_path, PROMPT_IFACE, connection)
	dismissed = result = None
	def callback(msg_body: Tuple[bool, List[str]]) -> None:
		_dismissed, _result = msg_body
		nonlocal dismissed, result
		dismissed, result = bool(_dismissed), _result
	connection.router.subscribe_signal(callback, prompt_path, PROMPT_IFACE, 'Completed')
	prompt.call('Prompt', 's', '')
	if result is None:
		connection.recv_messages()
	assert dismissed is not None
	assert result is not None
	return dismissed, result
github mitya57 / secretstorage / secretstorage / item.py View on Github external
def __init__(self, connection: DBusConnection,
	             item_path: str, session: Optional[Session] = None) -> None:
		self.item_path = item_path
		self._item = DBusAddressWrapper(item_path, ITEM_IFACE, connection)
		self._item.get_property('Label')
		self.session = session
		self.connection = connection
github mitya57 / secretstorage / secretstorage / collection.py View on Github external
def __init__(self, connection: DBusConnection,
	             collection_path: str = DEFAULT_COLLECTION,
	             session: Optional[Session] = None) -> None:
		self.connection = connection
		self.session = session
		self.collection_path = collection_path
		self._collection = DBusAddressWrapper(
			collection_path, COLLECTION_IFACE, connection)
		self._collection.get_property('Label')
github mitya57 / secretstorage / secretstorage / collection.py View on Github external
def lock(self) -> None:
		"""Locks the collection."""
		service = DBusAddressWrapper(SS_PATH, SERVICE_IFACE, self.connection)
		service.call('Lock', 'ao', [self.collection_path])
github mitya57 / secretstorage / secretstorage / collection.py View on Github external
def search_items(connection: DBusConnection,
                 attributes: Dict[str, str]) -> Iterator[Item]:
	"""Returns a generator of items in all collections with the given
	attributes. `attributes` should be a dictionary."""
	service = DBusAddressWrapper(SS_PATH, SERVICE_IFACE, connection)
	locked, unlocked = service.call('SearchItems', 'a{ss}', attributes)
	for item_path in locked + unlocked:
		yield Item(connection, item_path)