Method: Mongo::Crypt::EncryptionIO#initialize

Defined in:
lib/mongo/crypt/encryption_io.rb

#initialize(client: nil, mongocryptd_client: nil, key_vault_namespace:, key_vault_client:, metadata_client:, mongocryptd_options: {}) ⇒ EncryptionIO

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Note:

When being used for auto encryption, all arguments are required. When being used for explicit encryption, only the key_vault_namespace and key_vault_client arguments are required.

Note:

This class expects that the key_vault_client and key_vault_namespace options are not nil and are in the correct format.

Creates a new EncryptionIO object with information about how to connect to the key vault.

Parameters:

  • (defaults to: nil)

    The client used to connect to the collection that stores the encrypted documents, defaults to nil.

  • (defaults to: nil)

    The client connected to mongocryptd, defaults to nil.

  • The client connected to the key vault collection.

  • The client to be used to obtain collection metadata.

  • The key vault namespace in the format db_name.collection_name.

  • (defaults to: {})

    Options related to mongocryptd.

Options Hash (mongocryptd_options:):

  • :mongocryptd_bypass_spawn (Boolean)
  • :mongocryptd_spawn_path (String)
  • :mongocryptd_spawn_args (Array<String>)

API:

  • private



57
58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/mongo/crypt/encryption_io.rb', line 57

def initialize(
  client: nil, mongocryptd_client: nil, key_vault_namespace:,
  key_vault_client:, metadata_client:, mongocryptd_options: {}
)
  validate_key_vault_client!(key_vault_client)
  validate_key_vault_namespace!(key_vault_namespace)

  @client = client
  @mongocryptd_client = mongocryptd_client
  @key_vault_db_name, @key_vault_collection_name = key_vault_namespace.split('.')
  @key_vault_client = key_vault_client
   = 
  @options = mongocryptd_options
end