mirror of
https://git.selfprivacy.org/SelfPrivacy/selfprivacy-rest-api.git
synced 2025-01-23 09:16:51 +00:00
refactor(ssh): Remove unused add_root_ssh_key function
This commit is contained in:
parent
86f9451b9b
commit
62d5de0dd6
|
@ -49,19 +49,6 @@ def set_ssh_settings(
|
||||||
data["ssh"]["passwordAuthentication"] = password_authentication
|
data["ssh"]["passwordAuthentication"] = password_authentication
|
||||||
|
|
||||||
|
|
||||||
def add_root_ssh_key(public_key: str):
|
|
||||||
with WriteUserData() as data:
|
|
||||||
if "ssh" not in data:
|
|
||||||
data["ssh"] = {}
|
|
||||||
if "rootKeys" not in data["ssh"]:
|
|
||||||
data["ssh"]["rootKeys"] = []
|
|
||||||
# Return 409 if key already in array
|
|
||||||
for key in data["ssh"]["rootKeys"]:
|
|
||||||
if key == public_key:
|
|
||||||
raise KeyAlreadyExists()
|
|
||||||
data["ssh"]["rootKeys"].append(public_key)
|
|
||||||
|
|
||||||
|
|
||||||
class KeyAlreadyExists(Exception):
|
class KeyAlreadyExists(Exception):
|
||||||
"""Key already exists"""
|
"""Key already exists"""
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue