// WithUnboxer returns an Unboxer for unboxing credentials within the context
// of the provided keypairs.
16957
func (e *Engine) WithUnboxer(ctx context.Context, encMec, mecNonce []byte,
	privKP *EncryptionKeyPair, pubKey []byte, fn func(Unboxer) error) error {

	mek, err := e.Unbox(ctx, encMec, mecNonce, privKP, pubKey)
	if err != nil {
		return err
	}
	defer mek.Destroy()

	err = ctxutil.ErrIfDone(ctx)
	if err != nil {
		return err
	}

	u := unboxerImpl{mek: mek}
	return fn(&u)
}
500386
func (c *cloudSpecAuth) WithAuthorization() autorest.PrepareDecorator {
	return func(p autorest.Preparer) autorest.Preparer {
		return autorest.PreparerFunc(func(r *http.Request) (*http.Request, error) {
			r, err := p.Prepare(r)
			if err != nil {
				return nil, err
			}
			token, err := c.getToken()
			if err != nil {
				return nil, err
			}
			authorizer := autorest.NewBearerAuthorizer(token)
			return autorest.CreatePreparer(authorizer.WithAuthorization()).Prepare(r)
		})
	}
}
819491
func WithKeyGetter(KeyGetter KeyGetter) Option {
	return option(func(middleware *Middleware) {
		middleware.KeyGetter = KeyGetter
	})
}
1349625
func (o *GetNodesIdentifierWorkflowsParams) WithIdentifier(identifier string) *GetNodesIdentifierWorkflowsParams {
	o.Identifier = identifier
	return o
}
474547
func (c *smatContext) withPair(v int, cb func(*smatPair)) {
	if len(c.pairs) > 0 {
		if v < 0 {
			v = -v
		}
		v = v % len(c.pairs)
		cb(c.pairs[v])
	}
}
1252695
func WithRetryer(cfg *aws.Config, retryer Retryer) *aws.Config {
	cfg.Retryer = retryer
	return cfg
}
1232392
func (o *GetPollersIdentifierDataParams) WithIdentifier(identifier string) *GetPollersIdentifierDataParams {
	o.Identifier = identifier
	return o
}
174276
func WithNoNewKeyring(ctx context.Context, c *Client, ti *TaskInfo) error {
	if CheckRuntime(ti.Runtime(), "io.containerd.runc") {
		if ti.Options == nil {
			ti.Options = &options.Options{}
		}
		opts, ok := ti.Options.(*options.Options)
		if !ok {
			return errors.New("invalid v2 shim create options format")
		}
		opts.NoNewKeyring = true
	} else {
		if ti.Options == nil {
			ti.Options = &runctypes.CreateOptions{}
		}
		opts, ok := ti.Options.(*runctypes.CreateOptions)
		if !ok {
			return errors.New("could not cast TaskInfo Options to CreateOptions")
		}
		opts.NoNewKeyring = true
	}
	return nil
}
980977
func WithKeyHashPNM(keyHash *chainhash.Hash, p uint8, n uint32,
	m uint64) *GCSBuilder {

	return WithKeyPNM(DeriveKey(keyHash), p, n, m)
}
668134
func WithProviders(providers ...common.Provider) *ProviderList {
	GetSecurityKey()
	list := &ProviderList{providers}
	SharedProviderList = list
	return list
}
359146
func (c *Crypto) Unbox(ctx context.Context, teamSpec keybase1.TeamIDWithVisibility, metadata *keybase1.EncryptedGitMetadata) (plaintext []byte, err error) {
	defer c.G().CTrace(ctx, fmt.Sprintf("git.Crypto#Unbox(%s, vis:%v)", teamSpec.TeamID, teamSpec.Visibility), func() error { return err })()

	if metadata.V != 1 {
		return nil, fmt.Errorf("invalid EncryptedGitMetadata version: %d", metadata.V)
	}

	public := teamSpec.Visibility == keybase1.TLFVisibility_PUBLIC

	var needKeyGeneration keybase1.PerTeamKeyGeneration
	if !public {
		needKeyGeneration = metadata.Gen
	}
	team, err := c.loadTeam(ctx, teamSpec, needKeyGeneration)
	if err != nil {
		return nil, err
	}

	key := publicCryptKey
	if !public {
		key, err = team.ApplicationKeyAtGeneration(ctx, keybase1.TeamApplication_GIT_METADATA, metadata.Gen)
		if err != nil {
			return nil, err
		}
	}

	var encKey [libkb.NaclSecretBoxKeySize]byte = key.Key
	var naclNonce [libkb.NaclDHNonceSize]byte = metadata.N

	plaintext, ok := secretbox.Open(nil, metadata.E, &naclNonce, &encKey)
	if !ok {
		return nil, libkb.DecryptOpenError{}
	}
	return plaintext, nil
}
707560
func (o *GetNodesIdentifierWorkflowsActiveParams) WithIdentifier(identifier string) *GetNodesIdentifierWorkflowsActiveParams {
	o.Identifier = identifier
	return o
}
1368758
func (o *GetCatalogsIdentifierParams) WithIdentifier(identifier string) *GetCatalogsIdentifierParams {
	o.Identifier = identifier
	return o
}
936679
func (m *RegistryMemory) WithOAuth2Provider(f fosite.OAuth2Provider) *RegistryMemory {
	m.RegistryBase.fop = f
	return m
}
417722
func NewTokenHandlerWithOptions(options TokenHandlerOptions) AuthenticationHandler {
	handler := &tokenHandler{
		transport:     options.Transport,
		creds:         options.Credentials,
		offlineAccess: options.OfflineAccess,
		forceOAuth:    options.ForceOAuth,
		clientID:      options.ClientID,
		scopes:        options.Scopes,
		clock:         realClock{},
		logger:        options.Logger,
	}

	return handler
}
1088961
func WithPullUnpack(_ *Client, c *RemoteContext) error {
	c.Unpack = true
	return nil
}
1106773
func (o *PatchSkusIdentifierParams) WithIdentifier(identifier string) *PatchSkusIdentifierParams {
	o.Identifier = identifier
	return o
}