I'm still a little confused, are you saying that we just rely on ssh to detect the keys, or is there somewhere else in this script that I'm missing where you tell ssh to use the specific key? The thing I'm familiar with is that ssh will search through the keys in ~/.ssh and try them all when authenticating. The reason why I'd prefer not to rely on this is because of two failure modes:

1. The user has stored their key in a location not in the default ssh search path.
2. Some instances of the ssh protocol limit the number of keys that can be tried before failing to authenticate. This is really hard to debug when it happens... basically if you have 20 keys, it will try 6 of them and then fail, even if you have the necessary key correctly in ~/.ssh.

Are you referring to this type of discovery (where the ssh client scans the keys in ~/.ssh) or something else?