Apple recently added a new feature that allows you to assign a physical security key to your Apple ID for two-factor authentication. To find out how to add a security key to your Apple ID on your iPhone, just follow these steps:
- First, go to the app on your iPhone Settings.
- Once you've done that, tap on at the top line with your profile.
- Then locate and click on the box Password and security.
- Here then tap on the option Add security keys.
- Then it will start add key wizard to walk through.
In order to add a security key, it must meet FIDO certification, for example YubiKey keys and others. You need two to add a key to your Apple ID in case you lose one.