Skip to content

Commit

Permalink
remove unused keys
Browse files Browse the repository at this point in the history
  • Loading branch information
klaidliadon committed Jul 10, 2024
1 parent 3d5126c commit 9bad32c
Showing 1 changed file with 0 additions and 20 deletions.
20 changes: 0 additions & 20 deletions middleware/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (

"github.com/0xsequence/quotacontrol/proto"
"github.com/go-chi/httprate"
"github.com/lestrrat-go/jwx/v2/jwt"
)

const (
Expand Down Expand Up @@ -116,8 +115,6 @@ var (
ctxKeySessionType = &contextKey{"SessionType"}
ctxKeyAccount = &contextKey{"Account"}
ctxKeyService = &contextKey{"Service"}
ctxKeyJWT = &contextKey{"JWT"}
ctxKeyClaims = &contextKey{"Claims"}
ctxKeyAccessKey = &contextKey{"AccessKey"}
ctxKeyAccessQuota = &contextKey{"AccessQuota"}
ctxKeyProjectID = &contextKey{"ProjectID"}
Expand Down Expand Up @@ -248,20 +245,3 @@ func HasSpending(ctx context.Context) bool {
_, ok := ctx.Value(ctxKeySpending).(struct{})
return ok
}

// withJWT sets the JWT to the context.
func withJWT(ctx context.Context, token jwt.Token, claims Claims) context.Context {
return context.WithValue(context.WithValue(ctx, ctxKeyJWT, token), ctxKeyClaims, claims)
}

func getJWT(ctx context.Context) (jwt.Token, Claims, bool) {
token, ok := ctx.Value(ctxKeyJWT).(jwt.Token)
if !ok {
return nil, nil, false
}
claims, ok := ctx.Value(ctxKeyClaims).(Claims)
if !ok {
return nil, nil, false
}
return token, claims, ok
}

0 comments on commit 9bad32c

Please sign in to comment.