We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 3863dfa commit 058e98aCopy full SHA for 058e98a
1 file changed
api/auth/auth.go
@@ -63,7 +63,9 @@ func (s *Server) Check(ctx context.Context, request *auth.CheckRequest) (res *au
63
64
var apiKey playerdb.ApiKey
65
if strings.HasPrefix(apiKeyStr, ApiKeyPrefix) {
66
- apiKey, err = s.store.GetApiKeyByHash(ctx, apiKeyStr[len(ApiKeyPrefix):])
+ h := sha256.Sum256([]byte(apiKeyStr))
67
+ hash := hex.EncodeToString(h[:])
68
+ apiKey, err = s.store.GetApiKeyByHash(ctx, hash)
69
if errors.Is(err, playerdb.ErrNoRows) {
70
apiKey.ID = ""
71
} else if err != nil {
0 commit comments