To set a phone number as unique across users in Ory Kratos, you need to modify the identity schema. However, it's important to note that making phone numbers unique can potentially lead to security issues and is generally not recommended. Here's why: 1. Uniqueness constraints on phone numbers can enable account enumeration attacks, as mentioned in the [Ory documentation on emails and phone numbers](
https://www.ory.sh/docs/kratos/social-signin/data-mapping#emails-and-phone-numbers). 2. Phone numbers, like email addresses, should be verified before being trusted or used as unique identifiers. The documentation states: "Never trust unverified email addresses and phone numbers." 3. There are potential issues with reserving phone numbers even if they're not verified, as discussed in a [GitHub issue about phone number verification](
https://github.com/ory/kratos/issues/2656). Instead of making phone numbers unique, it's recommended to: 1. Use phone numbers as a verifiable address in your identity schema. 2. Implement proper verification processes for phone numbers. 3. Consider using a combination of identifiers (like email and phone) rather than relying solely on phone numbers. If you still want to proceed with making phone numbers unique, you would need to customize your identity schema. However, the provided knowledge sources don't contain specific information on how to enforce uniqueness for phone numbers across users in Ory Kratos. For the most up-to-date and secure practices regarding phone number handling in Ory Kratos, I recommend consulting the [official Ory documentation](
https://www.ory.sh/docs/) or reaching out to Ory support for guidance tailored to your specific use case.