Skip to content

Fixes TelegramMessenger/Telegram-iOS#1613#1614

Open
artyom-89 wants to merge 1 commit intoTelegramMessenger:masterfrom
artyom-89:master
Open

Fixes TelegramMessenger/Telegram-iOS#1613#1614
artyom-89 wants to merge 1 commit intoTelegramMessenger:masterfrom
artyom-89:master

Conversation

@artyom-89
Copy link

No description provided.

@masodden-fail
Copy link

masodden-fail commented Dec 11, 2024

@laktyushin Please merge this. We catch hundreds of sentry errors every day

image
Copy link

@SoeAung95 SoeAung95 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gh extension install github/gh-copilot

Copy link

@SoeAung95 SoeAung95 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

R

Copy link

@SoeAung95 SoeAung95 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix_Req

Copy link

@SoeAung95 SoeAung95 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#!/usr/bin/env bash

set -o pipefail

client_id=$1 # Client ID as first argument

pem=$( cat $2 ) # file path of the private key as second argument

now=$(date +%s)
iat=$((${now} - 60)) # Issues 60 seconds in the past
exp=$((${now} + 600)) # Expires 10 minutes in the future

b64enc() { openssl base64 | tr -d '=' | tr '/+' '_-' | tr -d '\n'; }

header_json='{
"typ":"JWT",
"alg":"RS256"
}'

Header encode

header=$( echo -n "${header_json}" | b64enc )

payload_json="{
"iat":${iat},
"exp":${exp},
"iss":"${client_id}"
}"

Payload encode

payload=$( echo -n "${payload_json}" | b64enc )

Signature

header_payload="${header}"."${payload}"
signature=$(
openssl dgst -sha256 -sign <(echo -n "${pem}")
<(echo -n "${header_payload}") | b64enc
)

Create JWT

JWT="${header_payload}"."${signature}"
printf '%s\n' "JWT: $JWT"

@kennet31526
Copy link

Welcome

@Kharabet
Copy link

Please guys merge it finally. Just a typo during function rename, and it causes so much pain 🙏

@aerialist7
Copy link

aerialist7 commented Feb 27, 2025

@Kharabet, @maltsev25, @xximwon, @Pjrich1313, @Olevordkiy32, @kennet31526, @Brent108-gjgy, @Kashy9027, team, when it will be released? Very annoying bug, please help

@artyom-89
Copy link
Author

Additionally, I created a bug report here https://bugs.telegram.org/c/48753, on a specialized telegram platform

@alxmiron
Copy link

We are collecting 3k Sentry events for the last 90 days just because of this typo
Please merge

Copy link

@Olevordkiy32 Olevordkiy32 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🫡🫡🫡🫡

@aerialist7
Copy link

And when it will be released?
Or you just kidding us? :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet