Skip to content

About

Go package for Telegram Login credentials verification

Resources

Stars

0 stars

Watchers

0 watching

Forks

 
 

Latest commit

 

History

24 Commits

Folders and files

Repository files navigation

telegram-auth-verifier

Go Reference

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.

About

Go package for Telegram Login credentials verification

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages