Skip to main content

validate_ssh_key

Function validate_ssh_key 

Source
pub fn validate_ssh_key(line: &str) -> Result<String, String>
Expand description

Checks an OpenSSH public key line and returns it without its comment.

The comment is dropped rather than validated: it is the one field a client controls freely, the generated authorized_keys is a line-oriented file where a forced command precedes the key, and a value that cannot appear cannot be escaped wrongly. The node writes the account name there instead.

ยงErrors

Returns a message when the line is not a single ssh-ed25519 <base64> pair whose blob really is a 32-byte ed25519 key.