Debian Codegraph @

token/context.go

raw symbols SCIP
1 package token
2
3 import "context"
4
5 type ctxKey int
6
7 var ctxKeyID ctxKey = 1
8
9 func WithKeyID(ctx context.Context, keyID []byte) context.Context {
10 return context.WithValue(ctx, ctxKeyID, keyID)
11 }
12
13 func KeyID(ctx context.Context) []byte {
14 keyID, _ := ctx.Value(ctxKeyID).([]byte)
15 return keyID
16 }