mirror of
https://github.com/netbirdio/netbird.git
synced 2025-05-29 14:22:41 +02:00
add comments for exported functions
This commit is contained in:
parent
cb8abacadd
commit
ed470d7dbe
@ -11,6 +11,7 @@ import (
|
|||||||
"github.com/rs/xid"
|
"github.com/rs/xid"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// PersonalAccessToken holds all information about a PAT including a hashed version of it for verification
|
||||||
type PersonalAccessToken struct {
|
type PersonalAccessToken struct {
|
||||||
ID string
|
ID string
|
||||||
Description string
|
Description string
|
||||||
@ -22,6 +23,8 @@ type PersonalAccessToken struct {
|
|||||||
LastUsed time.Time
|
LastUsed time.Time
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CreateNewPAT will generate a new PersonalAccessToken that can be assigned to a User.
|
||||||
|
// Additionally, it will return the token in plain text once, to give to the user and only save a hashed version
|
||||||
func CreateNewPAT(description string, expirationInDays int, createdBy string) (*PersonalAccessToken, string) {
|
func CreateNewPAT(description string, expirationInDays int, createdBy string) (*PersonalAccessToken, string) {
|
||||||
hashedToken, plainToken := generateNewToken()
|
hashedToken, plainToken := generateNewToken()
|
||||||
currentTime := time.Now().UTC()
|
currentTime := time.Now().UTC()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user