diff --git a/packages/bruno-app/src/components/Preferences/index.js b/packages/bruno-app/src/components/Preferences/index.js index 547ffd09a..29089ffcc 100644 --- a/packages/bruno-app/src/components/Preferences/index.js +++ b/packages/bruno-app/src/components/Preferences/index.js @@ -9,7 +9,8 @@ import { IconUserCircle, IconKeyboard, IconZoomQuestion, - IconSquareLetterB + IconSquareLetterB, + IconDatabase } from '@tabler/icons'; import Support from './Support'; @@ -21,6 +22,7 @@ import Keybindings from './Keybindings'; import Beta from './Beta'; import StyledWrapper from './StyledWrapper'; +import Cache from './Cache/index'; const Preferences = () => { const dispatch = useDispatch(); @@ -65,6 +67,10 @@ const Preferences = () => { case 'support': { return ; } + + case 'cache': { + return ; + } } }; @@ -100,6 +106,10 @@ const Preferences = () => { Beta +
setTab('cache')}> + + Cache +
(options: T): T { if ('ca' in options && (options as AgentOptions).ca) { const { ca, ...rest } = options as AgentOptions; + + // When client certs are present alongside CA, build a combined context + // that includes both. This context can't be CA-cached since it's unique + // per client cert + CA combination. + const hasClientCert = rest.pfx || rest.cert || rest.key; + if (hasClientCert) { + const ctxOptions: Record = {}; + if (rest.pfx) ctxOptions.pfx = rest.pfx; + if (rest.cert) ctxOptions.cert = rest.cert; + if (rest.key) ctxOptions.key = rest.key; + if (rest.passphrase) ctxOptions.passphrase = rest.passphrase; + + const ctx = tls.createSecureContext(ctxOptions); + const caList = Array.isArray(ca) ? ca : [ca!]; + for (const caCert of caList) { + if (caCert) ctx.context.addCACert(caCert); + } + + const { pfx: _pfx, cert: _cert, key: _key, passphrase: _pass, ...cleanRest } = rest; + return { ...cleanRest, secureContext: ctx } as unknown as T; + } + + // CA-only case: use cached secure context return { ...rest, secureContext: buildSecureContext(ca!) } as unknown as T; } return options;