acb2a62da5
Routes Migrations Settings form Activation/deactivation through retailCRM/MG Transport API
18 lines
294 B
Go
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))))
|
|
}
|