17 lines
502 B
Go
17 lines
502 B
Go
package harnesssecret
|
|
|
|
import "context"
|
|
|
|
type runCredentialKey struct{}
|
|
|
|
// WithRunCredential binds a proxy or launcher secret operation to its task grant.
|
|
func WithRunCredential(ctx context.Context, credential string) context.Context {
|
|
return context.WithValue(ctx, runCredentialKey{}, credential)
|
|
}
|
|
|
|
// RunCredential returns the task grant authorizing a secret operation.
|
|
func RunCredential(ctx context.Context) string {
|
|
credential, _ := ctx.Value(runCredentialKey{}).(string)
|
|
return credential
|
|
}
|