The signed data is the 6-byte magic SSHSIG, the namespace string (for example git or file), a reserved field, the hash algorithm (sha256 or sha512) and the message digest; the namespace prevents a signature made for one purpose from being replayed in another. The output is armored between -----BEGIN SSH SIGNATURE----- and -----END SSH SIGNATURE----- and contains the public key, so verifiers must check it against a trusted list rather than accept the embedded key.
ssh-keygen -Y verify -f allowed_signers -I identity -n namespace -s file.sig checks a signature; -Y find-principals maps a signature to identities. Ed25519, ECDSA, RSA (with rsa-sha2-*) and FIDO sk- keys work, so a security key can sign commits with a touch. The SSH signature verifier runs the same checks locally.