mirror of
https://github.com/netbirdio/netbird.git
synced 2024-11-07 16:54:16 +01:00
fixed some namings
This commit is contained in:
parent
2f2d45de9e
commit
95d87384ab
@ -32,7 +32,7 @@ func CreateNewPAT(description string, expirationInDays int, createdBy string) (*
|
||||
ExpirationDate: currentTime.AddDate(0, 0, expirationInDays),
|
||||
CreatedBy: createdBy,
|
||||
CreatedAt: currentTime,
|
||||
LastUsed: currentTime, // using creation time as nil not possible
|
||||
LastUsed: currentTime,
|
||||
}, plainToken
|
||||
}
|
||||
|
||||
|
@ -18,8 +18,8 @@ func TestPAT_GenerateToken_Hashing(t *testing.T) {
|
||||
|
||||
func TestPAT_GenerateToken_Prefix(t *testing.T) {
|
||||
_, plainToken := generateNewToken()
|
||||
fourLetterPrefix := plainToken[:4]
|
||||
assert.Equal(t, "nbp_", fourLetterPrefix)
|
||||
fourCharPrefix := plainToken[:4]
|
||||
assert.Equal(t, "nbp_", fourCharPrefix)
|
||||
}
|
||||
|
||||
func TestPAT_GenerateToken_Checksum(t *testing.T) {
|
||||
@ -28,10 +28,10 @@ func TestPAT_GenerateToken_Checksum(t *testing.T) {
|
||||
if len(tokenWithoutPrefix) != 36 {
|
||||
t.Fatal("Token has wrong length")
|
||||
}
|
||||
token := tokenWithoutPrefix[:len(tokenWithoutPrefix)-6]
|
||||
secret := tokenWithoutPrefix[:len(tokenWithoutPrefix)-6]
|
||||
tokenCheckSum := tokenWithoutPrefix[len(tokenWithoutPrefix)-6:]
|
||||
|
||||
expectedChecksum := crc32.ChecksumIEEE([]byte(token))
|
||||
expectedChecksum := crc32.ChecksumIEEE([]byte(secret))
|
||||
actualChecksum, err := base62.Decode(tokenCheckSum)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
|
Loading…
Reference in New Issue
Block a user