From 538d22f81b0eb6f37a5f8ed3a7a8cccbec93a76b Mon Sep 17 00:00:00 2001 From: Philipp Kunz Date: Sun, 18 May 2025 15:51:09 +0000 Subject: [PATCH] update --- package.json | 4 +- pnpm-lock.yaml | 317 +++++++----------- summary-acme-simplification.md | 86 +++++ test/test.certificate-simple.ts | 65 ++++ ts/proxies/smart-proxy/certificate-manager.ts | 66 +--- 5 files changed, 289 insertions(+), 249 deletions(-) create mode 100644 summary-acme-simplification.md create mode 100644 test/test.certificate-simple.ts diff --git a/package.json b/package.json index 12b25c5..5742fb5 100644 --- a/package.json +++ b/package.json @@ -17,14 +17,14 @@ "devDependencies": { "@git.zone/tsbuild": "^2.5.1", "@git.zone/tsrun": "^1.2.44", - "@git.zone/tstest": "^1.2.0", + "@git.zone/tstest": "^1.9.0", "@push.rocks/tapbundle": "^6.0.3", "@types/node": "^22.15.18", "typescript": "^5.8.3" }, "dependencies": { "@push.rocks/lik": "^6.2.2", - "@push.rocks/smartacme": "^7.3.3", + "@push.rocks/smartacme": "^7.3.4", "@push.rocks/smartcrypto": "^2.0.4", "@push.rocks/smartdelay": "^3.0.5", "@push.rocks/smartfile": "^11.2.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 27207e2..773e6ad 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -12,8 +12,8 @@ importers: specifier: ^6.2.2 version: 6.2.2 '@push.rocks/smartacme': - specifier: ^7.3.3 - version: 7.3.3(@aws-sdk/credential-providers@3.798.0)(socks@2.8.4) + specifier: ^7.3.4 + version: 7.3.4(@aws-sdk/credential-providers@3.798.0)(socks@2.8.4) '@push.rocks/smartcrypto': specifier: ^2.0.4 version: 2.0.4 @@ -64,8 +64,8 @@ importers: specifier: ^1.2.44 version: 1.3.3 '@git.zone/tstest': - specifier: ^1.2.0 - version: 1.2.0(@aws-sdk/credential-providers@3.798.0)(socks@2.8.4)(typescript@5.8.3) + specifier: ^1.9.0 + version: 1.9.0(@aws-sdk/credential-providers@3.798.0)(socks@2.8.4)(typescript@5.8.3) '@push.rocks/tapbundle': specifier: ^6.0.3 version: 6.0.3(@aws-sdk/credential-providers@3.798.0)(socks@2.8.4) @@ -87,9 +87,6 @@ packages: '@api.global/typedrequest@3.1.10': resolution: {integrity: sha512-EiCp44XVcMjBvEs4oM1nMUaeY4ySU0Pzt3+mDwVG5DNP6EV87Nwancbr2jKScvaFNel9eeDgGtgEnFBKjOnApA==} - '@api.global/typedserver@3.0.68': - resolution: {integrity: sha512-7o6fkz60ed8q2lmEe44hsu/6kNqG4j5WVgWwmY+a1MmSOUtuu5+VTYYNyc8KrSgtbRBzx4+2A2N31l4wDjcy3w==} - '@api.global/typedserver@3.0.74': resolution: {integrity: sha512-lrXaCPaVZLihlF9w39pEqTw2kiHFCheRKTZuK07S7gTGyfdXKPmccVR/EK4ox58E1gjh9A2K8yY8ZWGcjuSJkw==} @@ -362,15 +359,12 @@ packages: resolution: {integrity: sha512-D2hP9eA+Sqx1kBZgzxZh0y1trbuU+JoDkiEwqhQ36nodYqJwyEIhPSdMNd7lOm/4io72luTPWH20Yda0xOuUow==} engines: {node: '>=6.9.0'} - '@babel/runtime@7.23.4': - resolution: {integrity: sha512-2Yv65nlWnWlSpe3fXEyX5i7fx5kIKo4Qbcj+hMO0odwaneFjfXw5fdum+4yL20O0QiaHpia0cYQ9xpNMqrBwHg==} + '@babel/runtime@7.27.0': + resolution: {integrity: sha512-VtPOkrdPHZsKc/clNqyi9WUA8TINkZ4cGk63UUE3u4pmB2k+ZMQRDuIOagv8UVd6j7k0T3+RRIb7beKTebNbcw==} engines: {node: '>=6.9.0'} - '@cloudflare/workers-types@4.20250303.0': - resolution: {integrity: sha512-O7F7nRT4bbmwHf3gkRBLfJ7R6vHIJ/oZzWdby6obOiw2yavUfp/AIwS7aO2POu5Cv8+h3TXS3oHs3kKCZLraUA==} - - '@cloudflare/workers-types@4.20250515.0': - resolution: {integrity: sha512-KoHFMH04gOXp3KEI+wrFIU+3ZfoSXnwqZTpybNQjalHoN3pWjtWBb/030cCRAZ639YX+DAHAxNF7AvEYGz1oaA==} + '@cloudflare/workers-types@4.20250517.0': + resolution: {integrity: sha512-DYttpORVcvKGXI+zQDHBO6r0pDsAc8fkmJg0x1PK7+t0ijfc6nMVnUF/IVJIllScOWWHHCBknCbCmV0eGq2njA==} '@colors/colors@1.6.0': resolution: {integrity: sha512-Ir+AOibqzrIsL6ajt3Rz3LskB7OiMVHqltZmspbW/TJuTVuyOMirVqAkjfY6JISiLHgyNqicAC8AyHHGzNd/dA==} @@ -388,8 +382,8 @@ packages: '@design.estate/dees-domtools@2.3.2': resolution: {integrity: sha512-RfXR2t67M9kaCoF6CBkKJtVdsdp6p1O7S1OaWjrs8V0S3277ch4bSYfO+8f+QYweXKkI6Tr2PKaq3PIlwFSC1g==} - '@design.estate/dees-element@2.0.39': - resolution: {integrity: sha512-AQdGU/+GmWmU5M5pDf+GWT7GU8UN073WZvtIkfqQZemxd35HYU1vpi629m8/PjKd5dIHAU7QN2mKb6IQ8anPgw==} + '@design.estate/dees-element@2.0.42': + resolution: {integrity: sha512-1PzHP6q/PtSiu4P0nCxjSeHtRHn62zoSouMy8JFW2h29FT/CSDVaTUAUqYqnvwE/U98aLNivWTmerZitDF7kBQ==} '@esbuild/aix-ppc64@0.24.2': resolution: {integrity: sha512-thpVCb/rhxE/BnMLQ7GReQLLN8q9qbHmI55F4489/ByVg2aQaQ6kbcLb6FHkocZzQhxc4gx0sCk0tJkKBFzDhA==} @@ -710,8 +704,8 @@ packages: resolution: {integrity: sha512-DDzWunkxXLtXJTxBf4EioXLwhuqdA2VzdTmOzWrw4Z4Qnms/YM67q36yajwNohAajPYyRz5DayU0ikrceFXyVw==} hasBin: true - '@git.zone/tstest@1.2.0': - resolution: {integrity: sha512-H4/7YKjJLzz0uIO88dB9EcP0r8j/CoDqAWlHVWK78tEHM8foV6EIIcu+zsadZuBWW5SnR77p62YoJFenRdTnGA==} + '@git.zone/tstest@1.9.0': + resolution: {integrity: sha512-UENg0cuXJLhxOJCCVzCn7y3CEY8OMHvqQSuDazZxd5fj5tNXx6RJIYsAEMVoeJeDWQSXYgbt2JW8Yz85kre5MA==} hasBin: true '@hapi/bourne@3.0.0': @@ -886,8 +880,8 @@ packages: '@push.rocks/qenv@6.1.0': resolution: {integrity: sha512-1FUFMlSVwFSFg8LbqfkzJ2LLP4lMGApUtgOpsvrde6+AxBmB4gjoNgCUH7z3xXfDAtYqcrtSELXBNE0xVL1MqQ==} - '@push.rocks/smartacme@7.3.3': - resolution: {integrity: sha512-48g9V4EpZI8B/YiPseIuB/balH22IMp/p26+DAE57jxvv1hh+PSV4I/UPWCPWP/z7OTtKF+EfEco9TEb5BF2Lw==} + '@push.rocks/smartacme@7.3.4': + resolution: {integrity: sha512-kpXGrz0SeChLGYoXsqszsHnAyZ/8RMt0PhKSO8W+UaokHN/mZ0Nsro0XkMJhLuZyzYQ35SW+ccUblQliok/AoQ==} '@push.rocks/smartarchive@3.0.8': resolution: {integrity: sha512-1jPmR0b7hXmjYQoRiTlRXrIbZcdcFmSdGOfznufjcDpGPe86Km0d8TBnzqghTx4dTihzKC67IxAaz/DM3lvxpA==} @@ -973,6 +967,9 @@ packages: '@push.rocks/smartlog@3.0.9': resolution: {integrity: sha512-B/YIJrwXsbxPkAJly8+55yx3Eqm5bIaCZ/xD2oe6fD8Zp58VLF2P8hpoQZJOiSO+KI7wXVlTEFHsmt8fpRZIVA==} + '@push.rocks/smartlog@3.1.2': + resolution: {integrity: sha512-krjWramvM8R+dY69KoBBsUtsMHKtw7eCdvcg/uYsU6e8gzOfGiQOuWeat39d6doPHbzGuxh6lSOWGUpUTTu6aw==} + '@push.rocks/smartmanifest@2.0.2': resolution: {integrity: sha512-QGc5C9vunjfUbYsPGz5bynV/mVmPHkrQDkWp8ZO8VJtK1GZe+njgbrNyxn2SUHR0IhSAbSXl1j4JvBqYf5eTVg==} @@ -1045,8 +1042,8 @@ packages: '@push.rocks/smartsitemap@2.0.3': resolution: {integrity: sha512-jIcms8V1b2mt3dS4PKNlLR1DRC8pCDWMRVbnyM/2+snZOJZonQRlQzAyX8No0EfLbfdrfnxv2IjPX13X29Re6g==} - '@push.rocks/smartsocket@2.0.27': - resolution: {integrity: sha512-planM3EkBvx/+guLLWHLBNnNp4mcWDwp1k9G0It0ul7IhdaBQsSWzKSQJxym3Bx2dypgA2UIeT3/hRvSa5Nqdw==} + '@push.rocks/smartsocket@2.1.0': + resolution: {integrity: sha512-etOGyfiDFQz/1WJnD3jFL2N7ykujTjiudAz6qZTz82xE5oabKuKX+Cn8SdM9dOwzyWmBUKbUdll8QhovAXjn+g==} '@push.rocks/smartspawn@3.0.3': resolution: {integrity: sha512-DyrGPV69wwOiJgKkyruk5hS3UEGZ99xFAqBE9O2nM8VXCRLbbty3xt1Ug5Z092ZZmJYaaGMSnMw3ijyZJFCT0Q==} @@ -1626,14 +1623,11 @@ packages: '@types/convert-source-map@2.0.3': resolution: {integrity: sha512-ag0BfJLZf6CQz8VIuRIEYQ5Ggwk/82uvTQf27RcpyDNbY0Vw49LIPqAxk5tqYfrCs9xDaIMvl4aj7ZopnYL8bA==} - '@types/cookie@0.4.1': - resolution: {integrity: sha512-XW/Aa8APYr6jSVVA1y/DEIZX0/GMKLEVekNG727R8cs56ahETkRAy/3DR7+fJyh7oUgGwNQaRfXCun0+KbWY7Q==} - '@types/cookies@0.9.0': resolution: {integrity: sha512-40Zk8qR147RABiQ7NQnBzWzDcjKzNrntB5BAmeGCb2p/MIyOE+4BVvc17wumsUqUw00bJYqoXFHYygQnEFh4/Q==} - '@types/cors@2.8.17': - resolution: {integrity: sha512-8CGDvrBj1zgo2qE+oS3pOCyYNqCPryMWY2bGfwA0dcfopWGgxs+78df0Rs3rc9THP4JkOhLsAa+15VdpAqkcUA==} + '@types/cors@2.8.18': + resolution: {integrity: sha512-nX3d0sxJW41CqQvfOzVG1NCTXfFDrDWIghCZncpHeWlVFd81zxB/DLhg7avFg6eHLCRX7ckBmoIIcqa++upvJA==} '@types/debounce@1.2.4': resolution: {integrity: sha512-jBqiORIzKDOToaF63Fm//haOCHuwQuLa2202RK4MozpA6lh93eCBc+/8+wZn5OzjJt3ySdc+74SXWXB55Ewtyw==} @@ -1656,20 +1650,14 @@ packages: '@types/elliptic@6.4.18': resolution: {integrity: sha512-UseG6H5vjRiNpQvrhy4VF/JXdA3V/Fp5amvveaL+fs28BZ6xIKJBPnUPRlEaZpysD9MbpfaLi8lbl7PGUAkpWw==} - '@types/express-serve-static-core@4.19.6': - resolution: {integrity: sha512-N4LZ2xG7DatVqhCZzOGb1Yi5lMbXSZcmdLDe9EzSndPV2HpWYWzRbaerl2n27irrm94EPpprqa8KpskPT085+A==} - '@types/express-serve-static-core@5.0.6': resolution: {integrity: sha512-3xhRnjJPkULekpSzgtoNYYcTWgEZkp4myc+Saevii5JPnHNvHMRlBSHDbs7Bh1iPPoVTERHEZXyhyLbMEsExsA==} - '@types/express@4.17.21': - resolution: {integrity: sha512-ejlPM315qwLpaQlQDTjPdsUFSc6ZsP4AN6AlWnogPjQ7CVi7PYF3YVz+CY3jE2pwYf7E/7HlDAN0rV2GxTG0HQ==} - '@types/express@5.0.0': resolution: {integrity: sha512-DvZriSMehGHL1ZNLzi6MidnsDhUZM/x2pRdDIKdwbUNqqwHxMlRdkxtn6/EPKyqKpHqTl/4nRZsRNLpZxZRpPQ==} - '@types/express@5.0.1': - resolution: {integrity: sha512-UZUw8vjpWFXuDnjFTh7/5c2TWDlQqeXHi6hcN7F2XSVT5P+WmUnnbFS3KA6Jnc6IsEqI2qCVu2bK0R0J4A8ZQQ==} + '@types/express@5.0.2': + resolution: {integrity: sha512-BtjL3ZwbCQriyb0DGw+Rt12qAXPiBTPs815lsUvtt1Grk0vLRMZNMUZ741d5rjk+UQOxfDiBZ3dxpX00vSkK3g==} '@types/fast-json-stable-stringify@2.1.2': resolution: {integrity: sha512-vsxcbfLDdjytnCnHXtinE40Xl46Wr7l/VGRGt7ewJwCPMKEHOdEsTxXX8xwgoR7cbc+6dE8SB4jlMrOV2zAg7g==} @@ -2051,8 +2039,8 @@ packages: resolution: {integrity: sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==} engines: {node: '>=8'} - broadcast-channel@7.0.0: - resolution: {integrity: sha512-a2tW0Ia1pajcPBOGUF2jXlDnvE9d5/dg6BG9h60OmRUcZVr/veUrU8vEQFwwQIhwG3KVzYwSk3v2nRRGFgQDXQ==} + broadcast-channel@7.1.0: + resolution: {integrity: sha512-InJljddsYWbEL8LBnopnCg+qMQp9KcowvYWOt4YWrjD5HmxzDYKdVbDS1w/ji5rFZdRD58V5UxJPtBdpEbEJYw==} brorand@1.1.0: resolution: {integrity: sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8=} @@ -2280,14 +2268,14 @@ packages: cookie-signature@1.0.6: resolution: {integrity: sha1-4wOogrNCzD7oylE6eZmXNNqzriw=} - cookie@0.4.2: - resolution: {integrity: sha512-aSWTXFzaKWkvHO1Ny/s+ePFpvKsPnjc551iI41v3ny/ow6tBG5Vd+FuqGNhh1LxOmVzOlGUriIlOaokOvhaStA==} - engines: {node: '>= 0.6'} - cookie@0.7.1: resolution: {integrity: sha512-6DnInpx7SJ2AK3+CTUE/ZM0vWTUboZCegxhC2xiIydHR9jNuTAASBrfEpHhiGOZw/nX51bHt6YQl8jsGo4y/0w==} engines: {node: '>= 0.6'} + cookie@0.7.2: + resolution: {integrity: sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==} + engines: {node: '>= 0.6'} + cookies@0.9.1: resolution: {integrity: sha512-TG2hpqe4ELx54QER/S3HQ9SRVnQnGBtKUz5bLQWtYAQ+o6GpgMs6sYUvaiJjVxb+UXwhRhAEP3m7LbsIZ77Hmw==} engines: {node: '>= 0.8'} @@ -2513,15 +2501,15 @@ packages: end-of-stream@1.4.4: resolution: {integrity: sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==} - engine.io-client@6.5.4: - resolution: {integrity: sha512-GeZeeRjpD2qf49cZQ0Wvh/8NJNfeXkXXcoGh+F77oEAgo9gUHwT1fCRxSNU+YEEaysOJTnsFHmM5oAcPy4ntvQ==} + engine.io-client@6.6.3: + resolution: {integrity: sha512-T0iLjnyNWahNyv/lcjS2y4oE358tVS/SYQNxYXGAJ9/GLgH4VCvOQ/mhTjqU88mLZCQgiG8RIegFHYCdVC+j5w==} engine.io-parser@5.2.3: resolution: {integrity: sha512-HqD3yTBfnBxIrbnM1DoD6Pcq8NECnh8d4As1Qgh0z5Gg3jRRIqijury0CL3ghu/edArpUYiYqQiDUQBIs4np3Q==} engines: {node: '>=10.0.0'} - engine.io@6.5.4: - resolution: {integrity: sha512-KdVSDKhVKyOi+r5uEabrDLZw2qXStVvCsEB/LN3mw4WFi6Gx50jTyuxYVCwAAC0U46FdnzP/ScKRBTXb/NiEOg==} + engine.io@6.6.4: + resolution: {integrity: sha512-ZCkIjSYNDyGn0R6ewHDtXgns/Zre/NT6Agvq1/WobF7JXgFff4SeDroKiCO3fNJreU9YG429Sc81o4w5ok/W5g==} engines: {node: '>=10.2.0'} entities@2.2.0: @@ -2654,8 +2642,8 @@ packages: resolution: {integrity: sha512-cB507r5T3D55DfclY01GLkninZLfU7HXV/mhVRTnTRm5k2u+fY7Fof2dBkr80p5t7G7dlA/G5dI87QiMdPpMCQ==} engines: {node: '>=18'} - fake-indexeddb@6.0.0: - resolution: {integrity: sha512-YEboHE5VfopUclOck7LncgIqskAqnv4q0EWbYCaxKKjAvO93c+TJIaBuGy8CBFdbg9nKdpN3AuPRwVBJ4k7NrQ==} + fake-indexeddb@6.0.1: + resolution: {integrity: sha512-He2AjQGHe46svIFq5+L2Nx/eHDTI1oKgoevBP+TthnjymXiKkeJQ3+ITeWey99Y5+2OaPFbI1qEsx/5RsGtWnQ==} engines: {node: '>=18'} fast-deep-equal@3.1.3: @@ -3261,8 +3249,8 @@ packages: kuler@2.0.0: resolution: {integrity: sha512-Xq9nH7KlWZmXAtodXDDRE7vs6DU1gTU8zYDHDiWLSip45Egwq3plLHzPn27NgvzL2r1LMPC1vdqh98sQxtqj4A==} - lenis@1.2.3: - resolution: {integrity: sha512-H3VUn62jvQPfyxGW2F0STJPhP1VzX5r05KtiZ0uxHYD9xtbfTvj2eX/Km26+x13zlaKfHacEe1DTC3ouFrxw+g==} + lenis@1.3.3: + resolution: {integrity: sha512-DOopj/UKHS54E9l2g4BOpDUvsyvkd1zkv+ECtHxQ9Fto8ozzKSz7MccqT+KOyG0ABA/OHXZ7l9INx0peUoQ8rQ==} peerDependencies: '@nuxt/kit': '>=3.0.0' react: '>=17.0.0' @@ -3975,8 +3963,8 @@ packages: resolution: {integrity: sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==} engines: {node: '>=0.4.0'} - property-information@7.0.0: - resolution: {integrity: sha512-7D/qOz/+Y4X/rzSB6jKxKUsQnphO046ei8qxG59mtM3RG3DHgTK81HrxrmoDVINJb8NKT5ZsRbwHvQ6B68Iyhg==} + property-information@7.1.0: + resolution: {integrity: sha512-TwEZ+X+yCJmYfL7TPUOcvBZ4QfoT5YenQiJuX//0th53DE6w0xxLEtfK3iyryQFddXuvkIk51EEgrJQ0WJkOmQ==} proto-list@1.2.4: resolution: {integrity: sha1-IS1b/hMYMGpCD2QCuOJv85ZHqEk=} @@ -4267,16 +4255,16 @@ packages: socket.io-adapter@2.5.5: resolution: {integrity: sha512-eLDQas5dzPgOWCk9GuuJC2lBqItuhKI4uxGgo9aIV7MYbk2h9Q6uULEh8WBzThoI7l+qU9Ast9fVUmkqPP9wYg==} - socket.io-client@4.7.5: - resolution: {integrity: sha512-sJ/tqHOCe7Z50JCBCXrsY3I2k03iOiUe+tj1OmKeD2lXPiGH/RUCdTZFoqVyN7l1MnpIzPrGtLcijffmeouNlQ==} + socket.io-client@4.8.1: + resolution: {integrity: sha512-hJVXfu3E28NmzGk8o1sHhN3om52tRvwYeidbj7xKy2eIIse5IoKX3USlS6Tqt3BHAtflLIkCQBkzVrEEfWUyYQ==} engines: {node: '>=10.0.0'} socket.io-parser@4.2.4: resolution: {integrity: sha512-/GbIKmo8ioc+NIWIhwdecY0ge+qVBSMdgxGygevmdHj24bsfgtCmcUUcQ5ZzcylGFHsN3k4HB4Cgkl96KVnuew==} engines: {node: '>=10.0.0'} - socket.io@4.7.5: - resolution: {integrity: sha512-DmeAkF6cwM9jSfmp6Dr/5/mfMwb5Z5qRrSXLpo3Fq5SqyU8CMF15jIN4ZhfSwu35ksM1qmHZDQ/DK5XTccSTvA==} + socket.io@4.8.1: + resolution: {integrity: sha512-oZ7iUCxph8WYRHHcjBEc9unw3adt5CmSNlppj/5Q4k2RIrhl8Z5yY2Xr4j9zj0+wzVZ0bxmYoGSzKJnRl6A4yg==} engines: {node: '>=10.2.0'} socks-proxy-agent@8.0.5: @@ -4693,18 +4681,6 @@ packages: utf-8-validate: optional: true - ws@8.11.0: - resolution: {integrity: sha512-HPG3wQd9sNQoT9xHyNCXoDUa+Xw/VevmY9FoHyQ+g+rrMn4j6FB4np7Z0OhdTgjx6MgQLK7jwSy1YecU1+4Asg==} - engines: {node: '>=10.0.0'} - peerDependencies: - bufferutil: ^4.0.1 - utf-8-validate: ^5.0.2 - peerDependenciesMeta: - bufferutil: - optional: true - utf-8-validate: - optional: true - ws@8.17.1: resolution: {integrity: sha512-6XQFvXTkbfUOZOKKILFG1PDK2NDQs4azKQl26T0YS5CxqWLgXajbPZ+h4gZekJyRqFU8pvnbAbbs/3TgRPy+GQ==} engines: {node: '>=10.0.0'} @@ -4745,8 +4721,8 @@ packages: resolution: {integrity: sha512-fDlsI/kFEx7gLvbecc0/ohLG50fugQp8ryHzMTuW9vSa1GJ0XYWKnhsUx7oie3G98+r56aTQIUB4kht42R3JvA==} engines: {node: '>=4.0'} - xmlhttprequest-ssl@2.0.0: - resolution: {integrity: sha512-QKxVRxiRACQcVuQEYFsI1hhkrMlrXHPegbbd1yn9UHOmRxY+si12nQYzri3vbzt8VdTTRviqcKxcyllFas5z2A==} + xmlhttprequest-ssl@2.1.2: + resolution: {integrity: sha512-TEU+nJVUUnA4CYJFLvK5X9AOeH4KvDvhIfm0vV1GaQRtchnG0hgK5p8hw/xjv8cunWYCsiPCSDzObPyhEwq3KQ==} engines: {node: '>=0.4.0'} xtend@4.0.2: @@ -4803,57 +4779,12 @@ snapshots: '@push.rocks/webrequest': 3.0.37 '@push.rocks/webstream': 1.0.10 - '@api.global/typedserver@3.0.68': - dependencies: - '@api.global/typedrequest': 3.1.10 - '@api.global/typedrequest-interfaces': 3.0.19 - '@api.global/typedsocket': 3.0.1 - '@cloudflare/workers-types': 4.20250303.0 - '@design.estate/dees-comms': 1.0.27 - '@push.rocks/lik': 6.2.2 - '@push.rocks/smartchok': 1.0.34 - '@push.rocks/smartdelay': 3.0.5 - '@push.rocks/smartenv': 5.0.12 - '@push.rocks/smartfeed': 1.0.11 - '@push.rocks/smartfile': 11.2.0 - '@push.rocks/smartjson': 5.0.20 - '@push.rocks/smartlog': 3.0.7 - '@push.rocks/smartlog-destination-devtools': 1.0.12 - '@push.rocks/smartlog-interfaces': 3.0.2 - '@push.rocks/smartmanifest': 2.0.2 - '@push.rocks/smartmatch': 2.0.0 - '@push.rocks/smartmime': 2.0.4 - '@push.rocks/smartntml': 2.0.8 - '@push.rocks/smartopen': 2.0.0 - '@push.rocks/smartpath': 5.0.18 - '@push.rocks/smartpromise': 4.2.3 - '@push.rocks/smartrequest': 2.1.0 - '@push.rocks/smartrx': 3.0.7 - '@push.rocks/smartsitemap': 2.0.3 - '@push.rocks/smartstream': 3.2.5 - '@push.rocks/smarttime': 4.1.1 - '@push.rocks/taskbuffer': 3.1.7 - '@push.rocks/webrequest': 3.0.37 - '@push.rocks/webstore': 2.0.20 - '@tsclass/tsclass': 4.4.4 - '@types/express': 4.17.21 - body-parser: 1.20.3 - cors: 2.8.5 - express: 4.21.2 - express-force-ssl: 0.3.2 - lit: 3.2.1 - transitivePeerDependencies: - - '@nuxt/kit' - - react - - supports-color - - vue - '@api.global/typedserver@3.0.74': dependencies: '@api.global/typedrequest': 3.1.10 '@api.global/typedrequest-interfaces': 3.0.19 '@api.global/typedsocket': 3.0.1 - '@cloudflare/workers-types': 4.20250515.0 + '@cloudflare/workers-types': 4.20250517.0 '@design.estate/dees-comms': 1.0.27 '@push.rocks/lik': 6.2.2 '@push.rocks/smartchok': 1.0.34 @@ -4862,7 +4793,7 @@ snapshots: '@push.rocks/smartfeed': 1.0.11 '@push.rocks/smartfile': 11.2.0 '@push.rocks/smartjson': 5.0.20 - '@push.rocks/smartlog': 3.0.9 + '@push.rocks/smartlog': 3.1.2 '@push.rocks/smartlog-destination-devtools': 1.0.12 '@push.rocks/smartlog-interfaces': 3.0.2 '@push.rocks/smartmanifest': 2.0.2 @@ -4881,7 +4812,7 @@ snapshots: '@push.rocks/webrequest': 3.0.37 '@push.rocks/webstore': 2.0.20 '@tsclass/tsclass': 8.2.1 - '@types/express': 5.0.1 + '@types/express': 5.0.2 body-parser: 1.20.3 cors: 2.8.5 express: 4.21.2 @@ -4901,8 +4832,8 @@ snapshots: '@api.global/typedrequest-interfaces': 3.0.19 '@push.rocks/isohash': 2.0.1 '@push.rocks/smartjson': 5.0.20 - '@push.rocks/smartrx': 3.0.7 - '@push.rocks/smartsocket': 2.0.27 + '@push.rocks/smartrx': 3.0.10 + '@push.rocks/smartsocket': 2.1.0 '@push.rocks/smartstring': 4.0.15 '@push.rocks/smarturl': 3.1.0 transitivePeerDependencies: @@ -4916,7 +4847,7 @@ snapshots: '@apiclient.xyz/cloudflare@6.4.1': dependencies: '@push.rocks/smartdelay': 3.0.5 - '@push.rocks/smartlog': 3.0.9 + '@push.rocks/smartlog': 3.1.2 '@push.rocks/smartpromise': 4.2.3 '@push.rocks/smartrequest': 2.1.0 '@push.rocks/smartstring': 4.0.15 @@ -5766,13 +5697,11 @@ snapshots: '@babel/helper-validator-identifier@7.27.1': {} - '@babel/runtime@7.23.4': + '@babel/runtime@7.27.0': dependencies: regenerator-runtime: 0.14.1 - '@cloudflare/workers-types@4.20250303.0': {} - - '@cloudflare/workers-types@4.20250515.0': {} + '@cloudflare/workers-types@4.20250517.0': {} '@colors/colors@1.6.0': {} @@ -5791,7 +5720,7 @@ snapshots: '@api.global/typedrequest': 3.1.10 '@api.global/typedrequest-interfaces': 3.0.19 '@push.rocks/smartdelay': 3.0.5 - broadcast-channel: 7.0.0 + broadcast-channel: 7.1.0 '@design.estate/dees-domtools@2.3.2': dependencies: @@ -5803,15 +5732,15 @@ snapshots: '@push.rocks/smartmarkdown': 3.0.3 '@push.rocks/smartpromise': 4.2.3 '@push.rocks/smartrouter': 1.3.2 - '@push.rocks/smartrx': 3.0.7 + '@push.rocks/smartrx': 3.0.10 '@push.rocks/smartstate': 2.0.19 '@push.rocks/smartstring': 4.0.15 '@push.rocks/smarturl': 3.1.0 '@push.rocks/webrequest': 3.0.37 '@push.rocks/websetup': 3.0.19 '@push.rocks/webstore': 2.0.20 - lenis: 1.2.3 - lit: 3.2.1 + lenis: 1.3.3 + lit: 3.3.0 sweet-scroll: 4.0.0 transitivePeerDependencies: - '@nuxt/kit' @@ -5819,12 +5748,12 @@ snapshots: - supports-color - vue - '@design.estate/dees-element@2.0.39': + '@design.estate/dees-element@2.0.42': dependencies: '@design.estate/dees-domtools': 2.3.2 '@push.rocks/isounique': 1.0.5 - '@push.rocks/smartrx': 3.0.7 - lit: 3.2.1 + '@push.rocks/smartrx': 3.0.10 + lit: 3.3.0 transitivePeerDependencies: - '@nuxt/kit' - react @@ -6005,7 +5934,7 @@ snapshots: '@push.rocks/smartcli': 4.0.11 '@push.rocks/smartdelay': 3.0.5 '@push.rocks/smartfile': 11.2.0 - '@push.rocks/smartlog': 3.0.9 + '@push.rocks/smartlog': 3.1.2 '@push.rocks/smartlog-destination-local': 9.0.2 '@push.rocks/smartpath': 5.0.18 '@push.rocks/smartpromise': 4.2.3 @@ -6036,19 +5965,28 @@ snapshots: '@push.rocks/smartshell': 3.2.3 tsx: 4.19.3 - '@git.zone/tstest@1.2.0(@aws-sdk/credential-providers@3.798.0)(socks@2.8.4)(typescript@5.8.3)': + '@git.zone/tstest@1.9.0(@aws-sdk/credential-providers@3.798.0)(socks@2.8.4)(typescript@5.8.3)': dependencies: '@api.global/typedserver': 3.0.74 '@git.zone/tsbundle': 2.2.5 '@git.zone/tsrun': 1.3.3 '@push.rocks/consolecolor': 2.0.2 + '@push.rocks/qenv': 6.1.0 '@push.rocks/smartbrowser': 2.0.8(typescript@5.8.3) + '@push.rocks/smartcrypto': 2.0.4 '@push.rocks/smartdelay': 3.0.5 + '@push.rocks/smartenv': 5.0.12 + '@push.rocks/smartexpect': 2.4.2 '@push.rocks/smartfile': 11.2.0 - '@push.rocks/smartlog': 3.0.9 + '@push.rocks/smartjson': 5.0.20 + '@push.rocks/smartlog': 3.1.2 + '@push.rocks/smartmongo': 2.0.12(@aws-sdk/credential-providers@3.798.0)(socks@2.8.4) + '@push.rocks/smartpath': 5.0.18 '@push.rocks/smartpromise': 4.2.3 + '@push.rocks/smartrequest': 2.1.0 + '@push.rocks/smarts3': 2.2.5 '@push.rocks/smartshell': 3.2.3 - '@push.rocks/tapbundle': 6.0.3(@aws-sdk/credential-providers@3.798.0)(socks@2.8.4) + '@push.rocks/smarttime': 4.1.1 '@types/ws': 8.18.1 figures: 6.1.0 ws: 8.18.2 @@ -6385,7 +6323,7 @@ snapshots: '@push.rocks/smartlog': 3.0.7 '@push.rocks/smartpath': 5.0.18 - '@push.rocks/smartacme@7.3.3(@aws-sdk/credential-providers@3.798.0)(socks@2.8.4)': + '@push.rocks/smartacme@7.3.4(@aws-sdk/credential-providers@3.798.0)(socks@2.8.4)': dependencies: '@api.global/typedserver': 3.0.74 '@apiclient.xyz/cloudflare': 6.4.1 @@ -6394,7 +6332,7 @@ snapshots: '@push.rocks/smartdelay': 3.0.5 '@push.rocks/smartdns': 6.2.2 '@push.rocks/smartfile': 11.2.0 - '@push.rocks/smartlog': 3.0.9 + '@push.rocks/smartlog': 3.1.2 '@push.rocks/smartnetwork': 4.0.1 '@push.rocks/smartpromise': 4.2.3 '@push.rocks/smartrequest': 2.1.0 @@ -6407,8 +6345,6 @@ snapshots: - '@aws-sdk/credential-providers' - '@mongodb-js/zstd' - '@nuxt/kit' - - aws-crt - - bufferutil - encoding - gcp-metadata - kerberos @@ -6417,7 +6353,6 @@ snapshots: - snappy - socks - supports-color - - utf-8-validate - vue '@push.rocks/smartarchive@3.0.8': @@ -6482,7 +6417,7 @@ snapshots: dependencies: '@push.rocks/lik': 6.2.2 '@push.rocks/smartpromise': 4.2.3 - '@push.rocks/smartrx': 3.0.7 + '@push.rocks/smartrx': 3.0.10 '@tempfix/watcher': 2.3.0 '@push.rocks/smartcli@4.0.11': @@ -6670,6 +6605,19 @@ snapshots: '@tsclass/tsclass': 9.2.0 ora: 8.2.0 + '@push.rocks/smartlog@3.1.2': + dependencies: + '@api.global/typedrequest-interfaces': 3.0.19 + '@push.rocks/consolecolor': 2.0.2 + '@push.rocks/isounique': 1.0.5 + '@push.rocks/smartclickhouse': 2.0.17 + '@push.rocks/smartfile': 11.2.0 + '@push.rocks/smarthash': 3.0.4 + '@push.rocks/smartpromise': 4.2.3 + '@push.rocks/smarttime': 4.1.1 + '@push.rocks/webrequest': 3.0.37 + '@tsclass/tsclass': 9.2.0 + '@push.rocks/smartmanifest@2.0.2': {} '@push.rocks/smartmarkdown@3.0.3': @@ -6757,10 +6705,10 @@ snapshots: '@push.rocks/smartntml@2.0.8': dependencies: - '@design.estate/dees-element': 2.0.39 + '@design.estate/dees-element': 2.0.42 '@happy-dom/global-registrator': 15.11.7 '@push.rocks/smartpromise': 4.2.3 - fake-indexeddb: 6.0.0 + fake-indexeddb: 6.0.1 transitivePeerDependencies: - '@nuxt/kit' - react @@ -6789,7 +6737,7 @@ snapshots: '@push.rocks/smartpuppeteer': 2.0.5(typescript@5.8.3) '@push.rocks/smartunique': 3.0.9 '@tsclass/tsclass': 4.4.4 - '@types/express': 5.0.1 + '@types/express': 5.0.2 express: 4.21.2 pdf-lib: 1.17.1 pdf2json: 3.1.5 @@ -6830,7 +6778,7 @@ snapshots: '@push.rocks/smartrouter@1.3.2': dependencies: '@push.rocks/lik': 6.2.2 - '@push.rocks/smartrx': 3.0.7 + '@push.rocks/smartrx': 3.0.10 path-to-regexp: 8.2.0 '@push.rocks/smartrx@3.0.10': @@ -6873,23 +6821,23 @@ snapshots: '@push.rocks/webrequest': 3.0.37 '@tsclass/tsclass': 4.4.4 - '@push.rocks/smartsocket@2.0.27': + '@push.rocks/smartsocket@2.1.0': dependencies: '@api.global/typedrequest-interfaces': 3.0.19 - '@api.global/typedserver': 3.0.68 + '@api.global/typedserver': 3.0.74 '@push.rocks/isohash': 2.0.1 '@push.rocks/isounique': 1.0.5 '@push.rocks/lik': 6.2.2 '@push.rocks/smartdelay': 3.0.5 '@push.rocks/smartenv': 5.0.12 '@push.rocks/smartjson': 5.0.20 - '@push.rocks/smartlog': 3.0.7 + '@push.rocks/smartlog': 3.1.2 '@push.rocks/smartpromise': 4.2.3 - '@push.rocks/smartrx': 3.0.7 + '@push.rocks/smartrx': 3.0.10 '@push.rocks/smarttime': 4.1.1 - engine.io: 6.5.4 - socket.io: 4.7.5 - socket.io-client: 4.7.5 + engine.io: 6.6.4 + socket.io: 4.8.1 + socket.io-client: 4.8.1 transitivePeerDependencies: - '@nuxt/kit' - bufferutil @@ -6913,7 +6861,7 @@ snapshots: '@push.rocks/lik': 6.2.2 '@push.rocks/smartjson': 5.0.20 '@push.rocks/smartpromise': 4.2.3 - '@push.rocks/smartrx': 3.0.7 + '@push.rocks/smartrx': 3.0.10 '@push.rocks/webstore': 2.0.20 '@push.rocks/smartstream@2.0.8': @@ -7877,8 +7825,6 @@ snapshots: '@types/convert-source-map@2.0.3': {} - '@types/cookie@0.4.1': {} - '@types/cookies@0.9.0': dependencies: '@types/connect': 3.4.38 @@ -7886,7 +7832,7 @@ snapshots: '@types/keygrip': 1.0.6 '@types/node': 22.15.18 - '@types/cors@2.8.17': + '@types/cors@2.8.18': dependencies: '@types/node': 22.15.18 @@ -7910,13 +7856,6 @@ snapshots: dependencies: '@types/bn.js': 5.1.6 - '@types/express-serve-static-core@4.19.6': - dependencies: - '@types/node': 22.15.18 - '@types/qs': 6.9.18 - '@types/range-parser': 1.2.7 - '@types/send': 0.17.4 - '@types/express-serve-static-core@5.0.6': dependencies: '@types/node': 22.15.18 @@ -7924,13 +7863,6 @@ snapshots: '@types/range-parser': 1.2.7 '@types/send': 0.17.4 - '@types/express@4.17.21': - dependencies: - '@types/body-parser': 1.19.5 - '@types/express-serve-static-core': 4.19.6 - '@types/qs': 6.9.18 - '@types/serve-static': 1.15.7 - '@types/express@5.0.0': dependencies: '@types/body-parser': 1.19.5 @@ -7938,7 +7870,7 @@ snapshots: '@types/qs': 6.9.18 '@types/serve-static': 1.15.7 - '@types/express@5.0.1': + '@types/express@5.0.2': dependencies: '@types/body-parser': 1.19.5 '@types/express-serve-static-core': 5.0.6 @@ -8396,9 +8328,9 @@ snapshots: dependencies: fill-range: 7.1.1 - broadcast-channel@7.0.0: + broadcast-channel@7.1.0: dependencies: - '@babel/runtime': 7.23.4 + '@babel/runtime': 7.27.0 oblivious-set: 1.4.0 p-queue: 6.6.2 unload: 2.4.1 @@ -8631,10 +8563,10 @@ snapshots: cookie-signature@1.0.6: {} - cookie@0.4.2: {} - cookie@0.7.1: {} + cookie@0.7.2: {} + cookies@0.9.1: dependencies: depd: 2.0.0 @@ -8819,13 +8751,13 @@ snapshots: dependencies: once: 1.4.0 - engine.io-client@6.5.4: + engine.io-client@6.6.3: dependencies: '@socket.io/component-emitter': 3.1.2 debug: 4.3.7 engine.io-parser: 5.2.3 ws: 8.17.1 - xmlhttprequest-ssl: 2.0.0 + xmlhttprequest-ssl: 2.1.2 transitivePeerDependencies: - bufferutil - supports-color @@ -8833,18 +8765,17 @@ snapshots: engine.io-parser@5.2.3: {} - engine.io@6.5.4: + engine.io@6.6.4: dependencies: - '@types/cookie': 0.4.1 - '@types/cors': 2.8.17 + '@types/cors': 2.8.18 '@types/node': 22.15.18 accepts: 1.3.8 base64id: 2.0.0 - cookie: 0.4.2 + cookie: 0.7.2 cors: 2.8.5 debug: 4.3.7 engine.io-parser: 5.2.3 - ws: 8.11.0 + ws: 8.17.1 transitivePeerDependencies: - bufferutil - supports-color @@ -9043,7 +8974,7 @@ snapshots: fake-indexeddb@5.0.2: {} - fake-indexeddb@6.0.0: {} + fake-indexeddb@6.0.1: {} fast-deep-equal@3.1.3: {} @@ -9377,7 +9308,7 @@ snapshots: hast-util-whitespace: 3.0.0 html-void-elements: 3.0.0 mdast-util-to-hast: 13.2.0 - property-information: 7.0.0 + property-information: 7.1.0 space-separated-tokens: 2.0.2 stringify-entities: 4.0.4 zwitch: 2.0.4 @@ -9759,7 +9690,7 @@ snapshots: kuler@2.0.0: {} - lenis@1.2.3: {} + lenis@1.3.3: {} lines-and-columns@1.2.4: {} @@ -10219,7 +10150,7 @@ snapshots: micromark@4.0.2: dependencies: '@types/debug': 4.1.12 - debug: 4.4.0 + debug: 4.4.1 decode-named-character-reference: 1.1.0 devlop: 1.1.0 micromark-core-commonmark: 2.0.3 @@ -10618,7 +10549,7 @@ snapshots: progress@2.0.3: {} - property-information@7.0.0: {} + property-information@7.1.0: {} proto-list@1.2.4: {} @@ -11008,11 +10939,11 @@ snapshots: - supports-color - utf-8-validate - socket.io-client@4.7.5: + socket.io-client@4.8.1: dependencies: '@socket.io/component-emitter': 3.1.2 debug: 4.3.7 - engine.io-client: 6.5.4 + engine.io-client: 6.6.3 socket.io-parser: 4.2.4 transitivePeerDependencies: - bufferutil @@ -11026,13 +10957,13 @@ snapshots: transitivePeerDependencies: - supports-color - socket.io@4.7.5: + socket.io@4.8.1: dependencies: accepts: 1.3.8 base64id: 2.0.0 cors: 2.8.5 debug: 4.3.7 - engine.io: 6.5.4 + engine.io: 6.6.4 socket.io-adapter: 2.5.5 socket.io-parser: 4.2.4 transitivePeerDependencies: @@ -11454,8 +11385,6 @@ snapshots: ws@7.5.10: {} - ws@8.11.0: {} - ws@8.17.1: {} ws@8.18.2: {} @@ -11478,7 +11407,7 @@ snapshots: xmlbuilder@11.0.1: {} - xmlhttprequest-ssl@2.0.0: {} + xmlhttprequest-ssl@2.1.2: {} xtend@4.0.2: {} diff --git a/summary-acme-simplification.md b/summary-acme-simplification.md new file mode 100644 index 0000000..549eaa7 --- /dev/null +++ b/summary-acme-simplification.md @@ -0,0 +1,86 @@ +# ACME/Certificate Simplification Summary + +## What Was Done + +We successfully implemented the ACME/Certificate simplification plan for SmartProxy: + +### 1. Created New Certificate Management System + +- **SmartCertManager** (`ts/proxies/smart-proxy/certificate-manager.ts`): A unified certificate manager that handles both ACME and static certificates +- **CertStore** (`ts/proxies/smart-proxy/cert-store.ts`): File-based certificate storage system + +### 2. Updated Route Types + +- Added `IRouteAcme` interface for ACME configuration +- Added `IStaticResponse` interface for static route responses +- Extended `IRouteTls` with comprehensive certificate options +- Added `handler` property to `IRouteAction` for static routes + +### 3. Implemented Static Route Handler + +- Added `handleStaticAction` method to route-connection-handler.ts +- Added support for 'static' route type in the action switch statement +- Implemented proper HTTP response formatting + +### 4. Updated SmartProxy Integration + +- Removed old CertProvisioner and Port80Handler dependencies +- Added `initializeCertificateManager` method +- Updated `start` and `stop` methods to use new certificate manager +- Added `provisionCertificate`, `renewCertificate`, and `getCertificateStatus` methods + +### 5. Simplified NetworkProxyBridge + +- Removed all certificate-related logic +- Simplified to only handle network proxy forwarding +- Updated to use port-based matching for network proxy routes + +### 6. Cleaned Up HTTP Module + +- Removed exports for port80 subdirectory +- Kept only router and redirect functionality + +### 7. Created Tests + +- Created simplified test for certificate functionality +- Test demonstrates static route handling and basic certificate configuration + +## Key Improvements + +1. **No Backward Compatibility**: Clean break from legacy implementations +2. **Direct SmartAcme Integration**: Uses @push.rocks/smartacme directly without custom wrappers +3. **Route-Based ACME Challenges**: No separate HTTP server needed +4. **Simplified Architecture**: Removed unnecessary abstraction layers +5. **Unified Configuration**: Certificate configuration is part of route definitions + +## Configuration Example + +```typescript +const proxy = new SmartProxy({ + routes: [{ + name: 'secure-site', + match: { ports: 443, domains: 'example.com' }, + action: { + type: 'forward', + target: { host: 'backend', port: 8080 }, + tls: { + mode: 'terminate', + certificate: 'auto', + acme: { + email: 'admin@example.com', + useProduction: true + } + } + } + }] +}); +``` + +## Next Steps + +1. Remove old certificate module and port80 directory +2. Update documentation with new configuration format +3. Test with real ACME certificates in staging environment +4. Add more comprehensive tests for renewal and edge cases + +The implementation is complete and builds successfully! \ No newline at end of file diff --git a/test/test.certificate-simple.ts b/test/test.certificate-simple.ts new file mode 100644 index 0000000..8aacd30 --- /dev/null +++ b/test/test.certificate-simple.ts @@ -0,0 +1,65 @@ +import { SmartProxy } from '../ts/proxies/smart-proxy/index.js'; +import { expect, tap } from '@push.rocks/tapbundle'; + +tap.test('should create SmartProxy with certificate routes', async () => { + const proxy = new SmartProxy({ + routes: [{ + name: 'test-route', + match: { ports: 8443, domains: 'test.example.com' }, + action: { + type: 'forward', + target: { host: 'localhost', port: 8080 }, + tls: { + mode: 'terminate', + certificate: 'auto', + acme: { + email: 'test@example.com', + useProduction: false + } + } + } + }] + }); + + expect(proxy).toBeDefined(); + expect(proxy.settings.routes.length).toEqual(1); +}); + +tap.test('should handle static route type', async () => { + // Create a test route with static handler + const testResponse = { + status: 200, + headers: { 'Content-Type': 'text/plain' }, + body: 'Hello from static route' + }; + + const proxy = new SmartProxy({ + routes: [{ + name: 'static-test', + match: { ports: 8080, path: '/test' }, + action: { + type: 'static', + handler: async () => testResponse + } + }] + }); + + const route = proxy.settings.routes[0]; + expect(route.action.type).toEqual('static'); + expect(route.action.handler).toBeDefined(); + + // Test the handler + const result = await route.action.handler!({ + port: 8080, + path: '/test', + clientIp: '127.0.0.1', + serverIp: '127.0.0.1', + isTls: false, + timestamp: Date.now(), + connectionId: 'test-123' + }); + + expect(result).toEqual(testResponse); +}); + +tap.start(); \ No newline at end of file diff --git a/ts/proxies/smart-proxy/certificate-manager.ts b/ts/proxies/smart-proxy/certificate-manager.ts index 35552da..a9ffa79 100644 --- a/ts/proxies/smart-proxy/certificate-manager.ts +++ b/ts/proxies/smart-proxy/certificate-manager.ts @@ -69,16 +69,13 @@ export class SmartCertManager { ); if (hasAcmeRoutes && this.acmeOptions?.email) { - // Create SmartAcme instance with our challenge handler + // Create SmartAcme instance with built-in MemoryCertManager this.smartAcme = new plugins.smartacme.SmartAcme({ accountEmail: this.acmeOptions.email, environment: this.acmeOptions.useProduction ? 'production' : 'integration', - certManager: new InMemoryCertManager() + certManager: new plugins.smartacme.certmanagers.MemoryCertManager() }); - // The challenge handler is now embedded in the SmartAcme config above - // SmartAcme will handle the challenge internally - await this.smartAcme.start(); } @@ -163,13 +160,18 @@ export class SmartCertManager { // Use smartacme to get certificate const cert = await this.smartAcme.getCertificateForDomain(primaryDomain); - // smartacme returns a Cert object with these properties + // SmartAcme's Cert object has these properties: + // - certPem: The certificate PEM string + // - privateKeyPem: The private key PEM string + // - csr: Certificate signing request + // - validUntil: Expiry date as Date object + // - domainName: The domain name const certData: ICertificateData = { - cert: cert.publicKey, - key: cert.privateKey, - ca: cert.publicKey, // Use same as cert for now - expiryDate: new Date(Date.now() + 90 * 24 * 60 * 60 * 1000), // 90 days - issueDate: new Date() + cert: cert.certPem, + key: cert.privateKeyPem, + ca: cert.certPem, // Use same as cert for now + expiryDate: cert.validUntil, + issueDate: new Date() // SmartAcme doesn't provide issue date }; await this.certStore.saveCertificate(routeName, certData); @@ -473,45 +475,3 @@ export class SmartCertManager { } } -/** - * Simple in-memory certificate manager for SmartAcme - * We only use this to satisfy SmartAcme's interface - actual storage is handled by CertStore - */ -class InMemoryCertManager implements plugins.smartacme.ICertManager { - private store = new Map(); - - // Required methods from ICertManager interface - public async init(): Promise { - // Initialization if needed - } - - public async retrieveCertificate(domainName: string): Promise { - return this.store.get(domainName) || null; - } - - public async storeCertificate(cert: plugins.smartacme.Cert): Promise { - this.store.set(cert.domainName, cert); - } - - public async deleteCertificate(domainName: string): Promise { - this.store.delete(domainName); - } - - public async getCertificates(): Promise { - return Array.from(this.store.values()); - } - - public async stop(): Promise { - // Cleanup if needed - } - - public async close(): Promise { - // Required by interface - await this.stop(); - } - - public async wipe(): Promise { - // Required by interface - this.store.clear(); - } -} \ No newline at end of file