Email or mobile number as identifier

Hello,

we would like to have a registration form with email, phone number and password fields, and a verification of the email and the phone number during the registration process.

Also, we would like to offer to the client a login form with 2 fields : one field “email or phone number”, one field “password”. If the user is submitting the login form with an email the second factor for the authentication would be by phone message, If the user is submitting the login form with a phone number the second factor for the authentication would by email.

What is the best way to implement that ? For the signup maybe to create a custom signup form using the api (Custom Signup) to request the phone number in an additional field, and verify the phone number in a rule ? But how to use the phone number as login identifier next ? Should it be necessarily 2 accounts linked by account linking feature ?
And how to implement the login by email or phone number with a single form next ?

Thank you!