From 166a0183f6cf67ec56c01e09645a114ca492d303 Mon Sep 17 00:00:00 2001 From: songl Date: Thu, 6 Jun 2024 14:35:19 +0500 Subject: [PATCH] =?UTF-8?q?=D0=9F=D0=BE=D0=BA=D0=B0=20=D1=87=D1=82=D0=BE?= =?UTF-8?q?=20=D1=82=D0=BE=D0=BB=D1=8C=D0=BA=D0=BE=20user=20contoller=20?= =?UTF-8?q?=D1=84=D0=B0=D0=B9=D0=BB=20=D1=81=D0=BE=D0=B7=D0=B4=D0=B0=D0=BB?= =?UTF-8?q?=20=D0=B8=20=D0=BF=D1=80=D0=B8=D0=BC=D0=B5=D1=80=20=D0=B3=D0=B5?= =?UTF-8?q?=D0=BD=D0=B5=D1=80=D0=B0=D1=82=D0=BE=D1=80=D0=B0=20=D1=82=D0=BE?= =?UTF-8?q?=D0=BA=D0=B5=D0=BD=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- controllers/userController.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/controllers/userController.go b/controllers/userController.go index 2d32936..9eba8e0 100644 --- a/controllers/userController.go +++ b/controllers/userController.go @@ -1 +1,19 @@ package controllers + +// Пример генератора токена + +import ( + "crypto/rand" + "fmt" +) + +func tokenGenerator() string { + b := make([]byte, 4) + rand.Read(b) + return fmt.Sprintf("%x", b) +} + +func main() { + a := tokenGenerator() + fmt.Println(a) +}