FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

electrofocus/telegram-auth-verifier: Go package for Telegram Login credentials verification · GitHub

Latest commit

 

History

24 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

telegram-auth-verifier

About

Here's the Go package for Telegram Website Login credentials verification.

This package uses semantic versioning v2.0.0, so you can be sure of backward compatibility of API.

Install

With a correctly configured Go toolchain run:

go get github.com/electrofocus/telegram-auth-verifier

Example

Let's verify credentials:

package main

import (
	"encoding/json"
	"fmt"

	tgverifier "github.com/electrofocus/telegram-auth-verifier"
)

func main() {
	var (
		token = []byte("Your Telegram Bot Token")
		creds tgverifier.Credentials
	)

	rawCreds := `{
		"id": 111111111,
		"first_name": "John",
		"last_name": "Doe",
		"username": "johndoe",
		"auth_date": 1615974774,
		"hash": "ae1b08443b7bb50295be3961084c106072798cb65e91995a1b49927cd4cc5b0c"
	}`

	json.Unmarshal([]byte(rawCreds), &creds)

	if err := creds.Verify(token); err != nil {
		fmt.Println("Credentials are not from Telegram")
		return
	}

	fmt.Println("Credentials are from Telegram")
}

Open above example in The Go Playground.

Releases

Used by

Contributors

Languages


Back | FazBrowse Home | New Git URL