From: How to generate a recovery key - Apple Support
- You can generate a new recovery key from Settings or System Preferences on a trusted device signed in with your Apple ID." See the article for details about how to do this on different types of equipment (Apple equipment only).
- If you forget your Apple ID password and do not know your recovery key, you can try to regain access using your trusted device protected by a passcode.
- When you generate a recovery key, you can't use account recovery ( How to use account recovery when you can’t reset your Apple ID password - Apple Support ).
- "Using a recovery key is more secure, but it means that you’re responsible for maintaining access to your trusted devices and your recovery key. If you lose both of these items, you could be locked out of your account permanently."