mirror of
https://git.selfprivacy.org/SelfPrivacy/selfprivacy-rest-api.git
synced 2025-01-23 17:26:46 +00:00
feat(ssh): Add support for ecdsa keys
This commit is contained in:
parent
62d5de0dd6
commit
cebb71ff4a
|
@ -147,7 +147,7 @@ class UsersMutations:
|
||||||
except InvalidPublicKey:
|
except InvalidPublicKey:
|
||||||
return UserMutationReturn(
|
return UserMutationReturn(
|
||||||
success=False,
|
success=False,
|
||||||
message="Invalid key type. Only ssh-ed25519 and ssh-rsa are supported",
|
message="Invalid key type. Only ssh-ed25519, ssh-rsa and ecdsa are supported",
|
||||||
code=400,
|
code=400,
|
||||||
)
|
)
|
||||||
except UserNotFound:
|
except UserNotFound:
|
||||||
|
|
|
@ -88,9 +88,11 @@ class ReadUserData(object):
|
||||||
|
|
||||||
|
|
||||||
def validate_ssh_public_key(key):
|
def validate_ssh_public_key(key):
|
||||||
"""Validate SSH public key. It may be ssh-ed25519 or ssh-rsa."""
|
"""Validate SSH public key.
|
||||||
|
It may be ssh-ed25519, ssh-rsa or ecdsa-sha2-nistp256."""
|
||||||
if not key.startswith("ssh-ed25519"):
|
if not key.startswith("ssh-ed25519"):
|
||||||
if not key.startswith("ssh-rsa"):
|
if not key.startswith("ssh-rsa"):
|
||||||
|
if not key.startswith("ecdsa-sha2-nistp256"):
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue