JWT token based auth

This commit is contained in:
David Zhao
2020-12-25 22:31:11 -08:00
parent 8f34bd6086
commit 804b7cb332
33 changed files with 1169 additions and 194 deletions
+1
View File
@@ -9,6 +9,7 @@ const (
NodePrefix = "ND_"
ParticipantPrefix = "PA_"
TrackPrefix = "TR_"
APIKeyPrefix = "API"
)
func NewGuid(prefix string) string {
+12
View File
@@ -0,0 +1,12 @@
package utils
import (
"github.com/google/uuid"
"github.com/lytics/base62"
)
func RandomSecret() string {
// cannot error
bin, _ := uuid.New().MarshalBinary()
return base62.StdEncoding.EncodeToString(bin)
}