From ed470d7dbeec1393b3ce4f67b387dd514d2b336a Mon Sep 17 00:00:00 2001 From: Pascal Fischer Date: Mon, 6 Mar 2023 14:46:04 +0100 Subject: [PATCH] add comments for exported functions --- management/server/personal_access_token.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/management/server/personal_access_token.go b/management/server/personal_access_token.go index a4b382c9c..291312794 100644 --- a/management/server/personal_access_token.go +++ b/management/server/personal_access_token.go @@ -11,6 +11,7 @@ import ( "github.com/rs/xid" ) +// PersonalAccessToken holds all information about a PAT including a hashed version of it for verification type PersonalAccessToken struct { ID string Description string @@ -22,6 +23,8 @@ type PersonalAccessToken struct { 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) { hashedToken, plainToken := generateNewToken() currentTime := time.Now().UTC()