1
0
mirror of synced 2024-11-25 05:06:03 +03:00
mg-transport-telegram/token.go
Alex Lushpai acb2a62da5
Initial release (#1)
Routes
Migrations
Settings form
Activation/deactivation through retailCRM/MG Transport API
2018-05-17 18:35:53 +03:00

18 lines
294 B
Go

package main
import (
"crypto/sha256"
"fmt"
"sync/atomic"
"time"
)
var tokenCounter uint32
// GenerateToken function
func GenerateToken() string {
c := atomic.AddUint32(&tokenCounter, 1)
return fmt.Sprintf("%x", sha256.Sum256([]byte(fmt.Sprintf("%d%d", time.Now().UnixNano(), c))))
}