123456789_123456789_123456789_123456789_123456789_

Class: Mongo::Crypt::DataKeyContext Private

Do not use. This class is for internal use only.
Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
self, Context, Forwardable
Instance Chain:
self, Context
Inherits: Mongo::Crypt::Context
Defined in: lib/mongo/crypt/data_key_context.rb

Overview

A Context object initialized specifically for the purpose of creating a data key in the key management system.

Class Method Summary

Context - Inherited

.new

Create a new Context object.

Instance Attribute Summary

Context - Inherited

Instance Method Summary

Context - Inherited

#run_state_machine

Runs the mongocrypt_ctx_t state machine and handles all I/O on behalf of.

#state

Returns the state of the mongocrypt_ctx_t.

#azure_access_token

Returns an Azure access token, retrieving it if necessary.

#feed_kms,
#gcp_access_token

Retrieves a GCP access token.

#mongocrypt_done

Indicate that state machine is done feeding I/O responses back to libmongocrypt.

#mongocrypt_feed

Feeds the result of a ::Mongo operation back to libmongocrypt.

#provide_collection_info, #provide_keys, #provide_markings,
#retrieve_kms_credentials

Retrieves KMS credentials for providers that are configured for automatic credentials retrieval.

Instance Method Details

#initialize_ctx (private)

Initializes the underlying mongocrypt_ctx_t object

[ GitHub ]

  
# File 'lib/mongo/crypt/data_key_context.rb', line 68

def initialize_ctx
  Binding.ctx_datakey_init(self)
end

#set_key_alt_names(key_alt_names) (private)

Set the alt names option on the context

[ GitHub ]

  
# File 'lib/mongo/crypt/data_key_context.rb', line 52

def set_key_alt_names(key_alt_names)
  unless key_alt_names.is_a?(Array)
    raise ArgumentError.new, 'The :key_alt_names option must be an Array'
  end

  unless key_alt_names.all? { |key_alt_name| key_alt_name.is_a?(String) }
    raise ArgumentError.new(
      "#{key_alt_names} contains an invalid alternate key name. All " +
      "values of the :key_alt_names option Array must be Strings"
    )
  end

  Binding.ctx_setopt_key_alt_names(self, key_alt_names)
end