mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-11 21:17:32 +00:00
feat: Add Twilio Verification Service (#8678)
# Which Problems Are Solved Twilio supports a robust, multi-channel verification service that notably supports multi-region SMS sender numbers required for our use case. Currently, Zitadel does much of the work of the Twilio Verify (eg. localization, code generation, messaging) but doesn't support the pool of sender numbers that Twilio Verify does. # How the Problems Are Solved To support this API, we need to be able to store the Twilio Service ID and send that in a verification request where appropriate: phone number verification and SMS 2FA code paths. This PR does the following: - Adds the ability to use Twilio Verify of standard messaging through Twilio - Adds support for international numbers and more reliable verification messages sent from multiple numbers - Adds a new Twilio configuration option to support Twilio Verify in the admin console - Sends verification SMS messages through Twilio Verify - Implements Twilio Verification Checks for codes generated through the same # Additional Changes # Additional Context - base was implemented by @zhirschtritt in https://github.com/zitadel/zitadel/pull/8268 ❤️ - closes https://github.com/zitadel/zitadel/issues/8581 --------- Co-authored-by: Zachary Hirschtritt <zachary.hirschtritt@klaviyo.com> Co-authored-by: Joey Biscoglia <joey.biscoglia@klaviyo.com>
This commit is contained in:
@@ -37,9 +37,10 @@ type SMSConfig struct {
|
||||
}
|
||||
|
||||
type Twilio struct {
|
||||
SID string
|
||||
Token *crypto.CryptoValue
|
||||
SenderNumber string
|
||||
SID string
|
||||
Token *crypto.CryptoValue
|
||||
SenderNumber string
|
||||
VerifyServiceSID string
|
||||
}
|
||||
|
||||
type HTTP struct {
|
||||
@@ -123,6 +124,10 @@ var (
|
||||
name: projection.SMSTwilioColumnSenderNumber,
|
||||
table: smsTwilioTable,
|
||||
}
|
||||
SMSTwilioColumnVerifyServiceSID = Column{
|
||||
name: projection.SMSTwilioColumnVerifyServiceSID,
|
||||
table: smsTwilioTable,
|
||||
}
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -227,6 +232,7 @@ func prepareSMSConfigQuery(ctx context.Context, db prepareDatabase) (sq.SelectBu
|
||||
SMSTwilioColumnSID.identifier(),
|
||||
SMSTwilioColumnToken.identifier(),
|
||||
SMSTwilioColumnSenderNumber.identifier(),
|
||||
SMSTwilioColumnVerifyServiceSID.identifier(),
|
||||
|
||||
SMSHTTPColumnSMSID.identifier(),
|
||||
SMSHTTPColumnEndpoint.identifier(),
|
||||
@@ -255,6 +261,7 @@ func prepareSMSConfigQuery(ctx context.Context, db prepareDatabase) (sq.SelectBu
|
||||
&twilioConfig.sid,
|
||||
&twilioConfig.token,
|
||||
&twilioConfig.senderNumber,
|
||||
&twilioConfig.verifyServiceSid,
|
||||
|
||||
&httpConfig.id,
|
||||
&httpConfig.endpoint,
|
||||
@@ -289,6 +296,7 @@ func prepareSMSConfigsQuery(ctx context.Context, db prepareDatabase) (sq.SelectB
|
||||
SMSTwilioColumnSID.identifier(),
|
||||
SMSTwilioColumnToken.identifier(),
|
||||
SMSTwilioColumnSenderNumber.identifier(),
|
||||
SMSTwilioColumnVerifyServiceSID.identifier(),
|
||||
|
||||
SMSHTTPColumnSMSID.identifier(),
|
||||
SMSHTTPColumnEndpoint.identifier(),
|
||||
@@ -321,6 +329,7 @@ func prepareSMSConfigsQuery(ctx context.Context, db prepareDatabase) (sq.SelectB
|
||||
&twilioConfig.sid,
|
||||
&twilioConfig.token,
|
||||
&twilioConfig.senderNumber,
|
||||
&twilioConfig.verifyServiceSid,
|
||||
|
||||
&httpConfig.id,
|
||||
&httpConfig.endpoint,
|
||||
@@ -343,10 +352,11 @@ func prepareSMSConfigsQuery(ctx context.Context, db prepareDatabase) (sq.SelectB
|
||||
}
|
||||
|
||||
type sqlTwilioConfig struct {
|
||||
smsID sql.NullString
|
||||
sid sql.NullString
|
||||
token *crypto.CryptoValue
|
||||
senderNumber sql.NullString
|
||||
smsID sql.NullString
|
||||
sid sql.NullString
|
||||
token *crypto.CryptoValue
|
||||
senderNumber sql.NullString
|
||||
verifyServiceSid sql.NullString
|
||||
}
|
||||
|
||||
func (c sqlTwilioConfig) set(smsConfig *SMSConfig) {
|
||||
@@ -354,9 +364,10 @@ func (c sqlTwilioConfig) set(smsConfig *SMSConfig) {
|
||||
return
|
||||
}
|
||||
smsConfig.TwilioConfig = &Twilio{
|
||||
SID: c.sid.String,
|
||||
Token: c.token,
|
||||
SenderNumber: c.senderNumber.String,
|
||||
SID: c.sid.String,
|
||||
Token: c.token,
|
||||
SenderNumber: c.senderNumber.String,
|
||||
VerifyServiceSID: c.verifyServiceSid.String,
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user