Krikri::PluginHelpers::AuthorizedKeysFile
AuthorizedKeysFile - pure logic for ensuring a public key line is present/absent in an OpenSSH authorized_keys-style file, entirely without I/O so it's unit-testable with plain strings.
Constants
KEY_TYPES = ["ssh-rsa", "ssh-dss", "ssh-ed25519", "ecdsa-sha2-nistp256", "ecdsa-sha2-nistp384", "ecdsa-sha2-nistp521"] of ::String
Class methods
Ensures key_line's signature is present (or absent) in text.
Returns {new_text, changed}.
ensure_keys(text : String, key_lines : Array(String), present : Bool, exclusive : Bool = false) : Tuple(String, Bool)
Multi-key form matching the real module's enforce_state: each key
line is matched by its own signature; new keys are appended after
existing ones in the order given. With exclusive (state present
only), every existing key whose signature isn't among the new keys
is deleted - real Ansible's "remove all other keys to honor
exclusive".