MONGOC_CLIENT_...VIDER_CALLBACK(3)

πŸŽ€ MONGOC_CLIENT_...VIDER_CALLBACK(3) πŸŽ€

okay so bestie, we're in the libmongoc manual, and this page is literally all about mongoc_client_encryption_opts_set_kms_credential_provider_callback β€” a function name so long it needs its own zip code πŸ’…

New in version 1.23.0.

✨ SYNOPSIS ✨

void
mongoc_client_encryption_opts_set_kms_credential_provider_callback (
  mongoc_client_encryption_opts_t *opts,
  mongoc_kms_credentials_provider_callback_fn fn,
  void *userdata);

πŸ¦‹ DESCRIPTION πŸ¦‹

This is the one where you set the user-provided callback that hands over KMS credentials on-demand β€” like, exactly when they're needed. no cap, that's the whole vibe. 🫢

🌸 PARAMETERS 🌸

  • opts β€” the options object you're updating, periodt.
  • fn β€” the provider callback you're setting on the options object. You can pass NULL here to clear the callback. go check out: mongoc_kms_credentials_provider_callback_fn ⭐
  • userdata β€” an arbitrary pointer, and libmongoc will pass it right along to the callback function when it calls it. it's giving "here, hold this" πŸŽ€

πŸ‘€ SEE ALSO πŸ‘€

mongoc_auto_encryption_opts_set_kms_credential_provider_callback()

type mongoc_kms_credentials_provider_callback_fn

typedef
bool (*mongoc_kms_credentials_provider_callback_fn) (void *userdata,
                                                     const bson_t *params,
                                                     bson_t *out,
                                                     bson_error_t *error);

This is the type of a callback function that provides KMS providers data on-demand. iconic behavior, honestly.

Parameters

  • userdata β€” the very same userdata pointer you handed over to the userdata parameter back when the callback was set. no switching up πŸ”₯
  • params β€” parameters for the requested KMS credentials. currently empty. (yes, empty. it's minimalism πŸ’…)
  • out β€” the output bson_t where you write the new KMS providers. important: when it gets passed to the callback, it already points to an empty BSON document that you absolutely must populate. don't leave it empty, bestie, that's not the assignment 😭
  • error β€” an output parameter for flagging any errors that might pop off while generating the KMS credentials.

Return value

Must return true on success, false on failure. that's it, that's the rule 🧚


πŸ‘‘ AUTHOR πŸ‘‘

MongoDB, Inc

2009-present, MongoDB, Inc.


okay and the cute little sign-off at the very end of the page: this is libmongoc 2.5.6, dated Oct 09 β€” and yes the original footer line is a little mangled (Oct 09, 202…), so we're just passing along the facts we got, fr fr. go forth and credential-provide, bestie. πŸ’–βœ¨πŸŒˆ

πŸ“¦ where this page comes from