Documentation ¶
Overview ¶
Package pnv10n provides utility for verifying phone numbers.
pnv10n = phone-number verification.
Index ¶
- Variables
- func ModuleConfigSkeletons() map[string]interface{}
- func ModuleNames() []string
- func RegisterModule(serviceName string, module Module)
- type Config
- type ConfigurationError
- type GatewayError
- type InvalidPhoneNumberError
- type Module
- type PhoneNumberRegionNotSupportedError
- type SMSDeliveryService
- type VerificationMethod
- type Verifier
- func (verifier *Verifier) ConfirmVerification(callCtx iam.CallContext, verificationID int64, code string) error
- func (verifier *Verifier) GetPhoneNumberByVerificationID(verificationID int64) (*iam.PhoneNumber, error)
- func (verifier *Verifier) GetVerificationCodeByPhoneNumber(phoneNumber iam.PhoneNumber) (code string, err error)
- func (verifier *Verifier) StartVerification(callCtx iam.CallContext, phoneNumber iam.PhoneNumber, codeTTL time.Duration, ...) (id int64, codeExpiry *time.Time, err error)
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrVerificationCodeMismatch = errors.New("code mismatch") ErrVerificationCodeExpired = errors.New("code expired") )
Functions ¶
func ModuleConfigSkeletons ¶
func ModuleConfigSkeletons() map[string]interface{}
func ModuleNames ¶
func ModuleNames() []string
func RegisterModule ¶
Types ¶
type Config ¶
type Config struct { // The default code TTL CodeTTLDefault time.Duration `env:"CODE_TTL_DEFAULT"` // The maximum number of failed attempts for a verification request ConfirmationAttemptsMax int16 `env:"CONFIRMATION_ATTEMPTS_MAX"` // For use with SMS Retriever API https://developers.google.com/identity/sms-retriever/overview SMSRetrieverAppHash string `env:"SMS_RETRIEVER_APP_HASH"` // The SMS delivery service to use. SMSDeliveryService string `env:"SMS_DELIVERY_SERVICE,required"` // Configurations for modules Modules map[string]interface{} `env:",map,squash"` }
func ConfigSkeleton ¶
func ConfigSkeleton() Config
type ConfigurationError ¶
type ConfigurationError struct {
Err error
}
func (ConfigurationError) Error ¶
func (err ConfigurationError) Error() string
type GatewayError ¶
type GatewayError struct {
Err error
}
func (GatewayError) Error ¶
func (err GatewayError) Error() string
type InvalidPhoneNumberError ¶
type InvalidPhoneNumberError struct {
Err error
}
func (InvalidPhoneNumberError) Error ¶
func (err InvalidPhoneNumberError) Error() string
type Module ¶
type Module struct { ConfigSkeleton func() interface{} // returns pointer NewSMSDeliveryService func(config interface{}) SMSDeliveryService }
type PhoneNumberRegionNotSupportedError ¶
type PhoneNumberRegionNotSupportedError struct {
Err error
}
func (PhoneNumberRegionNotSupportedError) Error ¶
func (err PhoneNumberRegionNotSupportedError) Error() string
type SMSDeliveryService ¶
func NewSMSDeliveryService ¶
func NewSMSDeliveryService( serviceName string, config interface{}, ) (SMSDeliveryService, error)
type VerificationMethod ¶
type VerificationMethod int
const ( VerificationMethodUnspecified VerificationMethod = iota VerificationMethodNone VerificationMethodSMS )
func VerificationMethodFromString ¶
func VerificationMethodFromString(str string) VerificationMethod
type Verifier ¶
type Verifier struct {
// contains filtered or unexported fields
}
func (*Verifier) ConfirmVerification ¶
func (*Verifier) GetPhoneNumberByVerificationID ¶
func (verifier *Verifier) GetPhoneNumberByVerificationID( verificationID int64, ) (*iam.PhoneNumber, error)
func (*Verifier) GetVerificationCodeByPhoneNumber ¶
func (verifier *Verifier) GetVerificationCodeByPhoneNumber( phoneNumber iam.PhoneNumber, ) (code string, err error)
func (*Verifier) StartVerification ¶
func (verifier *Verifier) StartVerification( callCtx iam.CallContext, phoneNumber iam.PhoneNumber, codeTTL time.Duration, userPreferredLanguages []language.Tag, preferredVerificationMethods []VerificationMethod, ) (id int64, codeExpiry *time.Time, err error)
TODO(exa): make the operations atomic
Source Files ¶
Click to show internal directories.
Click to hide internal directories.