On iOS:
Settings > AppleID > iCloud > Advanced Data Protection
You'll see 'Add Recovery Contact' and underneath it you'll see 'Recovery Key' 'Off>'
Tap into it, agree to the notice, you'll get a 28 alphanumeric key and then re-enter that same key to finish the set-up.