diff --git a/src/js_realm.hpp b/src/js_realm.hpp index 2c4e0d20..5d2a0aa4 100644 --- a/src/js_realm.hpp +++ b/src/js_realm.hpp @@ -553,8 +553,9 @@ void RealmClass::wait_for_download_completion(ContextType ctx, FunctionType, static const String encryption_key_string = "encryptionKey"; ValueType encryption_key_value = Object::get_property(ctx, config_object, encryption_key_string); if (!Value::is_undefined(ctx, encryption_key_value)) { - std::string encryption_key = NativeAccessor::to_binary(ctx, encryption_key_value); - config.encryption_key = std::vector(encryption_key.begin(), encryption_key.end()); + NativeAccessor accessor(ctx); + auto encryption_key = accessor.template unbox(encryption_key_value); + config.encryption_key.assign(encryption_key.data(), encryption_key.data() + encryption_key.size()); } Protected thiz(ctx, this_object); @@ -798,4 +799,4 @@ void RealmClass::close(ContextType ctx, FunctionType, ObjectType this_object, } } // js -} // realm \ No newline at end of file +} // realm