mirror of
https://github.com/netbirdio/netbird.git
synced 2025-06-19 17:31:39 +02:00
fixed some namings
This commit is contained in:
parent
95d87384ab
commit
bcac5f7b32
@ -37,12 +37,12 @@ func CreateNewPAT(description string, expirationInDays int, createdBy string) (*
|
|||||||
}
|
}
|
||||||
|
|
||||||
func generateNewToken() ([32]byte, string) {
|
func generateNewToken() ([32]byte, string) {
|
||||||
token := randStringRunes(30)
|
secret := randStringRunes(30)
|
||||||
|
|
||||||
checksum := crc32.ChecksumIEEE([]byte(token))
|
checksum := crc32.ChecksumIEEE([]byte(secret))
|
||||||
encodedChecksum := base62.Encode(checksum)
|
encodedChecksum := base62.Encode(checksum)
|
||||||
paddedChecksum := fmt.Sprintf("%06s", encodedChecksum)
|
paddedChecksum := fmt.Sprintf("%06s", encodedChecksum)
|
||||||
plainToken := "nbp_" + token + paddedChecksum
|
plainToken := "nbp_" + secret + paddedChecksum
|
||||||
hashedToken := sha256.Sum256([]byte(plainToken))
|
hashedToken := sha256.Sum256([]byte(plainToken))
|
||||||
return hashedToken, plainToken
|
return hashedToken, plainToken
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user