package ops
import "context"
type ctxArchiveReaderKey struct{}
// WithArchiveReader marks a request as one a sync-scoped credential is
// reading a repository's archive on, and names that repository. The
// forge's door sets it only for the archive route itself, so a gate
// that finds it knows the credential reaches exactly that one route.
func WithArchiveReader(ctx context.Context, repo string) context.Context {
return context.WithValue(ctx, ctxArchiveReaderKey{}, repo)
}
// ArchiveReaderOf is the repository WithArchiveReader named, or "".
func ArchiveReaderOf(ctx context.Context) string {
r, _ := ctx.Value(ctxArchiveReaderKey{}).(string)
return r
}