diff options
Diffstat (limited to 'vendor/github.com/smallstep/certificates/authority/provisioner/method.go')
| -rw-r--r-- | vendor/github.com/smallstep/certificates/authority/provisioner/method.go | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/vendor/github.com/smallstep/certificates/authority/provisioner/method.go b/vendor/github.com/smallstep/certificates/authority/provisioner/method.go index 19aa622..d01ce12 100644 --- a/vendor/github.com/smallstep/certificates/authority/provisioner/method.go +++ b/vendor/github.com/smallstep/certificates/authority/provisioner/method.go @@ -78,3 +78,17 @@ func TokenFromContext(ctx context.Context) (string, bool) { token, ok := ctx.Value(tokenKey{}).(string) return token, ok } + +// The key to save the certTypeKey in the context. +type certTypeKey struct{} + +// NewContextWithCertType creates a new context with the given CertType. +func NewContextWithCertType(ctx context.Context, certType string) context.Context { + return context.WithValue(ctx, certTypeKey{}, certType) +} + +// CertTypeFromContext returns the certType stored in the given context. +func CertTypeFromContext(ctx context.Context) (string, bool) { + certType, ok := ctx.Value(certTypeKey{}).(string) + return certType, ok +} |
