Documentation
¶
Overview ¶
Package auth provides some interfaces, implementations and utility function for telegram.UserAuthenticator.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrSignUpIsNotExpected = xerrors.New("signup call is not expected")
ErrSignUpIsNotExpected is returned, when sign up request from Telegram server is not expected.
Functions ¶
func Build ¶
func Build(cred Credentials, ask Ask) telegram.UserAuthenticator
Build creates new UserAuthenticator.
Types ¶
type Ask ¶
type Ask interface {
telegram.CodeAuthenticator
SignUpFlow
}
Ask represents parts of auth flow which requires user interaction.
func BuildAsk ¶
func BuildAsk(code telegram.CodeAuthenticator, signUp SignUpFlow) Ask
BuildAsk creates new Ask.
type AutoAccept ¶
type AutoAccept struct{}
AutoAccept is noop implementation of AcceptTermsOfService call.
func (AutoAccept) AcceptTermsOfService ¶
func (AutoAccept) AcceptTermsOfService(ctx context.Context, tos tg.HelpTermsOfService) error
AcceptTermsOfService partly implements SignUpFlow.
type Credentials ¶
type Credentials interface {
Phone(ctx context.Context) (string, error)
Password(ctx context.Context) (string, error)
}
Credentials represents Telegram user credentials.
type SignUpFlow ¶
type SignUpFlow interface {
AcceptTermsOfService(ctx context.Context, tos tg.HelpTermsOfService) error
SignUp(ctx context.Context) (telegram.UserInfo, error)
}
SignUpFlow is abstraction for user signup setup.
func ConstantSignUp ¶
func ConstantSignUp(info telegram.UserInfo) SignUpFlow
ConstantSignUp creates new SignUpFlow using given User info.
func NoSignUp ¶
func NoSignUp() SignUpFlow
NoSignUp creates new SignUpFlow which returns ErrSignUpIsNotExpected.
Directories
¶
| Path | Synopsis |
|---|---|
|
internal
|
|
|
tests
Package tests contains common storage tests and some test utilities.
|
Package tests contains common storage tests and some test utilities. |
|
Package kv contains wrapper implementations over generic KV storage.
|
Package kv contains wrapper implementations over generic KV storage. |
|
Package pebble contains gotd secret storage implementations using CockroachDB pebble.
|
Package pebble contains gotd secret storage implementations using CockroachDB pebble. |
|
Package redis contains gotd secret storage implementations using Redis.
|
Package redis contains gotd secret storage implementations using Redis. |
|
Package terminal contains authenticator implementation using terminal.
|
Package terminal contains authenticator implementation using terminal. |
|
Package vault contains gotd secret storage implementations using Hashicorp Vault.
|
Package vault contains gotd secret storage implementations using Hashicorp Vault. |