summaryrefslogtreecommitdiffstats
path: root/core/internal.go
blob: e00c0f2aef4668857e5f7112dddda76e1524e3e2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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
}