From a160354bd0f8e9dda033bf3bf3474f1400c84c13 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Wed, 27 Nov 2024 01:28:58 +0100 Subject: [PATCH] various update --- src/4/passport/README.md | 3 +-- src/4/passport/errors.md | 25 ++++++++++++++++++++++++- src/4/passport/faq.md | 26 -------------------------- src/4/payments.md | 2 +- src/FAQ.md | 3 ++- 5 files changed, 28 insertions(+), 31 deletions(-) delete mode 100644 src/4/passport/faq.md diff --git a/src/4/passport/README.md b/src/4/passport/README.md index 12070a8b..1f233db1 100644 --- a/src/4/passport/README.md +++ b/src/4/passport/README.md @@ -6,9 +6,8 @@ - [Quickstart](quickstart.md) - [Files & Documents](files-docs.md) -- [Data Errors](errors.md) +- [Handling Errors](errors.md) - [RSA Key](key.md) -- [Decryption FAQ](faq.md) ![telegram passport](../docs/photo-tg_passport.gif) diff --git a/src/4/passport/errors.md b/src/4/passport/errors.md index d2516498..b977814c 100644 --- a/src/4/passport/errors.md +++ b/src/4/passport/errors.md @@ -1,4 +1,6 @@ -# Passport Data Errors +# Handling Passport errors + +## Handling Data Errors [![setPassportDataErrors method](https://img.shields.io/badge/Bot_API_method-setPassportDataErrors-blue.svg?style=flat-square)](https://core.telegram.org/bots/api#setpassportdataerrors) [![Passport Element Errors tests](https://img.shields.io/badge/Examples-Passport_Element_Errors-green.svg?style=flat-square)](https://github.com/TelegramBots/Telegram.Bot.Extensions.Passport/tree/master/test/IntegrationTests/Passport%20Element%20Errors) @@ -41,3 +43,24 @@ PassportElementError[] errors = await bot.SetPassportDataErrors(passportMessage.From.Id, errors); ``` + +## Decryption error (`PassportDataDecryptionException`) + +Methods on [`IDecrypter`](https://github.com/TelegramBots/Telegram.Bot.Extensions.Passport/blob/master/src/Telegram.Bot.Extensions.Passport/Decryption/IDecrypter.cs) +might throw [`PassportDataDecryptionException`](https://github.com/TelegramBots/Telegram.Bot.Extensions.Passport/blob/master/src/Telegram.Bot.Extensions.Passport/Decryption/PassportDataDecryptionException.cs) exception +if an error happens during decryption. +The exception message tells you what went wrong but there is not much you can do to resolve it. +Maybe let your user know the issue and ask for Passport data again. + +It is important to pass each piece of encrypted data, e.g. Id Document, Passport File, etc., with the right +accompanying credentials to decryption methods. + +Spot the _problem in this code_ decrypting driver's license files: + +```c# +byte[] selfieContent = decrypter.DecryptFile( + encSelfieContent, // byte array of encrypted selfie file + credentials.SecureData.DriverLicense.FrontSide // WRONG! use selfie file credentials +); +// throws PassportDataDecryptionException: "Data hash mismatch at position 123." +``` diff --git a/src/4/passport/faq.md b/src/4/passport/faq.md deleted file mode 100644 index 55404dcc..00000000 --- a/src/4/passport/faq.md +++ /dev/null @@ -1,26 +0,0 @@ -# Telegram Passport Data Decryption - FAQ - -## What is `PassportDataDecryptionException` - -Methods on [`IDecrypter`] might throw [`PassportDataDecryptionException`] exception -if an error happens during decryption. -The exception message tells you what went wrong but there is not much you can do to resolve it. -Maybe let your user know the issue and ask for Passport data again. - -It is important to pass each piece of encrypted data, e.g. Id Document, Passport File, etc., with the right -accompanying credentials to decryption methods. - -Spot the _problem in this code_ decrypting driver's license files: - -```c# -byte[] selfieContent = decrypter.DecryptFile( - encSelfieContent, // byte array of encrypted selfie file - credentials.SecureData.DriverLicense.FrontSide // WRONG! use selfie file credentials -); -// throws PassportDataDecryptionException: "Data hash mismatch at position 123." -``` - - - -[`IDecrypter`]: https://github.com/TelegramBots/Telegram.Bot.Extensions.Passport/blob/master/src/Telegram.Bot.Extensions.Passport/Decryption/IDecrypter.cs -[`PassportDataDecryptionException`]: https://github.com/TelegramBots/Telegram.Bot.Extensions.Passport/blob/master/src/Telegram.Bot.Extensions.Passport/Decryption/PassportDataDecryptionException.cs diff --git a/src/4/payments.md b/src/4/payments.md index d4f209c1..f50bc429 100644 --- a/src/4/payments.md +++ b/src/4/payments.md @@ -7,7 +7,7 @@ Telegram offers a safe, simple and unified payment system for goods and services Due to Google/Apple policies, there is a distinction between: - **Digital Goods & Services**, which can be paid using [Telegram Stars](https://telegram.org/blog/telegram-stars) (XTR) only -- **Physical Goods**, which can be paid using real money, and can request more details like a shipping address. +- **Physical Goods**, which can be paid using regular currencies, and can request more details like a shipping address. Both process are similar, so we will demonstrate how to do a Telegram Stars payment (simpler) and give you some info about the difference for Physical Goods. diff --git a/src/FAQ.md b/src/FAQ.md index 540530b4..c151f785 100644 --- a/src/FAQ.md +++ b/src/FAQ.md @@ -88,7 +88,8 @@ You can either do this via [@BotFather](https://t.me/BotFather) _(static entries ⚠️ This menu can only be filled with bot commands, starting with a `/` and containing only latin characters `a-z_0-9` ### _18. How to receive `ChatMember` updates?_ -You should specify all update types **including ChatMember** in `AllowedUpdates` array on `StartReceiving`:`ReceiverOptions` or `SetWebhook` +You should specify all update types **including ChatMember** in `AllowedUpdates` array on `StartReceiving`:`ReceiverOptions` or `SetWebhook` +[More details here](2/chats.md#detecting-new-group-members-and-changed-member-status) ### _19. How to get rid of past updates when I restart my bot?_ Pass true into `StartReceiving`:`ReceiverOptions`:`DropPendingUpdates` or `SetWebhook`:`dropPendingUpdates`