mirror of
https://github.com/netbirdio/netbird.git
synced 2024-11-07 16:54:16 +01:00
add id to the PAT
This commit is contained in:
parent
69be2a8071
commit
e0fc779f58
@ -8,9 +8,11 @@ import (
|
||||
"time"
|
||||
|
||||
"codeberg.org/ac/base62"
|
||||
"github.com/rs/xid"
|
||||
)
|
||||
|
||||
type PersonalAccessToken struct {
|
||||
ID string
|
||||
Description string
|
||||
HashedToken [32]byte
|
||||
ExpirationDate time.Time
|
||||
@ -38,6 +40,7 @@ func CreateNewPAT(description string, expirationInDays int, createdBy User) (*Pe
|
||||
hashedToken, plainToken := generateNewToken()
|
||||
currentTime := time.Now().UTC()
|
||||
return &PersonalAccessToken{
|
||||
ID: xid.New().String(),
|
||||
Description: description,
|
||||
HashedToken: hashedToken,
|
||||
ExpirationDate: currentTime.AddDate(0, 0, expirationInDays),
|
||||
|
Loading…
Reference in New Issue
Block a user