From 51c603afe0373f45f8d389c99cac9d3aec959b75 Mon Sep 17 00:00:00 2001 From: bt Date: Sun, 24 May 2026 18:52:58 +0200 Subject: [common] Users and permissions database --- core/internal.go | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 core/internal.go (limited to 'core') diff --git a/core/internal.go b/core/internal.go new file mode 100644 index 0000000..e00c0f2 --- /dev/null +++ b/core/internal.go @@ -0,0 +1,24 @@ +package core + +import ( + "encoding/base64" + + "golang.org/x/crypto/bcrypt" +) + +type UserData struct { + Name string + Pass string +} + +type PermissionData struct { + User string + Channel string + Read bool + Write bool +} + +func HashPass(pass string) (string, error) { + hash, err := bcrypt.GenerateFromPassword([]byte(pass), 12) + return base64.StdEncoding.EncodeToString(hash), err +} -- cgit v1.2.3