Skip to content

Commit

Permalink
various update
Browse files Browse the repository at this point in the history
  • Loading branch information
wiz0u committed Nov 27, 2024
1 parent 063c06f commit a160354
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 31 deletions.
3 changes: 1 addition & 2 deletions src/4/passport/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
25 changes: 24 additions & 1 deletion src/4/passport/errors.md
Original file line number Diff line number Diff line change
@@ -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)
Expand Down Expand Up @@ -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."
```
26 changes: 0 additions & 26 deletions src/4/passport/faq.md

This file was deleted.

2 changes: 1 addition & 1 deletion src/4/payments.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
3 changes: 2 additions & 1 deletion src/FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down

0 comments on commit a160354

Please sign in to comment.