"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.kDefaultOpenBrowserTimeout = exports.publicPluginToInternalPluginMap_DoNotUseOutsideOfTests = exports.ALL_AUTH_FLOW_TYPES = void 0;
exports.createMongoDBOIDCPlugin = createMongoDBOIDCPlugin;
const plugin_1 = require("./plugin");
/** @public */
exports.ALL_AUTH_FLOW_TYPES = Object.freeze([
    'auth-code',
    'device-auth',
]);
/** @internal */
exports.publicPluginToInternalPluginMap_DoNotUseOutsideOfTests = new WeakMap();
/**
 * Create a new OIDC plugin instance that can be passed to the Node.js MongoDB
 * driver's MongoClientOptions struct.
 *
 * This plugin instance can be passed to multiple MongoClient instances.
 * It caches credentials based on cluster OIDC metadata.
 * Do *not* pass the plugin instance to multiple MongoClient instances when the
 * MongoDB deployments they are connecting to do not share a trust relationship
 * since an untrusted server may be able to advertise malicious OIDC metadata
 * (this restriction may be lifted in a future version of this library).
 * Do *not* pass the plugin instance to multiple MongoClient instances when they
 * are being used with different usernames (user principals), in the connection
 * string or in the MongoClient options.
 *
 * @public
 */
function createMongoDBOIDCPlugin(options) {
    const plugin = new plugin_1.MongoDBOIDCPluginImpl({ ...options });
    const publicPlugin = {
        mongoClientOptions: plugin.mongoClientOptions,
        logger: plugin.logger,
        serialize: plugin.serialize.bind(plugin),
        destroy: plugin.destroy.bind(plugin),
    };
    exports.publicPluginToInternalPluginMap_DoNotUseOutsideOfTests.set(publicPlugin, plugin);
    return publicPlugin;
}
/** @internal */
exports.kDefaultOpenBrowserTimeout = 20_000;
//# sourceMappingURL=api.js.map