Method: Mongo::Crypt::ExplicitEncrypter#initialize

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

#initialize(key_vault_client, key_vault_namespace, kms_providers, kms_tls_options, timeout_ms = nil) ⇒ ExplicitEncrypter

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.

Create a new ExplicitEncrypter object.

Parameters:

  • key_vault_client (Mongo::Client)

    An instance of Mongo::Client to connect to the key vault collection.

  • key_vault_namespace (String)

    The namespace of the key vault collection in the format “db_name.collection_name”.

  • kms_providers (Crypt::KMS::Credentials)

    A hash of key management service configuration information.

  • kms_tls_options (Hash)

    TLS options to connect to KMS providers. Keys of the hash should be KSM provider names; values should be hashes of TLS connection options. The options are equivalent to TLS connection options of Mongo::Client.

  • timeout_ms (Integer | nil) (defaults to: nil)

    Timeout for every operation executed on this object.



40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/mongo/crypt/explicit_encrypter.rb', line 40

def initialize(key_vault_client, key_vault_namespace, kms_providers, kms_tls_options, timeout_ms = nil)
  Crypt.validate_ffi!
  @crypt_handle = Handle.new(
    kms_providers,
    kms_tls_options,
    explicit_encryption_only: true
  )
  @encryption_io = EncryptionIO.new(
    key_vault_client: key_vault_client,
    metadata_client: nil,
    key_vault_namespace: key_vault_namespace
  )
  @timeout_ms = timeout_ms
end