Skip to content

Commit 3a58aa8

Browse files
committed
feat(NODE-6695): enable KMS retry protocol
1 parent faea384 commit 3a58aa8

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

addon/mongocrypt.cc

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -575,6 +575,8 @@ MongoCrypt::MongoCrypt(const CallbackInfo& info) : ObjectWrap(info) {
575575

576576
mongocrypt_setopt_use_need_kms_credentials_state(mongo_crypt());
577577

578+
mongocrypt_setopt_retry_kms(mongo_crypt(), true);
579+
578580
// Initialize after all options are set.
579581
if (!mongocrypt_init(mongo_crypt())) {
580582
throw TypeError::New(Env(), errorStringFromStatus(mongo_crypt()));
@@ -947,6 +949,8 @@ Function MongoCryptKMSRequest::Init(Napi::Env env) {
947949
{InstanceMethod("addResponse", &MongoCryptKMSRequest::AddResponse),
948950
InstanceAccessor("status", &MongoCryptKMSRequest::Status, nullptr),
949951
InstanceAccessor("bytesNeeded", &MongoCryptKMSRequest::BytesNeeded, nullptr),
952+
InstanceAccessor("uSleep", &MongoCryptKMSRequest::USleep, nullptr),
953+
InstanceAccessor("fail", &MongoCryptKMSRequest::Fail, nullptr),
950954
InstanceAccessor("kmsProvider", &MongoCryptKMSRequest::KMSProvider, nullptr),
951955
InstanceAccessor("endpoint", &MongoCryptKMSRequest::Endpoint, nullptr),
952956
InstanceAccessor("message", &MongoCryptKMSRequest::Message, nullptr)});
@@ -977,6 +981,14 @@ Value MongoCryptKMSRequest::BytesNeeded(const CallbackInfo& info) {
977981
return Number::New(Env(), mongocrypt_kms_ctx_bytes_needed(_kms_context));
978982
}
979983

984+
Value MongoCryptKMSRequest::USleep(const CallbackInfo& info) {
985+
return Number::New(Env(), mongocrypt_kms_ctx_usleep(_kms_context));
986+
}
987+
988+
Value MongoCryptKMSRequest::Fail(const CallbackInfo& info) {
989+
return Boolean::New(Env(), mongocrypt_kms_ctx_fail(_kms_context));
990+
}
991+
980992
Value MongoCryptKMSRequest::KMSProvider(const CallbackInfo& info) {
981993
return String::New(Env(), mongocrypt_kms_ctx_get_kms_provider(_kms_context, nullptr));
982994
}

0 commit comments

Comments
 (0)