winipedia-utils 0.1.37__py3-none-any.whl → 0.1.39__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- winipedia_utils/pyside/ui/widgets/media_player.py +1 -5
- winipedia_utils/security/keyring.py +30 -10
- {winipedia_utils-0.1.37.dist-info → winipedia_utils-0.1.39.dist-info}/METADATA +1 -1
- {winipedia_utils-0.1.37.dist-info → winipedia_utils-0.1.39.dist-info}/RECORD +6 -6
- {winipedia_utils-0.1.37.dist-info → winipedia_utils-0.1.39.dist-info}/LICENSE +0 -0
- {winipedia_utils-0.1.37.dist-info → winipedia_utils-0.1.39.dist-info}/WHEEL +0 -0
@@ -267,12 +267,8 @@ class MediaPlayer(QMediaPlayer):
|
|
267
267
|
source_url=QUrl.fromLocalFile(path),
|
268
268
|
)
|
269
269
|
|
270
|
-
def set_source_device(
|
271
|
-
self, io_device: PyQIODevice, source_url: QUrl | None = None
|
272
|
-
) -> None:
|
270
|
+
def set_source_device(self, io_device: PyQIODevice, source_url: QUrl) -> None:
|
273
271
|
"""Play the video."""
|
274
|
-
if source_url is None:
|
275
|
-
source_url = QUrl()
|
276
272
|
self.source_url = source_url
|
277
273
|
self.io_device = io_device
|
278
274
|
self.setSourceDevice(self.io_device, self.source_url)
|
@@ -5,6 +5,9 @@ including getting and creating secrets and fernets.
|
|
5
5
|
These utilities help with secure storage and retrieval of secrets.
|
6
6
|
"""
|
7
7
|
|
8
|
+
from base64 import b64decode, b64encode
|
9
|
+
from collections.abc import Callable
|
10
|
+
|
8
11
|
import keyring
|
9
12
|
from cryptography.fernet import Fernet
|
10
13
|
from cryptography.hazmat.primitives.ciphers.aead import AESGCM
|
@@ -15,11 +18,9 @@ def get_or_create_fernet(service_name: str, username: str) -> Fernet:
|
|
15
18
|
|
16
19
|
If it does not exist, create it with a Fernet.
|
17
20
|
"""
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
keyring.set_password(service_name, username, secret)
|
22
|
-
return Fernet(secret.encode())
|
21
|
+
return get_or_create_key(
|
22
|
+
service_name, username, Fernet, lambda: Fernet.generate_key()
|
23
|
+
)
|
23
24
|
|
24
25
|
|
25
26
|
def get_or_create_aes_gcm(service_name: str, username: str) -> AESGCM:
|
@@ -27,8 +28,27 @@ def get_or_create_aes_gcm(service_name: str, username: str) -> AESGCM:
|
|
27
28
|
|
28
29
|
If it does not exist, create it with a AESGCM.
|
29
30
|
"""
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
31
|
+
return get_or_create_key(
|
32
|
+
service_name, username, AESGCM, lambda: AESGCM.generate_key(bit_length=256)
|
33
|
+
)
|
34
|
+
|
35
|
+
|
36
|
+
def get_or_create_key[T](
|
37
|
+
service_name: str,
|
38
|
+
username: str,
|
39
|
+
key_class: Callable[[bytes], T],
|
40
|
+
generate_key_func: Callable[..., bytes],
|
41
|
+
) -> T:
|
42
|
+
"""Get the app secret using keyring.
|
43
|
+
|
44
|
+
If it does not exist, create it with the generate_func.
|
45
|
+
"""
|
46
|
+
service_name = f"{service_name}_{key_class.__name__}"
|
47
|
+
key = keyring.get_password(service_name, username)
|
48
|
+
if key is None:
|
49
|
+
binary_key = generate_key_func()
|
50
|
+
key = b64encode(binary_key).decode("ascii")
|
51
|
+
keyring.set_password(service_name, username, key)
|
52
|
+
|
53
|
+
binary_key = b64decode(key)
|
54
|
+
return key_class(binary_key)
|
@@ -54,7 +54,7 @@ winipedia_utils/pyside/ui/pages/player.py,sha256=PPmUNejMibKeNUm-a-1VA6i14G743YF
|
|
54
54
|
winipedia_utils/pyside/ui/widgets/__init__.py,sha256=p-maJQh7gYbXwhkqKU4wL6UNGzRAy988JP8_qLoTZDk,24
|
55
55
|
winipedia_utils/pyside/ui/widgets/browser.py,sha256=5oUyQKYOYu9Zzx6adbewTtAIfnn_RVs8CLoX3rU2g28,6160
|
56
56
|
winipedia_utils/pyside/ui/widgets/clickable_widget.py,sha256=nUZ7ngPFQ7utJuq9A-72TeT1wqCt_xubAxBg3xQSL64,856
|
57
|
-
winipedia_utils/pyside/ui/widgets/media_player.py,sha256=
|
57
|
+
winipedia_utils/pyside/ui/widgets/media_player.py,sha256=jcAGeZo3ey177K2jAmqg1LOyARzn_5z26krZGKVj99c,10909
|
58
58
|
winipedia_utils/pyside/ui/widgets/notification.py,sha256=_zBq9Q6SDFu3fV2AkbvyCNQmOEOy1l9mKOFAAdyteg4,1941
|
59
59
|
winipedia_utils/pyside/ui/windows/__init__.py,sha256=p-maJQh7gYbXwhkqKU4wL6UNGzRAy988JP8_qLoTZDk,24
|
60
60
|
winipedia_utils/pyside/ui/windows/base/__init__.py,sha256=p-maJQh7gYbXwhkqKU4wL6UNGzRAy988JP8_qLoTZDk,24
|
@@ -69,7 +69,7 @@ winipedia_utils/resources/svgs/play_icon.svg,sha256=U0RQ-S_WbcyyjeWC55BkcOtG64Gf
|
|
69
69
|
winipedia_utils/resources/svgs/svg.py,sha256=-Dw6m7cm9CHT2076oZIMx7kTQw0v_ifJajXzWcpUtI0,430
|
70
70
|
winipedia_utils/security/__init__.py,sha256=ZBa72J6MNtYumBFMoVc0ia4jsoS7oNgjaTCW0xDb6EI,53
|
71
71
|
winipedia_utils/security/cryptography.py,sha256=zfxSDo7aE9ecmZNC6URMSEUYRpOuJ1iESg-WCSS5HP0,822
|
72
|
-
winipedia_utils/security/keyring.py,sha256=
|
72
|
+
winipedia_utils/security/keyring.py,sha256=35bCXBmsFWyd7Ja2w9zHElayABeRZEaNXoEDDRb8ItQ,1698
|
73
73
|
winipedia_utils/setup.py,sha256=F4NneO0wVTf7JCXLorWjTOdJl36N5fLSksoWMe4p86o,1650
|
74
74
|
winipedia_utils/testing/__init__.py,sha256=kXhB5xw02ec5xpcW_KV--9CBKdyCjnuR-NZzAJ5tq0g,51
|
75
75
|
winipedia_utils/testing/assertions.py,sha256=0JF4mqVTnLQ1qkAL_FuTwyN_idr00rvVlta7aDdnUXA,851
|
@@ -91,7 +91,7 @@ winipedia_utils/testing/tests/base/utils/utils.py,sha256=dUPDrgAxlfREQb33zz23Mfz
|
|
91
91
|
winipedia_utils/testing/tests/conftest.py,sha256=8RounBlI8Jq1aLaLNpv84MW4ne8Qq0aavQextDOp5ng,920
|
92
92
|
winipedia_utils/text/__init__.py,sha256=j2bwtK6kyeHI6SnoBjpRju0C1W2n2paXBDlNjNtaUxA,48
|
93
93
|
winipedia_utils/text/string.py,sha256=1jbBftlgxffGgSlPnQh3aRPIr8XekEwpSenjFCW6JyM,3478
|
94
|
-
winipedia_utils-0.1.
|
95
|
-
winipedia_utils-0.1.
|
96
|
-
winipedia_utils-0.1.
|
97
|
-
winipedia_utils-0.1.
|
94
|
+
winipedia_utils-0.1.39.dist-info/LICENSE,sha256=3PrKJ2CWNrnyyHaC_r0wPDSukVWgmjOxHr__eQVH7cw,1087
|
95
|
+
winipedia_utils-0.1.39.dist-info/METADATA,sha256=PEZW6MkX2O4ZuDOXmfWUuhYLriJJQjGbOqKmvL8hOS4,12576
|
96
|
+
winipedia_utils-0.1.39.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
97
|
+
winipedia_utils-0.1.39.dist-info/RECORD,,
|
File without changes
|
File without changes
|