Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds pfx support for custom authenticator #62

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 44 additions & 23 deletions chunks/6UGE6PR7.js
Original file line number Diff line number Diff line change
Expand Up @@ -10369,31 +10369,52 @@ async function createEnigmaSession({
withoutData = false,
useReloadEngine = false
}) {
let createSocketMethod;
let url;
const locationUrl = toValidWebsocketLocationUrl(hostConfig);
const reloadUri = encodeURIComponent(`${locationUrl}/sense/app/${appId}`);
const identityPart = identity ? `/identity/${identity}` : "";
const reloadEnginePart = useReloadEngine ? "&workloadType=interactive-reload" : "";
let url = `${locationUrl}/app/${appId}${identityPart}?reloadUri=${reloadUri}${reloadEnginePart}`.replace(
/^http/,
"ws"
);
const WS = (await import("ws")).default;
const isNodeEnvironment = typeof window === "undefined";
let createSocketMethod;
if (isNodeEnvironment) {
const { headers, queryParams } = await getRestCallAuthParams({ hostConfig, method: "POST" });
const WS = (await import("ws")).default;
Object.entries(queryParams).forEach(([key, value]) => {
url = `${url}&${key}=${value}`;
});
createSocketMethod = (socketUrl) => new WS(socketUrl, void 0, {
headers
});
} else {
const { queryParams } = await getWebSocketAuthParams({ hostConfig });
Object.entries(queryParams).forEach(([key, value]) => {
url = `${url}&${key}=${value}`;
});
createSocketMethod = (socketUrl) => new WebSocket(socketUrl);
if (hostConfig.pfx == null) {
const reloadUri = encodeURIComponent(`${locationUrl}/sense/app/${appId}`);
const identityPart = identity ? `/identity/${identity}` : "";
const reloadEnginePart = useReloadEngine ? "&workloadType=interactive-reload" : "";
url = `${locationUrl}/app/${appId}${identityPart}?reloadUri=${reloadUri}${reloadEnginePart}`.replace(
/^http/,
"ws"
);
if (isNodeEnvironment) {
const {headers, queryParams} = await getRestCallAuthParams({hostConfig, method: "POST"});
Object.entries(queryParams).forEach(([key, value]) => {
url = `${url}&${key}=${value}`;
});
createSocketMethod = (socketUrl) => new WS(socketUrl, void 0, {
headers
});
} else {
const {queryParams} = await getWebSocketAuthParams({hostConfig});
Object.entries(queryParams).forEach(([key, value]) => {
url = `${url}&${key}=${value}`;
});
createSocketMethod = (socketUrl) => new WebSocket(socketUrl);
}
} else if (isNodeEnvironment){
const locationUrl = toValidWebsocketLocationUrl(hostConfig);
const pfx = hostConfig.pfx;
const passphrase = hostConfig.passphrase;
const {headers, queryParams} = await getRestCallAuthParams({hostConfig});
url = `${locationUrl}/app/engineData/${appId}`;
Object.entries(queryParams).forEach(([key, value], index) => {
if (index === 0) {
url = `${url}?${key}=${value}`;
} else {
url = `${url}&${key}=${value}`;
}
});
createSocketMethod = (socketUrl) => new WS(socketUrl, void 0, {
headers,
pfx,
passphrase,
});
}
return enigma.create({
schema: engine_api_default,
Expand Down