SMS authentication enables users to authenticate their Turnkey account using their phone number via a 6-digit one-time password (OTP). When authenticated, users receive an expiring API key stored in memory within an iframe, which functions like a session key to access their wallet.
SMS authentication uses two activities:
INIT_OTP_AUTH
- sends a 6-digit OTP code to the specified phone numberOTP_AUTH
- verifies the code and returns an encrypted API key credentialTo start SMS authentication, create an activity with ACTIVITY_TYPE_INIT_OTP_AUTH
and the following parameters:
otpType
: must be set to "OTP_TYPE_SMS"
contact
: user’s phone number (must be previously approved and attached to the user’s organization data)userIdentifier
: optional parameter for rate limiting SMS OTP requests per user.
We recommend generating this server-side based on the user’s IP address or public key.
See the OTP Rate Limits section below for more details.Once the user receives their code, use ACTIVITY_TYPE_OTP_AUTH
with these parameters:
otpId
: ID from the INIT_OTP_AUTH
responseotpCode
: the 6-digit code received via SMStargetPublicKey
: public key for credential encryptionapiKeyName
: optional name for the API Key (defaults to OTP Auth - <Timestamp>
)expirationSeconds
: optional duration in seconds (defaults to 15 minutes)invalidateExisting
: optional boolean to invalidate previous OTP Auth API keysSMS authentication requires proper permissions through policies or parent organization status.
SMS authentication is disabled by default. Enable it using ACTIVITY_TYPE_SET_ORGANIZATION_FEATURE
:
disableSmsAuth: true
in the CreateSubOrganizationIntentV7
activityACTIVITY_TYPE_REMOVE_ORGANIZATION_FEATURE
with feature name FEATURE_NAME_SMS_AUTH
In order to safeguard users, Turnkey enforces rate limits for OTP auth activities. If a userIdentifier
parameter is provided, the following limits are enforced:
userIdentifier
SMS authentication enables users to authenticate their Turnkey account using their phone number via a 6-digit one-time password (OTP). When authenticated, users receive an expiring API key stored in memory within an iframe, which functions like a session key to access their wallet.
SMS authentication uses two activities:
INIT_OTP_AUTH
- sends a 6-digit OTP code to the specified phone numberOTP_AUTH
- verifies the code and returns an encrypted API key credentialTo start SMS authentication, create an activity with ACTIVITY_TYPE_INIT_OTP_AUTH
and the following parameters:
otpType
: must be set to "OTP_TYPE_SMS"
contact
: user’s phone number (must be previously approved and attached to the user’s organization data)userIdentifier
: optional parameter for rate limiting SMS OTP requests per user.
We recommend generating this server-side based on the user’s IP address or public key.
See the OTP Rate Limits section below for more details.Once the user receives their code, use ACTIVITY_TYPE_OTP_AUTH
with these parameters:
otpId
: ID from the INIT_OTP_AUTH
responseotpCode
: the 6-digit code received via SMStargetPublicKey
: public key for credential encryptionapiKeyName
: optional name for the API Key (defaults to OTP Auth - <Timestamp>
)expirationSeconds
: optional duration in seconds (defaults to 15 minutes)invalidateExisting
: optional boolean to invalidate previous OTP Auth API keysSMS authentication requires proper permissions through policies or parent organization status.
SMS authentication is disabled by default. Enable it using ACTIVITY_TYPE_SET_ORGANIZATION_FEATURE
:
disableSmsAuth: true
in the CreateSubOrganizationIntentV7
activityACTIVITY_TYPE_REMOVE_ORGANIZATION_FEATURE
with feature name FEATURE_NAME_SMS_AUTH
In order to safeguard users, Turnkey enforces rate limits for OTP auth activities. If a userIdentifier
parameter is provided, the following limits are enforced:
userIdentifier