xi-keyring

simple and extensible alternative for gnome-keyring
git clone https://git.ce9e.org/xi-keyring.git

commit
f10605b29beae7f6d42c8c627b90dc05a0387f17
parent
b7a41a2b89d25c39c59db3315f99be7ff0dfb4c4
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2026-05-24 09:54
do not include app_id in confirmation dialog

Diffstat

M xikeyring/keyring.py 16 ++++++++--------

1 files changed, 8 insertions, 8 deletions


diff --git a/xikeyring/keyring.py b/xikeyring/keyring.py

@@ -113,12 +113,12 @@ class Keyring:
  113   113         encrypted = Fernet(self.key.value).encrypt(decrypted)
  114   114         write_bytes(self.path, encrypted)
  115   115 
  116    -1     def confirm_access(self, app_id: str) -> None:
  117    -1         if not self.prompt.confirm(f'Allow {app_id or "host"} to access a secret from your keyring?'):
   -1   116     def confirm_access(self) -> None:
   -1   117         if not self.prompt.confirm('Allow access to a secret from your keyring?'):
  118   118             raise AccessDeniedError
  119   119 
  120    -1     def confirm_change(self, app_id: str) -> None:
  121    -1         if not self.prompt.confirm(f'Allow {app_id or "host"} to make changes to your keyring?'):
   -1   120     def confirm_change(self) -> None:
   -1   121         if not self.prompt.confirm('Allow changes to your keyring?'):
  122   122             raise AccessDeniedError
  123   123 
  124   124     def get(self, items: dict[int, Item], app_id: str, id: int) -> Item:
@@ -146,7 +146,7 @@ class Keyring:
  146   146     def get_secret(self, app_id: str, id: int) -> bytes:
  147   147         items = self._read()
  148   148         item = self.get(items, app_id, id)
  149    -1         self.confirm_access(app_id)
   -1   149         self.confirm_access()
  150   150         return item.secret
  151   151 
  152   152     def create_item(self, app_id: str, attributes: dict[str, str], secret: bytes) -> int:
@@ -159,21 +159,21 @@ class Keyring:
  159   159     def update_attributes(self, app_id: str, id: int, attributes: dict[str, str]) -> None:
  160   160         items = self._read()
  161   161         item = self.get(items, app_id, id)
  162    -1         self.confirm_change(app_id)
   -1   162         self.confirm_change()
  163   163         item.attributes = attributes
  164   164         self._write(items)
  165   165 
  166   166     def update_secret(self, app_id: str, id: int, secret: bytes) -> None:
  167   167         items = self._read()
  168   168         item = self.get(items, app_id, id)
  169    -1         self.confirm_change(app_id)
   -1   169         self.confirm_change()
  170   170         item.secret = secret
  171   171         self._write(items)
  172   172 
  173   173     def delete_item(self, app_id: str, id: int) -> None:
  174   174         items = self._read()
  175   175         self.get(items, app_id, id)  # trigger appropriate exceptions
  176    -1         self.confirm_change(app_id)
   -1   176         self.confirm_change()
  177   177         del items[id]
  178   178         self._write(items)
  179   179