diff options
| author | Loek Le Blansch <loek@pipeframe.xyz> | 2025-10-15 16:27:29 +0200 |
|---|---|---|
| committer | Loek Le Blansch <loek@pipeframe.xyz> | 2025-10-15 16:27:29 +0200 |
| commit | 767d6116332fda66b27f95e7a3444e230d2ccab4 (patch) | |
| tree | 7eddbde73f13f4d6a246df7fe27f9a19726044ea /nmpass | |
| parent | 7bbdd6cc10a6cc58521c350fb96d39eddd4e0aaa (diff) | |
allow password name format customization
Diffstat (limited to 'nmpass')
| -rw-r--r-- | nmpass/main.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/nmpass/main.py b/nmpass/main.py index 7ba1f23..3d8c85e 100644 --- a/nmpass/main.py +++ b/nmpass/main.py @@ -4,11 +4,13 @@ from asyncio import AbstractEventLoop, new_event_loop from sdbus_async.networkmanager import NetworkConnectionSettings, NetworkManagerSecretAgentInterfaceAsync, NetworkManagerAgentManager, NetworkManagerConnectionProperties, NetworkManagerSettings from sdbus_async.networkmanager.settings import ConnectionProfile, ConnectionSettings, EapolSettings, WirelessSecuritySettings from typing import Any +from os import environ import sdbus from .store import PasswordStore AGENT_OWNED = 1 +PASS_FORMAT = environ.get("NMPASS_FORMAT", "net/{ssid}") class NetworkManagerPasswordStoreAgent(NetworkManagerSecretAgentInterfaceAsync): store: PasswordStore @@ -49,7 +51,10 @@ class NetworkManagerPasswordStoreAgent(NetworkManagerSecretAgentInterfaceAsync): assert profile.wireless.ssid is not None ssid = profile.wireless.ssid.decode() - pass_name = f"net/{ssid}/passwd" + pass_name = PASS_FORMAT.format(**{ + "ssid": ssid, + "profile": profile, + }) password = self.store.retrieve(pass_name) if password is None: return {} |