comparison libervia/backend/plugins/plugin_xep_0373.py @ 4334:111dce64dcb5

plugins XEP-0300, XEP-0446, XEP-0447, XEP0448 and others: Refactoring to use Pydantic: Pydantic models are used more and more in Libervia, for the bridge API, and also to convert `domish.Element` to internal representation. Type hints have also been added in many places. rel 453
author Goffi <goffi@goffi.org>
date Tue, 03 Dec 2024 00:12:38 +0100
parents 71c939e34ca6
children
comparison
equal deleted inserted replaced
4333:e94799a0908f 4334:111dce64dcb5
785 primary_create_result = c.create_key( 785 primary_create_result = c.create_key(
786 user_id, 786 user_id,
787 algorithm=self.ALGORITHM, 787 algorithm=self.ALGORITHM,
788 expires=False, 788 expires=False,
789 certify=True, 789 certify=True,
790 force=True 790 force=True,
791 ) 791 )
792 792
793 primary_key_obj = c.get_key(primary_create_result.fpr, secret=True) 793 primary_key_obj = c.get_key(primary_create_result.fpr, secret=True)
794 794
795 c.create_subkey( 795 c.create_subkey(
796 primary_key_obj, 796 primary_key_obj, algorithm=self.ALGORITHM, expires=False, sign=True
797 algorithm=self.ALGORITHM,
798 expires=False,
799 sign=True
800 ) 797 )
801 798
802 c.create_subkey( 799 c.create_subkey(
803 primary_key_obj, 800 primary_key_obj, algorithm=self.ALGORITHM, expires=False, encrypt=True
804 algorithm=self.ALGORITHM,
805 expires=False,
806 encrypt=True
807 ) 801 )
808 except gpg.errors.GPGMEError as e: 802 except gpg.errors.GPGMEError as e:
809 raise GPGProviderError("Internal GPGME error") from e 803 raise GPGProviderError("Internal GPGME error") from e
810 except gpg.errors.KeyNotFound as e: 804 except gpg.errors.KeyNotFound as e:
811 raise GPGProviderError("Newly created key not found") from e 805 raise GPGProviderError("Newly created key not found") from e