Documentation ¶
Index ¶
- Constants
- func DecryptCredentials(ecreds tg.EncryptedCredentials, priv *rsa.PrivateKey, nonce string) (*tgpassport.Credentials, error)
- func DecryptData[T tgpassport.DataType](creds tgpassport.DataCredentials, data string) (*T, error)
- func DecryptFile(creds tgpassport.FileCredentials, fileData []byte) ([]byte, error)
- func SetPassportDataErrors(a *api.API, userID int, errs []tgpassport.PassportElementError) error
- type RequestParams
- type Scope
- type ScopeElement
- type ScopeElementOne
- type ScopeElementOneOfSeveral
Constants ¶
const ( // ScopeIDDocument is an alias for one of "passport", "driver_license", or "identity_card". ScopeIDDocument tg.PassportElementType = "id_document" // ScopeAddressDocument is an alias for one of "utility_bill", "bank_statement", or "rental_agreement". ScopeAddressDocument tg.PassportElementType = "address_document" )
Variables ¶
This section is empty.
Functions ¶
func DecryptCredentials ¶
func DecryptCredentials(ecreds tg.EncryptedCredentials, priv *rsa.PrivateKey, nonce string) (*tgpassport.Credentials, error)
DecryptCredentials decrypts telegram encrypted passport credentials.
func DecryptData ¶
func DecryptData[T tgpassport.DataType](creds tgpassport.DataCredentials, data string) (*T, error)
DecryptData decrypts base64-encoded encrypted data.
func DecryptFile ¶
func DecryptFile(creds tgpassport.FileCredentials, fileData []byte) ([]byte, error)
DecryptFile decrypts encrypted file data.
func SetPassportDataErrors ¶
func SetPassportDataErrors(a *api.API, userID int, errs []tgpassport.PassportElementError) error
SetPassportDataErrors informs a user that some of the Telegram Passport elements they provided contains errors. The user will not be able to re-submit their Passport to you until the errors are fixed.
Types ¶
type RequestParams ¶
type RequestParams struct { BotID int Scope Scope // Public key of the bot. PublicKey string // Bot-specified nonce. // For security purposes it should be a cryptographically secure unique identifier of the request. Nonce string }
RequestParams contains parameters to request information.
func (*RequestParams) Query ¶
func (p *RequestParams) Query() (url.Values, error)
Query generates query part of the request URI.
func (*RequestParams) URI ¶
func (p *RequestParams) URI() (string, error)
URI generates request URI.
type Scope ¶
type Scope struct { Data []ScopeElement `json:"data"` V int `json:"v"` // must be 1 }
Scope represents the data to be requested.
type ScopeElement ¶
type ScopeElement interface {
// contains filtered or unexported methods
}
ScopeElement represents a requested element.
type ScopeElementOne ¶
type ScopeElementOne struct { // Element type. One of "personal_details", "passport", "driver_license", "identity_card", // "internal_passport", "address", "utility_bill", "bank_statement", "rental_agreement", // "passport_registration", "temporary_registration", "phone_number", "email" Type tg.PassportElementType `json:"type"` // Use this parameter if you want to request a selfie with the document as well. // Available for "passport", "driver_license", "identity_card" and "internal_passport" Selfie bool `json:"selfie,omitempty"` // Use this parameter if you want to request a translation of the document as well. // Available for "passport", "driver_license", "identity_card", "internal_passport", // "utility_bill", "bank_statement", "rental_agreement", "passport_registration" and "temporary_registration". Translation bool `json:"translation,omitempty"` // Use this parameter to request the first, last and middle name of the user in the language of the user's country of residence. // Available for "personal_details" NativeNames bool `json:"native_names,omitempty"` }
ScopeElementOne represents one particular element that must be provided.
type ScopeElementOneOfSeveral ¶
type ScopeElementOneOfSeveral struct { // List of elements one of which must be provided; // must contain either several of “passport”, “driver_license”, “identity_card”, // “internal_passport” or several of “utility_bill”, “bank_statement”, “rental_agreement”, // “passport_registration”, “temporary_registration” OneOf []ScopeElementOne `json:"one_of"` // Use this parameter if you want to request a selfie with the document from this list that the user chooses to upload. Selfie bool `json:"selfie,omitempty"` // Use this parameter if you want to request a translation of the document from this list that the user chooses to upload. Translation bool `json:"translation,omitempty"` }
ScopeElementOneOfSeveral represents several elements one of which must be provided.