xi-keyring

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

commit
8a24e97cbf51fe2002b61fef0dc30309c6c79b43
parent
492599030df9af81ce8bb585c9fac4188f3da221
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2026-05-24 08:32
ask for password confirmation on key creation

Diffstat

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

1 files changed, 20 insertions, 6 deletions


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

@@ -65,12 +65,26 @@ class Keyring:
   65    65                 pass
   66    66 
   67    67     def _create_key(self, path: Path) -> KernelKey:
   68    -1         password = self.prompt.get_password(
   69    -1             'An application wants access to your keyring. '
   70    -1             'Please enter a password to create a keyring.'
   71    -1         )
   72    -1         if not password:
   73    -1             raise AccessDeniedError
   -1    68         while True:
   -1    69             password = self.prompt.get_password(
   -1    70                 'An application wants access to your keyring. '
   -1    71                 'Please enter a password to create a keyring.'
   -1    72             )
   -1    73             if not password:
   -1    74                 raise AccessDeniedError
   -1    75 
   -1    76             password2 = self.prompt.get_password(
   -1    77                 'Please enter the password again for confirmation.'
   -1    78             )
   -1    79             if password == password2:
   -1    80                 break
   -1    81 
   -1    82             again = self.prompt.confirm(
   -1    83                 'The passwords did not match. Do you want to try again?'
   -1    84             )
   -1    85             if not again:
   -1    86                 raise AccessDeniedError
   -1    87 
   74    88         key = Fernet.generate_key()
   75    89         encrypted = crypto.encrypt_with_password(key, password)
   76    90         path.parent.mkdir(mode=0o700, parents=True, exist_ok=True)