class Twilio::REST::Verify::V2::ServiceContext::EntityContext::NewFactorList
PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
Public Class Methods
Initialize the NewFactorList
@param [Version] version Version
that contains the resource @param [String] service_sid The unique SID identifier of the Service. @param [String] identity Customer unique identity for the Entity owner of the
Factor. This identifier should be immutable, not PII, length between 8 and 64 characters, and generated by your external system, such as your user's UUID, GUID, or SID. It can only contain dash (-) separated alphanumeric characters.
@return [NewFactorList] NewFactorList
Twilio::REST::ListResource::new
# File lib/twilio-ruby/rest/verify/v2/service/entity/new_factor.rb 27 def initialize(version, service_sid: nil, identity: nil) 28 super(version) 29 30 # Path Solution 31 @solution = {service_sid: service_sid, identity: identity} 32 @uri = "/Services/#{@solution[:service_sid]}/Entities/#{@solution[:identity]}/Factors" 33 end
Public Instance Methods
Create the NewFactorInstance
@param [String] friendly_name The friendly name of this Factor. This can be any
string up to 64 characters, meant for humans to distinguish between Factors. For `factor_type` `push`, this could be a device name. For `factor_type` `totp`, this value is used as the “account name” in constructing the `binding.uri` property. At the same time, we recommend avoiding providing PII.
@param [new_factor.FactorTypes] factor_type The Type of this Factor. Currently
`push` and `totp` are supported. For `totp` to work, you need to contact {Twilio sales}[https://www.twilio.com/help/sales] first to have the Verify TOTP feature enabled for your Twilio account.
@param [String] binding_alg The algorithm used when `factor_type` is `push`.
Algorithm supported: `ES256`
@param [String] binding_public_key The Ecdsa public key in PKIX, ASN.1 DER
format encoded in Base64. Required when `factor_type` is `push`
@param [String] config_app_id The ID that uniquely identifies your app in the
Google or Apple store, such as `com.example.myapp`. It can be up to 100 characters long. Required when `factor_type` is `push`.
@param [new_factor.NotificationPlatforms] config_notification_platform The
transport technology used to generate the Notification Token. Can be `apn` or `fcm`. Required when `factor_type` is `push`.
@param [String] config_notification_token For APN, the device token. For FCM the
registration token. It used to send the push notifications. Must be between 32 and 255 characters long. Required when `factor_type` is `push`.
@param [String] config_sdk_version The Verify
Push SDK version used to configure
the factor Required when `factor_type` is `push`
@param [String] binding_secret The shared secret for TOTP factors encoded in
Base32. This can be provided when creating the Factor, otherwise it will be generated. Used when `factor_type` is `totp`
@param [String] config_time_step Defines how often, in seconds, are TOTP codes
generated. i.e, a new TOTP code is generated every time_step seconds. Must be between 20 and 60 seconds, inclusive. The default value is defined at the service level in the property `totp.time_step`. Defaults to 30 seconds if not configured. Used when `factor_type` is `totp`
@param [String] config_skew The number of time-steps, past and future, that are
valid for validation of TOTP codes. Must be between 0 and 2, inclusive. The default value is defined at the service level in the property `totp.skew`. If not configured defaults to 1. Used when `factor_type` is `totp`
@param [String] config_code_length Number of digits for generated TOTP codes.
Must be between 3 and 8, inclusive. The default value is defined at the service level in the property `totp.code_length`. If not configured defaults to 6. Used when `factor_type` is `totp`
@param [new_factor.TotpAlgorithms] config_alg The algorithm used to derive the
TOTP codes. Can be `sha1`, `sha256` or `sha512`. Defaults to `sha1`. Used when `factor_type` is `totp`
@return [NewFactorInstance] Created NewFactorInstance
# File lib/twilio-ruby/rest/verify/v2/service/entity/new_factor.rb 100 def create(friendly_name: nil, factor_type: nil, binding_alg: :unset, binding_public_key: :unset, config_app_id: :unset, config_notification_platform: :unset, config_notification_token: :unset, config_sdk_version: :unset, binding_secret: :unset, config_time_step: :unset, config_skew: :unset, config_code_length: :unset, config_alg: :unset) 101 data = Twilio::Values.of({ 102 'FriendlyName' => friendly_name, 103 'FactorType' => factor_type, 104 'Binding.Alg' => binding_alg, 105 'Binding.PublicKey' => binding_public_key, 106 'Config.AppId' => config_app_id, 107 'Config.NotificationPlatform' => config_notification_platform, 108 'Config.NotificationToken' => config_notification_token, 109 'Config.SdkVersion' => config_sdk_version, 110 'Binding.Secret' => binding_secret, 111 'Config.TimeStep' => config_time_step, 112 'Config.Skew' => config_skew, 113 'Config.CodeLength' => config_code_length, 114 'Config.Alg' => config_alg, 115 }) 116 117 payload = @version.create('POST', @uri, data: data) 118 119 NewFactorInstance.new( 120 @version, 121 payload, 122 service_sid: @solution[:service_sid], 123 identity: @solution[:identity], 124 ) 125 end
Provide a user friendly representation
# File lib/twilio-ruby/rest/verify/v2/service/entity/new_factor.rb 129 def to_s 130 '#<Twilio.Verify.V2.NewFactorList>' 131 end