Source code for pypergraph.keyring.storage.system_keyring_storage
import asyncio
import keyring
[docs]
class KeyringStorage:
"""Storage client using the system keyring (async via executor)."""
[docs]
@staticmethod
async def get_item(key: str):
loop = asyncio.get_event_loop()
return await loop.run_in_executor(None, keyring.get_password, "Pypergraph", key)
[docs]
@staticmethod
async def set_item(key: str, value: str):
loop = asyncio.get_event_loop()
await loop.run_in_executor(None, keyring.set_password, "Pypergraph", key, value)
[docs]
@staticmethod
async def remove_item(key: str):
loop = asyncio.get_event_loop()
await loop.run_in_executor(None, keyring.delete_password, "Pypergraph", key)