@wirebench/engine 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +3 -0
- package/dist/assert/contract.d.ts +3 -0
- package/dist/assert/contract.js +17 -0
- package/dist/assert/index.d.ts +4 -0
- package/dist/assert/index.js +27 -0
- package/dist/assert/match.d.ts +3 -0
- package/dist/assert/match.js +58 -0
- package/dist/assert/model.d.ts +73 -0
- package/dist/assert/model.js +8 -0
- package/dist/assert/schema.d.ts +34 -0
- package/dist/assert/schema.js +46 -0
- package/dist/assert/sla.d.ts +3 -0
- package/dist/assert/sla.js +8 -0
- package/dist/assert/soap-fault.d.ts +3 -0
- package/dist/assert/soap-fault.js +20 -0
- package/dist/assert/status.d.ts +3 -0
- package/dist/assert/status.js +14 -0
- package/dist/errors.d.ts +77 -0
- package/dist/errors.js +121 -0
- package/dist/fs.d.ts +35 -0
- package/dist/fs.js +64 -0
- package/dist/generate.d.ts +12 -0
- package/dist/generate.js +14 -0
- package/dist/grpc/browser.d.ts +11 -0
- package/dist/grpc/browser.js +9 -0
- package/dist/grpc/cache.d.ts +113 -0
- package/dist/grpc/cache.js +244 -0
- package/dist/grpc/call.d.ts +64 -0
- package/dist/grpc/call.js +72 -0
- package/dist/grpc/codec.d.ts +29 -0
- package/dist/grpc/codec.js +416 -0
- package/dist/grpc/command.d.ts +23 -0
- package/dist/grpc/command.js +91 -0
- package/dist/grpc/expand.d.ts +25 -0
- package/dist/grpc/expand.js +52 -0
- package/dist/grpc/framing.d.ts +28 -0
- package/dist/grpc/framing.js +61 -0
- package/dist/grpc/import.d.ts +47 -0
- package/dist/grpc/import.js +88 -0
- package/dist/grpc/model.d.ts +179 -0
- package/dist/grpc/model.js +91 -0
- package/dist/grpc/proto/describe.d.ts +92 -0
- package/dist/grpc/proto/describe.js +205 -0
- package/dist/grpc/proto/load.d.ts +35 -0
- package/dist/grpc/proto/load.js +112 -0
- package/dist/grpc/proto/sample.d.ts +21 -0
- package/dist/grpc/proto/sample.js +79 -0
- package/dist/grpc/proto/well-known.d.ts +42 -0
- package/dist/grpc/proto/well-known.js +143 -0
- package/dist/grpc/reconcile.d.ts +42 -0
- package/dist/grpc/reconcile.js +153 -0
- package/dist/grpc/reflection/client.d.ts +70 -0
- package/dist/grpc/reflection/client.js +197 -0
- package/dist/grpc/reflection/descriptors.d.ts +69 -0
- package/dist/grpc/reflection/descriptors.js +140 -0
- package/dist/grpc/reflection/proto.d.ts +33 -0
- package/dist/grpc/reflection/proto.js +144 -0
- package/dist/grpc/send.d.ts +132 -0
- package/dist/grpc/send.js +435 -0
- package/dist/grpc/shape.d.ts +29 -0
- package/dist/grpc/shape.js +36 -0
- package/dist/grpc/status.d.ts +21 -0
- package/dist/grpc/status.js +62 -0
- package/dist/grpc/target.d.ts +21 -0
- package/dist/grpc/target.js +66 -0
- package/dist/http/auth/apply.d.ts +37 -0
- package/dist/http/auth/apply.js +74 -0
- package/dist/http/auth/basic.d.ts +36 -0
- package/dist/http/auth/basic.js +69 -0
- package/dist/http/auth/md4.d.ts +13 -0
- package/dist/http/auth/md4.js +81 -0
- package/dist/http/auth/ntlm-transport.d.ts +61 -0
- package/dist/http/auth/ntlm-transport.js +97 -0
- package/dist/http/auth/ntlm.d.ts +190 -0
- package/dist/http/auth/ntlm.js +377 -0
- package/dist/http/client.d.ts +73 -0
- package/dist/http/client.js +403 -0
- package/dist/http/curl-flags.d.ts +15 -0
- package/dist/http/curl-flags.js +95 -0
- package/dist/http/curl.d.ts +94 -0
- package/dist/http/curl.js +245 -0
- package/dist/http/decompress.d.ts +7 -0
- package/dist/http/decompress.js +22 -0
- package/dist/http/errors.d.ts +22 -0
- package/dist/http/errors.js +144 -0
- package/dist/http/failed-request.d.ts +27 -0
- package/dist/http/failed-request.js +48 -0
- package/dist/http/headers.d.ts +15 -0
- package/dist/http/headers.js +50 -0
- package/dist/http/heredoc.d.ts +25 -0
- package/dist/http/heredoc.js +74 -0
- package/dist/http/proxy.d.ts +103 -0
- package/dist/http/proxy.js +168 -0
- package/dist/http/raw-capture.d.ts +23 -0
- package/dist/http/raw-capture.js +57 -0
- package/dist/http/timings.d.ts +79 -0
- package/dist/http/timings.js +212 -0
- package/dist/http/tls.d.ts +111 -0
- package/dist/http/tls.js +167 -0
- package/dist/http/types.d.ts +125 -0
- package/dist/http/types.js +6 -0
- package/dist/import-detect.d.ts +26 -0
- package/dist/import-detect.js +169 -0
- package/dist/import.d.ts +20 -0
- package/dist/import.js +163 -0
- package/dist/index.d.ts +272 -0
- package/dist/index.js +157 -0
- package/dist/json/cursor.d.ts +43 -0
- package/dist/json/cursor.js +168 -0
- package/dist/operations.d.ts +12 -0
- package/dist/operations.js +52 -0
- package/dist/project/attachments-cache.d.ts +80 -0
- package/dist/project/attachments-cache.js +186 -0
- package/dist/project/endpoints.d.ts +23 -0
- package/dist/project/endpoints.js +47 -0
- package/dist/project/environments.d.ts +68 -0
- package/dist/project/environments.js +124 -0
- package/dist/project/fs.d.ts +45 -0
- package/dist/project/fs.js +78 -0
- package/dist/project/history.d.ts +171 -0
- package/dist/project/history.js +179 -0
- package/dist/project/keystores.d.ts +24 -0
- package/dist/project/keystores.js +66 -0
- package/dist/project/load.d.ts +44 -0
- package/dist/project/load.js +634 -0
- package/dist/project/migrate.d.ts +27 -0
- package/dist/project/migrate.js +46 -0
- package/dist/project/model.d.ts +401 -0
- package/dist/project/model.js +126 -0
- package/dist/project/paths.d.ts +134 -0
- package/dist/project/paths.js +259 -0
- package/dist/project/preferences.d.ts +318 -0
- package/dist/project/preferences.js +239 -0
- package/dist/project/properties.d.ts +97 -0
- package/dist/project/properties.js +356 -0
- package/dist/project/save.d.ts +65 -0
- package/dist/project/save.js +295 -0
- package/dist/project/schema.d.ts +1329 -0
- package/dist/project/schema.js +737 -0
- package/dist/project/serialize.d.ts +42 -0
- package/dist/project/serialize.js +385 -0
- package/dist/project/wss-configs.d.ts +40 -0
- package/dist/project/wss-configs.js +142 -0
- package/dist/project/yaml.d.ts +17 -0
- package/dist/project/yaml.js +39 -0
- package/dist/redact/index.d.ts +77 -0
- package/dist/redact/index.js +328 -0
- package/dist/redact/literal.d.ts +12 -0
- package/dist/redact/literal.js +68 -0
- package/dist/rest/auth.d.ts +53 -0
- package/dist/rest/auth.js +80 -0
- package/dist/rest/body.d.ts +61 -0
- package/dist/rest/body.js +184 -0
- package/dist/rest/browser.d.ts +12 -0
- package/dist/rest/browser.js +11 -0
- package/dist/rest/cookies.d.ts +41 -0
- package/dist/rest/cookies.js +102 -0
- package/dist/rest/curl.d.ts +75 -0
- package/dist/rest/curl.js +417 -0
- package/dist/rest/expand.d.ts +35 -0
- package/dist/rest/expand.js +104 -0
- package/dist/rest/model.d.ts +247 -0
- package/dist/rest/model.js +118 -0
- package/dist/rest/oauth2.d.ts +118 -0
- package/dist/rest/oauth2.js +212 -0
- package/dist/rest/openapi/cache.d.ts +54 -0
- package/dist/rest/openapi/cache.js +128 -0
- package/dist/rest/openapi/import.d.ts +67 -0
- package/dist/rest/openapi/import.js +91 -0
- package/dist/rest/openapi/map.d.ts +102 -0
- package/dist/rest/openapi/map.js +477 -0
- package/dist/rest/openapi/model.d.ts +203 -0
- package/dist/rest/openapi/model.js +37 -0
- package/dist/rest/openapi/parse.d.ts +44 -0
- package/dist/rest/openapi/parse.js +1530 -0
- package/dist/rest/openapi/refs.d.ts +63 -0
- package/dist/rest/openapi/refs.js +258 -0
- package/dist/rest/openapi/sample.d.ts +68 -0
- package/dist/rest/openapi/sample.js +336 -0
- package/dist/rest/postman/import.d.ts +21 -0
- package/dist/rest/postman/import.js +47 -0
- package/dist/rest/postman/index.d.ts +7 -0
- package/dist/rest/postman/index.js +7 -0
- package/dist/rest/postman/map.d.ts +28 -0
- package/dist/rest/postman/map.js +427 -0
- package/dist/rest/postman/model.d.ts +118 -0
- package/dist/rest/postman/model.js +7 -0
- package/dist/rest/postman/parse.d.ts +29 -0
- package/dist/rest/postman/parse.js +518 -0
- package/dist/rest/response.d.ts +72 -0
- package/dist/rest/response.js +221 -0
- package/dist/rest/send.d.ts +102 -0
- package/dist/rest/send.js +148 -0
- package/dist/rest/url.d.ts +92 -0
- package/dist/rest/url.js +213 -0
- package/dist/run/effective-auth.d.ts +10 -0
- package/dist/run/effective-auth.js +19 -0
- package/dist/run/index.d.ts +8 -0
- package/dist/run/index.js +4 -0
- package/dist/run/prepare.d.ts +43 -0
- package/dist/run/prepare.js +280 -0
- package/dist/run/run.d.ts +53 -0
- package/dist/run/run.js +223 -0
- package/dist/run/secret-needs.d.ts +13 -0
- package/dist/run/secret-needs.js +125 -0
- package/dist/run/select.d.ts +34 -0
- package/dist/run/select.js +76 -0
- package/dist/secrets/env-names.d.ts +27 -0
- package/dist/secrets/env-names.js +40 -0
- package/dist/secrets/resolve.d.ts +58 -0
- package/dist/secrets/resolve.js +136 -0
- package/dist/send-options.d.ts +141 -0
- package/dist/send-options.js +228 -0
- package/dist/send.d.ts +53 -0
- package/dist/send.js +210 -0
- package/dist/soap/body-builder.d.ts +38 -0
- package/dist/soap/body-builder.js +250 -0
- package/dist/soap/build-problems.d.ts +12 -0
- package/dist/soap/build-problems.js +2 -0
- package/dist/soap/charset.d.ts +23 -0
- package/dist/soap/charset.js +47 -0
- package/dist/soap/envelope.d.ts +44 -0
- package/dist/soap/envelope.js +76 -0
- package/dist/soap/fault.d.ts +46 -0
- package/dist/soap/fault.js +129 -0
- package/dist/soap/form-request.d.ts +34 -0
- package/dist/soap/form-request.js +251 -0
- package/dist/soap/legacy-project/definition-fetcher.d.ts +21 -0
- package/dist/soap/legacy-project/definition-fetcher.js +43 -0
- package/dist/soap/legacy-project/format.d.ts +18 -0
- package/dist/soap/legacy-project/format.js +24 -0
- package/dist/soap/legacy-project/import.d.ts +21 -0
- package/dist/soap/legacy-project/import.js +46 -0
- package/dist/soap/legacy-project/index.d.ts +9 -0
- package/dist/soap/legacy-project/index.js +5 -0
- package/dist/soap/legacy-project/map.d.ts +91 -0
- package/dist/soap/legacy-project/map.js +290 -0
- package/dist/soap/legacy-project/model.d.ts +98 -0
- package/dist/soap/legacy-project/model.js +5 -0
- package/dist/soap/legacy-project/parse.d.ts +16 -0
- package/dist/soap/legacy-project/parse.js +325 -0
- package/dist/soap/mime/cid-scan.d.ts +36 -0
- package/dist/soap/mime/cid-scan.js +52 -0
- package/dist/soap/mime/inline-files.d.ts +39 -0
- package/dist/soap/mime/inline-files.js +71 -0
- package/dist/soap/mime/mtom.d.ts +74 -0
- package/dist/soap/mime/mtom.js +134 -0
- package/dist/soap/mime/multipart.d.ts +66 -0
- package/dist/soap/mime/multipart.js +329 -0
- package/dist/soap/mime/send-pipeline.d.ts +61 -0
- package/dist/soap/mime/send-pipeline.js +145 -0
- package/dist/soap/mime/swa.d.ts +45 -0
- package/dist/soap/mime/swa.js +62 -0
- package/dist/soap/mime/types.d.ts +69 -0
- package/dist/soap/mime/types.js +10 -0
- package/dist/soap/namespace-scope.d.ts +32 -0
- package/dist/soap/namespace-scope.js +85 -0
- package/dist/soap/prefixes.d.ts +24 -0
- package/dist/soap/prefixes.js +70 -0
- package/dist/soap/recreate.d.ts +28 -0
- package/dist/soap/recreate.js +168 -0
- package/dist/soap/request-builder.d.ts +63 -0
- package/dist/soap/request-builder.js +161 -0
- package/dist/soap/response-parser.d.ts +29 -0
- package/dist/soap/response-parser.js +71 -0
- package/dist/soap/soap-action.d.ts +31 -0
- package/dist/soap/soap-action.js +28 -0
- package/dist/soap/transforms.d.ts +52 -0
- package/dist/soap/transforms.js +164 -0
- package/dist/types.d.ts +307 -0
- package/dist/types.js +6 -0
- package/dist/validate/index.d.ts +61 -0
- package/dist/validate/index.js +72 -0
- package/dist/validate/schema-file-set.d.ts +51 -0
- package/dist/validate/schema-file-set.js +288 -0
- package/dist/validate/schema-validator.d.ts +53 -0
- package/dist/validate/schema-validator.js +251 -0
- package/dist/validate/soap-structure.d.ts +34 -0
- package/dist/validate/soap-structure.js +255 -0
- package/dist/validate/types.d.ts +47 -0
- package/dist/validate/types.js +8 -0
- package/dist/validate/wsi/assertions/helpers.d.ts +145 -0
- package/dist/validate/wsi/assertions/helpers.js +387 -0
- package/dist/validate/wsi/assertions/index.d.ts +44 -0
- package/dist/validate/wsi/assertions/index.js +77 -0
- package/dist/validate/wsi/assertions/message/helpers.d.ts +63 -0
- package/dist/validate/wsi/assertions/message/helpers.js +168 -0
- package/dist/validate/wsi/assertions/message/index.d.ts +39 -0
- package/dist/validate/wsi/assertions/message/index.js +62 -0
- package/dist/validate/wsi/assertions/message/r1001.d.ts +10 -0
- package/dist/validate/wsi/assertions/message/r1001.js +38 -0
- package/dist/validate/wsi/assertions/message/r1003.d.ts +14 -0
- package/dist/validate/wsi/assertions/message/r1003.js +45 -0
- package/dist/validate/wsi/assertions/message/r1005.d.ts +12 -0
- package/dist/validate/wsi/assertions/message/r1005.js +37 -0
- package/dist/validate/wsi/assertions/message/r1006.d.ts +10 -0
- package/dist/validate/wsi/assertions/message/r1006.js +49 -0
- package/dist/validate/wsi/assertions/message/r1007.d.ts +10 -0
- package/dist/validate/wsi/assertions/message/r1007.js +30 -0
- package/dist/validate/wsi/assertions/message/r1011.d.ts +10 -0
- package/dist/validate/wsi/assertions/message/r1011.js +33 -0
- package/dist/validate/wsi/assertions/message/r1012.d.ts +13 -0
- package/dist/validate/wsi/assertions/message/r1012.js +37 -0
- package/dist/validate/wsi/assertions/message/r1013.d.ts +9 -0
- package/dist/validate/wsi/assertions/message/r1013.js +42 -0
- package/dist/validate/wsi/assertions/message/r1014.d.ts +10 -0
- package/dist/validate/wsi/assertions/message/r1014.js +30 -0
- package/dist/validate/wsi/assertions/message/r1015.d.ts +12 -0
- package/dist/validate/wsi/assertions/message/r1015.js +36 -0
- package/dist/validate/wsi/assertions/message/r1017.d.ts +10 -0
- package/dist/validate/wsi/assertions/message/r1017.js +30 -0
- package/dist/validate/wsi/assertions/message/r1100.d.ts +10 -0
- package/dist/validate/wsi/assertions/message/r1100.js +39 -0
- package/dist/validate/wsi/assertions/message/r1101.d.ts +10 -0
- package/dist/validate/wsi/assertions/message/r1101.js +37 -0
- package/dist/validate/wsi/assertions/message/r1102.d.ts +10 -0
- package/dist/validate/wsi/assertions/message/r1102.js +41 -0
- package/dist/validate/wsi/assertions/message/r1103.d.ts +10 -0
- package/dist/validate/wsi/assertions/message/r1103.js +28 -0
- package/dist/validate/wsi/assertions/message/r1107.d.ts +10 -0
- package/dist/validate/wsi/assertions/message/r1107.js +38 -0
- package/dist/validate/wsi/assertions/message/r1109.d.ts +10 -0
- package/dist/validate/wsi/assertions/message/r1109.js +32 -0
- package/dist/validate/wsi/assertions/message/r1124.d.ts +10 -0
- package/dist/validate/wsi/assertions/message/r1124.js +31 -0
- package/dist/validate/wsi/assertions/message/r1132.d.ts +9 -0
- package/dist/validate/wsi/assertions/message/r1132.js +23 -0
- package/dist/validate/wsi/assertions/message/r1140.d.ts +10 -0
- package/dist/validate/wsi/assertions/message/r1140.js +42 -0
- package/dist/validate/wsi/assertions/message/r1141.d.ts +10 -0
- package/dist/validate/wsi/assertions/message/r1141.js +32 -0
- package/dist/validate/wsi/assertions/message/r2113.d.ts +11 -0
- package/dist/validate/wsi/assertions/message/r2113.js +33 -0
- package/dist/validate/wsi/assertions/message/r2211.d.ts +7 -0
- package/dist/validate/wsi/assertions/message/r2211.js +42 -0
- package/dist/validate/wsi/assertions/r2001.d.ts +15 -0
- package/dist/validate/wsi/assertions/r2001.js +47 -0
- package/dist/validate/wsi/assertions/r2002.d.ts +11 -0
- package/dist/validate/wsi/assertions/r2002.js +38 -0
- package/dist/validate/wsi/assertions/r2003.d.ts +7 -0
- package/dist/validate/wsi/assertions/r2003.js +32 -0
- package/dist/validate/wsi/assertions/r2005.d.ts +7 -0
- package/dist/validate/wsi/assertions/r2005.js +40 -0
- package/dist/validate/wsi/assertions/r2101.d.ts +14 -0
- package/dist/validate/wsi/assertions/r2101.js +65 -0
- package/dist/validate/wsi/assertions/r2102.d.ts +10 -0
- package/dist/validate/wsi/assertions/r2102.js +41 -0
- package/dist/validate/wsi/assertions/r2105.d.ts +8 -0
- package/dist/validate/wsi/assertions/r2105.js +39 -0
- package/dist/validate/wsi/assertions/r2110.d.ts +8 -0
- package/dist/validate/wsi/assertions/r2110.js +38 -0
- package/dist/validate/wsi/assertions/r2111.d.ts +6 -0
- package/dist/validate/wsi/assertions/r2111.js +30 -0
- package/dist/validate/wsi/assertions/r2112.d.ts +7 -0
- package/dist/validate/wsi/assertions/r2112.js +35 -0
- package/dist/validate/wsi/assertions/r2201.d.ts +7 -0
- package/dist/validate/wsi/assertions/r2201.js +28 -0
- package/dist/validate/wsi/assertions/r2203.d.ts +7 -0
- package/dist/validate/wsi/assertions/r2203.js +30 -0
- package/dist/validate/wsi/assertions/r2204.d.ts +6 -0
- package/dist/validate/wsi/assertions/r2204.js +29 -0
- package/dist/validate/wsi/assertions/r2205.d.ts +8 -0
- package/dist/validate/wsi/assertions/r2205.js +46 -0
- package/dist/validate/wsi/assertions/r2206.d.ts +7 -0
- package/dist/validate/wsi/assertions/r2206.js +36 -0
- package/dist/validate/wsi/assertions/r2209.d.ts +12 -0
- package/dist/validate/wsi/assertions/r2209.js +37 -0
- package/dist/validate/wsi/assertions/r2210.d.ts +7 -0
- package/dist/validate/wsi/assertions/r2210.js +30 -0
- package/dist/validate/wsi/assertions/r2303.d.ts +7 -0
- package/dist/validate/wsi/assertions/r2303.js +44 -0
- package/dist/validate/wsi/assertions/r2304.d.ts +6 -0
- package/dist/validate/wsi/assertions/r2304.js +32 -0
- package/dist/validate/wsi/assertions/r2401.d.ts +12 -0
- package/dist/validate/wsi/assertions/r2401.js +31 -0
- package/dist/validate/wsi/assertions/r2701.d.ts +7 -0
- package/dist/validate/wsi/assertions/r2701.js +28 -0
- package/dist/validate/wsi/assertions/r2702.d.ts +6 -0
- package/dist/validate/wsi/assertions/r2702.js +26 -0
- package/dist/validate/wsi/assertions/r2705.d.ts +11 -0
- package/dist/validate/wsi/assertions/r2705.js +31 -0
- package/dist/validate/wsi/assertions/r2706.d.ts +7 -0
- package/dist/validate/wsi/assertions/r2706.js +29 -0
- package/dist/validate/wsi/assertions/r2710.d.ts +13 -0
- package/dist/validate/wsi/assertions/r2710.js +37 -0
- package/dist/validate/wsi/assertions/r2716.d.ts +7 -0
- package/dist/validate/wsi/assertions/r2716.js +29 -0
- package/dist/validate/wsi/assertions/r2717.d.ts +9 -0
- package/dist/validate/wsi/assertions/r2717.js +31 -0
- package/dist/validate/wsi/assertions/r2718.d.ts +7 -0
- package/dist/validate/wsi/assertions/r2718.js +41 -0
- package/dist/validate/wsi/assertions/r2720.d.ts +7 -0
- package/dist/validate/wsi/assertions/r2720.js +29 -0
- package/dist/validate/wsi/assertions/r2721.d.ts +6 -0
- package/dist/validate/wsi/assertions/r2721.js +27 -0
- package/dist/validate/wsi/assertions/r2722.d.ts +6 -0
- package/dist/validate/wsi/assertions/r2722.js +29 -0
- package/dist/validate/wsi/assertions/r2801.d.ts +7 -0
- package/dist/validate/wsi/assertions/r2801.js +39 -0
- package/dist/validate/wsi/assertions/r2803.d.ts +7 -0
- package/dist/validate/wsi/assertions/r2803.js +29 -0
- package/dist/validate/wsi/docs.d.ts +29 -0
- package/dist/validate/wsi/docs.js +167 -0
- package/dist/validate/wsi/index.d.ts +16 -0
- package/dist/validate/wsi/index.js +11 -0
- package/dist/validate/wsi/report-html.d.ts +36 -0
- package/dist/validate/wsi/report-html.js +135 -0
- package/dist/validate/wsi/run-message.d.ts +50 -0
- package/dist/validate/wsi/run-message.js +190 -0
- package/dist/validate/wsi/run-wsdl.d.ts +48 -0
- package/dist/validate/wsi/run-wsdl.js +99 -0
- package/dist/validate/wsi/types.d.ts +173 -0
- package/dist/validate/wsi/types.js +17 -0
- package/dist/workspace/commit-message.d.ts +47 -0
- package/dist/workspace/commit-message.js +195 -0
- package/dist/workspace/environments.d.ts +79 -0
- package/dist/workspace/environments.js +115 -0
- package/dist/workspace/index.d.ts +28 -0
- package/dist/workspace/index.js +19 -0
- package/dist/workspace/load.d.ts +45 -0
- package/dist/workspace/load.js +155 -0
- package/dist/workspace/local-state.d.ts +37 -0
- package/dist/workspace/local-state.js +59 -0
- package/dist/workspace/migrate.d.ts +38 -0
- package/dist/workspace/migrate.js +50 -0
- package/dist/workspace/model.d.ts +86 -0
- package/dist/workspace/model.js +54 -0
- package/dist/workspace/paths.d.ts +64 -0
- package/dist/workspace/paths.js +97 -0
- package/dist/workspace/reidentify.d.ts +22 -0
- package/dist/workspace/reidentify.js +122 -0
- package/dist/workspace/save.d.ts +31 -0
- package/dist/workspace/save.js +84 -0
- package/dist/workspace/schema.d.ts +93 -0
- package/dist/workspace/schema.js +115 -0
- package/dist/workspace/serialize.d.ts +24 -0
- package/dist/workspace/serialize.js +60 -0
- package/dist/workspace/share.d.ts +52 -0
- package/dist/workspace/share.js +89 -0
- package/dist/ws/browser.d.ts +13 -0
- package/dist/ws/browser.js +11 -0
- package/dist/ws/call.d.ts +53 -0
- package/dist/ws/call.js +106 -0
- package/dist/ws/command.d.ts +19 -0
- package/dist/ws/command.js +28 -0
- package/dist/ws/expand.d.ts +38 -0
- package/dist/ws/expand.js +76 -0
- package/dist/ws/model.d.ts +191 -0
- package/dist/ws/model.js +83 -0
- package/dist/ws/pretty.d.ts +12 -0
- package/dist/ws/pretty.js +25 -0
- package/dist/ws/session.d.ts +50 -0
- package/dist/ws/session.js +333 -0
- package/dist/ws/shape.d.ts +18 -0
- package/dist/ws/shape.js +28 -0
- package/dist/ws/transcript.d.ts +14 -0
- package/dist/ws/transcript.js +29 -0
- package/dist/ws/url.d.ts +3 -0
- package/dist/ws/url.js +44 -0
- package/dist/wsa/headers.d.ts +78 -0
- package/dist/wsa/headers.js +244 -0
- package/dist/wsa/model.d.ts +66 -0
- package/dist/wsa/model.js +52 -0
- package/dist/wsa/policy-detect.d.ts +81 -0
- package/dist/wsa/policy-detect.js +245 -0
- package/dist/wsdl/cache-naming.d.ts +39 -0
- package/dist/wsdl/cache-naming.js +90 -0
- package/dist/wsdl/cache.d.ts +48 -0
- package/dist/wsdl/cache.js +141 -0
- package/dist/wsdl/docs-generator.d.ts +47 -0
- package/dist/wsdl/docs-generator.js +439 -0
- package/dist/wsdl/dom-utils.d.ts +15 -0
- package/dist/wsdl/dom-utils.js +50 -0
- package/dist/wsdl/export-definition.d.ts +38 -0
- package/dist/wsdl/export-definition.js +100 -0
- package/dist/wsdl/fetch.d.ts +13 -0
- package/dist/wsdl/fetch.js +60 -0
- package/dist/wsdl/merge.d.ts +17 -0
- package/dist/wsdl/merge.js +57 -0
- package/dist/wsdl/model.d.ts +176 -0
- package/dist/wsdl/model.js +17 -0
- package/dist/wsdl/parse-binding.d.ts +6 -0
- package/dist/wsdl/parse-binding.js +150 -0
- package/dist/wsdl/parse-wsdl.d.ts +47 -0
- package/dist/wsdl/parse-wsdl.js +161 -0
- package/dist/wsdl/qname.d.ts +28 -0
- package/dist/wsdl/qname.js +41 -0
- package/dist/wsdl/ref-policy.d.ts +54 -0
- package/dist/wsdl/ref-policy.js +87 -0
- package/dist/wsdl/resolver.d.ts +81 -0
- package/dist/wsdl/resolver.js +276 -0
- package/dist/wsdl/update-definition.d.ts +106 -0
- package/dist/wsdl/update-definition.js +314 -0
- package/dist/wss/apply.d.ts +40 -0
- package/dist/wss/apply.js +212 -0
- package/dist/wss/c14n-prefixes.d.ts +27 -0
- package/dist/wss/c14n-prefixes.js +95 -0
- package/dist/wss/incoming/decrypt.d.ts +35 -0
- package/dist/wss/incoming/decrypt.js +57 -0
- package/dist/wss/incoming/index.d.ts +56 -0
- package/dist/wss/incoming/index.js +189 -0
- package/dist/wss/incoming/verify.d.ts +74 -0
- package/dist/wss/incoming/verify.js +440 -0
- package/dist/wss/key-identifiers.d.ts +76 -0
- package/dist/wss/key-identifiers.js +139 -0
- package/dist/wss/keystore/certificate.d.ts +45 -0
- package/dist/wss/keystore/certificate.js +134 -0
- package/dist/wss/keystore/index.d.ts +50 -0
- package/dist/wss/keystore/index.js +80 -0
- package/dist/wss/keystore/model.d.ts +83 -0
- package/dist/wss/keystore/model.js +27 -0
- package/dist/wss/keystore/pem.d.ts +21 -0
- package/dist/wss/keystore/pem.js +140 -0
- package/dist/wss/keystore/pkcs12.d.ts +21 -0
- package/dist/wss/keystore/pkcs12.js +125 -0
- package/dist/wss/model.d.ts +160 -0
- package/dist/wss/model.js +37 -0
- package/dist/wss/outgoing/encryption.d.ts +76 -0
- package/dist/wss/outgoing/encryption.js +618 -0
- package/dist/wss/outgoing/signature.d.ts +73 -0
- package/dist/wss/outgoing/signature.js +239 -0
- package/dist/wss/outgoing/timestamp.d.ts +29 -0
- package/dist/wss/outgoing/timestamp.js +39 -0
- package/dist/wss/outgoing/username-token.d.ts +36 -0
- package/dist/wss/outgoing/username-token.js +68 -0
- package/dist/wss/security-header.d.ts +31 -0
- package/dist/wss/security-header.js +83 -0
- package/dist/xml/index.d.ts +7 -0
- package/dist/xml/index.js +7 -0
- package/dist/xml/namespaces.d.ts +36 -0
- package/dist/xml/namespaces.js +60 -0
- package/dist/xml/parse.d.ts +79 -0
- package/dist/xml/parse.js +109 -0
- package/dist/xml/positions.d.ts +26 -0
- package/dist/xml/positions.js +71 -0
- package/dist/xml/pretty.d.ts +37 -0
- package/dist/xml/pretty.js +137 -0
- package/dist/xml/serialize.d.ts +6 -0
- package/dist/xml/serialize.js +8 -0
- package/dist/xml/tolerant-tree.d.ts +56 -0
- package/dist/xml/tolerant-tree.js +134 -0
- package/dist/xpath/evaluate-async.d.ts +31 -0
- package/dist/xpath/evaluate-async.js +81 -0
- package/dist/xpath/evaluate.d.ts +98 -0
- package/dist/xpath/evaluate.js +340 -0
- package/dist/xpath/jsonpath.d.ts +40 -0
- package/dist/xpath/jsonpath.js +109 -0
- package/dist/xpath/namespaces.d.ts +29 -0
- package/dist/xpath/namespaces.js +101 -0
- package/dist/xpath/worker.d.ts +7 -0
- package/dist/xpath/worker.js +26 -0
- package/dist/xsd/builtins.d.ts +36 -0
- package/dist/xsd/builtins.js +108 -0
- package/dist/xsd/check-references.d.ts +25 -0
- package/dist/xsd/check-references.js +145 -0
- package/dist/xsd/form-edits.d.ts +57 -0
- package/dist/xsd/form-edits.js +153 -0
- package/dist/xsd/form-model.d.ts +153 -0
- package/dist/xsd/form-model.js +691 -0
- package/dist/xsd/locate.d.ts +42 -0
- package/dist/xsd/locate.js +249 -0
- package/dist/xsd/model.d.ts +249 -0
- package/dist/xsd/model.js +1 -0
- package/dist/xsd/parse-particles.d.ts +48 -0
- package/dist/xsd/parse-particles.js +320 -0
- package/dist/xsd/parse-schema.d.ts +21 -0
- package/dist/xsd/parse-schema.js +143 -0
- package/dist/xsd/resolve-content.d.ts +18 -0
- package/dist/xsd/resolve-content.js +242 -0
- package/dist/xsd/sample-generator.d.ts +51 -0
- package/dist/xsd/sample-generator.js +291 -0
- package/dist/xsd/sample-types.d.ts +21 -0
- package/dist/xsd/sample-types.js +69 -0
- package/dist/xsd/sample-values.d.ts +54 -0
- package/dist/xsd/sample-values.js +267 -0
- package/dist/xsd/schema-set.d.ts +51 -0
- package/dist/xsd/schema-set.js +203 -0
- package/dist/xsd/xml-scan.d.ts +64 -0
- package/dist/xsd/xml-scan.js +286 -0
- package/dist/xsd/xml-writer.d.ts +56 -0
- package/dist/xsd/xml-writer.js +103 -0
- package/package.json +69 -0
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sending one request with credentials that may need a round trip of their own.
|
|
3
|
+
*
|
|
4
|
+
* Basic can be preemptive or answer a 401 challenge; NTLMv2 needs three legs on one connection.
|
|
5
|
+
* Both are transport concerns rather than protocol ones, so this module owns them for every
|
|
6
|
+
* protocol: the SOAP send and the REST send call it instead of each implementing the same flow.
|
|
7
|
+
*
|
|
8
|
+
* Every scheme that needs no round trip — a bearer token, an API key, an OAuth2 access token — is
|
|
9
|
+
* applied by its own protocol layer as a plain header or query value and never reaches here.
|
|
10
|
+
*/
|
|
11
|
+
import type { Dispatcher } from 'undici';
|
|
12
|
+
import type { HttpExchange, HttpRequest } from '../types.js';
|
|
13
|
+
import type { AuthSummary, SendAuth } from '../../types.js';
|
|
14
|
+
/** Options for {@link sendWithAuth}: the same hooks `sendHttp` takes, for tests. */
|
|
15
|
+
export interface SendWithAuthOptions {
|
|
16
|
+
readonly dispatcher?: Dispatcher;
|
|
17
|
+
readonly now?: () => number;
|
|
18
|
+
}
|
|
19
|
+
/** What one authenticated send did: the final exchange, and how it got there. */
|
|
20
|
+
export interface AuthenticatedExchange {
|
|
21
|
+
readonly http: HttpExchange;
|
|
22
|
+
/** Total time across every leg, which is what the UI shows as the send's duration. */
|
|
23
|
+
readonly durationMs: number;
|
|
24
|
+
/** Absent when there were no credentials to apply. */
|
|
25
|
+
readonly auth?: AuthSummary;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Sends `request`, applying `auth` if it is a scheme that needs the transport's help.
|
|
29
|
+
*
|
|
30
|
+
* A caller-supplied `Authorization` header is an explicit override and wins: two credentials on one
|
|
31
|
+
* request is never what anyone meant. A Basic credential that is not preemptive is sent bare first
|
|
32
|
+
* and retried once if the server answers with a 401 `Basic` challenge; both attempts share the one
|
|
33
|
+
* timeout budget, so a challenged send cannot take twice as long as the user allowed. When the
|
|
34
|
+
* budget is already spent the 401 is reported as the result rather than retried into a certain
|
|
35
|
+
* timeout.
|
|
36
|
+
*/
|
|
37
|
+
export declare function sendWithAuth(request: HttpRequest, auth: SendAuth | undefined, options?: SendWithAuthOptions): Promise<AuthenticatedExchange>;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sending one request with credentials that may need a round trip of their own.
|
|
3
|
+
*
|
|
4
|
+
* Basic can be preemptive or answer a 401 challenge; NTLMv2 needs three legs on one connection.
|
|
5
|
+
* Both are transport concerns rather than protocol ones, so this module owns them for every
|
|
6
|
+
* protocol: the SOAP send and the REST send call it instead of each implementing the same flow.
|
|
7
|
+
*
|
|
8
|
+
* Every scheme that needs no round trip — a bearer token, an API key, an OAuth2 access token — is
|
|
9
|
+
* applied by its own protocol layer as a plain header or query value and never reaches here.
|
|
10
|
+
*/
|
|
11
|
+
import { sendHttp } from '../client.js';
|
|
12
|
+
import { headerValue } from '../headers.js';
|
|
13
|
+
import { basicAuthorization, isBasicChallenge } from './basic.js';
|
|
14
|
+
import { ntlmHandshake } from './ntlm-transport.js';
|
|
15
|
+
/**
|
|
16
|
+
* Sends `request`, applying `auth` if it is a scheme that needs the transport's help.
|
|
17
|
+
*
|
|
18
|
+
* A caller-supplied `Authorization` header is an explicit override and wins: two credentials on one
|
|
19
|
+
* request is never what anyone meant. A Basic credential that is not preemptive is sent bare first
|
|
20
|
+
* and retried once if the server answers with a 401 `Basic` challenge; both attempts share the one
|
|
21
|
+
* timeout budget, so a challenged send cannot take twice as long as the user allowed. When the
|
|
22
|
+
* budget is already spent the 401 is reported as the result rather than retried into a certain
|
|
23
|
+
* timeout.
|
|
24
|
+
*/
|
|
25
|
+
export async function sendWithAuth(request, auth, options) {
|
|
26
|
+
const callerAuthorization = headerValue(request.headers, 'authorization') !== undefined;
|
|
27
|
+
const basicAuth = auth?.type === 'basic' && !callerAuthorization ? auth : undefined;
|
|
28
|
+
const ntlmAuth = auth?.type === 'ntlm' && !callerAuthorization ? auth : undefined;
|
|
29
|
+
const headers = { ...request.headers };
|
|
30
|
+
if (basicAuth?.preemptive === true) {
|
|
31
|
+
headers.Authorization = basicAuthorization(basicAuth.username, basicAuth.password);
|
|
32
|
+
}
|
|
33
|
+
const firstRequest = { ...request, headers };
|
|
34
|
+
const now = options?.now ?? Date.now;
|
|
35
|
+
const startedAt = now();
|
|
36
|
+
let http;
|
|
37
|
+
let durationMs;
|
|
38
|
+
let challenged = false;
|
|
39
|
+
let attempts = 1;
|
|
40
|
+
if (ntlmAuth !== undefined) {
|
|
41
|
+
// NTLM owns the whole exchange: three legs on one connection, its own dispatcher.
|
|
42
|
+
const handshake = await ntlmHandshake(firstRequest, ntlmAuth, {
|
|
43
|
+
...(options?.now !== undefined ? { now: options.now } : {}),
|
|
44
|
+
...(options?.dispatcher !== undefined ? { dispatcher: options.dispatcher } : {}),
|
|
45
|
+
});
|
|
46
|
+
http = handshake.http;
|
|
47
|
+
durationMs = handshake.durationMs;
|
|
48
|
+
challenged = handshake.challenged;
|
|
49
|
+
attempts = handshake.attempts;
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
http = await sendHttp(firstRequest, options);
|
|
53
|
+
durationMs = http.timings.totalMs;
|
|
54
|
+
}
|
|
55
|
+
if (basicAuth !== undefined && basicAuth.preemptive !== true && isBasicChallenge(http)) {
|
|
56
|
+
challenged = true;
|
|
57
|
+
const remainingMs = request.timeoutMs - (now() - startedAt);
|
|
58
|
+
if (remainingMs > 0) {
|
|
59
|
+
attempts = 2;
|
|
60
|
+
const retry = await sendHttp({
|
|
61
|
+
...firstRequest,
|
|
62
|
+
headers: { ...headers, Authorization: basicAuthorization(basicAuth.username, basicAuth.password) },
|
|
63
|
+
timeoutMs: remainingMs,
|
|
64
|
+
}, options);
|
|
65
|
+
durationMs += retry.timings.totalMs;
|
|
66
|
+
http = retry;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return {
|
|
70
|
+
http,
|
|
71
|
+
durationMs,
|
|
72
|
+
...(auth !== undefined ? { auth: { scheme: auth.type, challenged, attempts } } : {}),
|
|
73
|
+
};
|
|
74
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HTTP Basic authentication (RFC 7617) plus the `WWW-Authenticate` parsing needed to
|
|
3
|
+
* recognise a 401 challenge. Pure string work — the send path owns the retry.
|
|
4
|
+
*/
|
|
5
|
+
/** One parsed `WWW-Authenticate` challenge: a lower-cased scheme and its (lower-cased) parameter names. */
|
|
6
|
+
export interface AuthChallenge {
|
|
7
|
+
readonly scheme: string;
|
|
8
|
+
readonly params: Readonly<Record<string, string>>;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Builds the `Authorization` header value for Basic credentials: `Basic base64(user:password)`
|
|
12
|
+
* with the credentials encoded as UTF-8 (RFC 7617's `charset` parameter is only ever `UTF-8`).
|
|
13
|
+
*
|
|
14
|
+
* @param username the user id; must not contain a colon per RFC 7617
|
|
15
|
+
* @param password the password; colons are fine, only the first colon separates
|
|
16
|
+
*/
|
|
17
|
+
export declare function basicAuthorization(username: string, password: string): string;
|
|
18
|
+
/**
|
|
19
|
+
* Tolerantly parses a `WWW-Authenticate` header into its challenges. Real servers send
|
|
20
|
+
* several challenges in one header, quote (or fail to quote) parameter values, and use any
|
|
21
|
+
* casing they like, so this favours recovering what it can over strict RFC 7235 grammar.
|
|
22
|
+
* A `token68` credential after the scheme (as NTLM sends) yields the scheme with no params.
|
|
23
|
+
*
|
|
24
|
+
* @param header the raw header value, or `undefined` when the response had none
|
|
25
|
+
*/
|
|
26
|
+
export declare function parseWwwAuthenticate(header: string | undefined): readonly AuthChallenge[];
|
|
27
|
+
/**
|
|
28
|
+
* True when `response` is a 401 offering a `Basic` challenge — the signal that a
|
|
29
|
+
* non-preemptive Basic send should retry once with an `Authorization` header.
|
|
30
|
+
*
|
|
31
|
+
* @param response the status and (case-insensitive) headers of the response to inspect
|
|
32
|
+
*/
|
|
33
|
+
export declare function isBasicChallenge(response: {
|
|
34
|
+
readonly status: number;
|
|
35
|
+
readonly headers: Readonly<Record<string, string>>;
|
|
36
|
+
}): boolean;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HTTP Basic authentication (RFC 7617) plus the `WWW-Authenticate` parsing needed to
|
|
3
|
+
* recognise a 401 challenge. Pure string work — the send path owns the retry.
|
|
4
|
+
*/
|
|
5
|
+
import { headerValue } from '../headers.js';
|
|
6
|
+
/**
|
|
7
|
+
* Builds the `Authorization` header value for Basic credentials: `Basic base64(user:password)`
|
|
8
|
+
* with the credentials encoded as UTF-8 (RFC 7617's `charset` parameter is only ever `UTF-8`).
|
|
9
|
+
*
|
|
10
|
+
* @param username the user id; must not contain a colon per RFC 7617
|
|
11
|
+
* @param password the password; colons are fine, only the first colon separates
|
|
12
|
+
*/
|
|
13
|
+
export function basicAuthorization(username, password) {
|
|
14
|
+
return `Basic ${Buffer.from(`${username}:${password}`, 'utf-8').toString('base64')}`;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Tolerantly parses a `WWW-Authenticate` header into its challenges. Real servers send
|
|
18
|
+
* several challenges in one header, quote (or fail to quote) parameter values, and use any
|
|
19
|
+
* casing they like, so this favours recovering what it can over strict RFC 7235 grammar.
|
|
20
|
+
* A `token68` credential after the scheme (as NTLM sends) yields the scheme with no params.
|
|
21
|
+
*
|
|
22
|
+
* @param header the raw header value, or `undefined` when the response had none
|
|
23
|
+
*/
|
|
24
|
+
export function parseWwwAuthenticate(header) {
|
|
25
|
+
if (header === undefined || header.trim() === '') {
|
|
26
|
+
return [];
|
|
27
|
+
}
|
|
28
|
+
const challenges = [];
|
|
29
|
+
// One regex pass over the header: either `name=value` (quoted or not) belonging to the
|
|
30
|
+
// current challenge, or a bare token that starts a new one.
|
|
31
|
+
const token = /([A-Za-z0-9!#$%&'*+\-.^_`|~]+)\s*=\s*("(?:[^"\\]|\\.)*"|[^,\s]*)|([A-Za-z0-9!#$%&'*+\-.^_`|~/=]+)/g;
|
|
32
|
+
let match;
|
|
33
|
+
let lastEnd = 0;
|
|
34
|
+
while ((match = token.exec(header)) !== null) {
|
|
35
|
+
const [, name, rawValue, bare] = match;
|
|
36
|
+
const separated = header.slice(lastEnd, match.index).includes(',');
|
|
37
|
+
lastEnd = match.index + match[0].length;
|
|
38
|
+
if (name !== undefined && rawValue !== undefined) {
|
|
39
|
+
const current = challenges[challenges.length - 1];
|
|
40
|
+
if (current === undefined) {
|
|
41
|
+
continue;
|
|
42
|
+
}
|
|
43
|
+
const value = rawValue.startsWith('"') && rawValue.endsWith('"') && rawValue.length >= 2
|
|
44
|
+
? rawValue.slice(1, -1).replace(/\\(.)/g, '$1')
|
|
45
|
+
: rawValue;
|
|
46
|
+
current.params[name.toLowerCase()] = value;
|
|
47
|
+
}
|
|
48
|
+
else if (bare !== undefined) {
|
|
49
|
+
if (!separated && challenges.length > 0) {
|
|
50
|
+
// A bare token right after a scheme is its `token68` credential (NTLM), not a new scheme.
|
|
51
|
+
continue;
|
|
52
|
+
}
|
|
53
|
+
challenges.push({ scheme: bare.toLowerCase(), params: {} });
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return challenges;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* True when `response` is a 401 offering a `Basic` challenge — the signal that a
|
|
60
|
+
* non-preemptive Basic send should retry once with an `Authorization` header.
|
|
61
|
+
*
|
|
62
|
+
* @param response the status and (case-insensitive) headers of the response to inspect
|
|
63
|
+
*/
|
|
64
|
+
export function isBasicChallenge(response) {
|
|
65
|
+
if (response.status !== 401) {
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
return parseWwwAuthenticate(headerValue(response.headers, 'www-authenticate')).some((challenge) => challenge.scheme === 'basic');
|
|
69
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MD4 (RFC 1320), implemented here because NTLM's NT hash is `MD4(UTF-16LE(password))`
|
|
3
|
+
* and Node's `crypto` only exposes MD4 through the OpenSSL legacy provider, which is
|
|
4
|
+
* disabled in the Node builds we ship on. MD4 is used *only* as NTLM's key-derivation
|
|
5
|
+
* primitive; it is not a security primitive anywhere else in Wirebench.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Computes the MD4 digest of `bytes`.
|
|
9
|
+
*
|
|
10
|
+
* @param bytes the message to hash
|
|
11
|
+
* @returns the 16-byte digest
|
|
12
|
+
*/
|
|
13
|
+
export declare function md4(bytes: Uint8Array): Uint8Array;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MD4 (RFC 1320), implemented here because NTLM's NT hash is `MD4(UTF-16LE(password))`
|
|
3
|
+
* and Node's `crypto` only exposes MD4 through the OpenSSL legacy provider, which is
|
|
4
|
+
* disabled in the Node builds we ship on. MD4 is used *only* as NTLM's key-derivation
|
|
5
|
+
* primitive; it is not a security primitive anywhere else in Wirebench.
|
|
6
|
+
*/
|
|
7
|
+
/** Left-rotates a 32-bit word, staying inside the 32-bit range. */
|
|
8
|
+
function rotl(x, n) {
|
|
9
|
+
return ((x << n) | (x >>> (32 - n))) >>> 0;
|
|
10
|
+
}
|
|
11
|
+
function f(x, y, z) {
|
|
12
|
+
return (x & y) | (~x & z);
|
|
13
|
+
}
|
|
14
|
+
function g(x, y, z) {
|
|
15
|
+
return (x & y) | (x & z) | (y & z);
|
|
16
|
+
}
|
|
17
|
+
function h(x, y, z) {
|
|
18
|
+
return x ^ y ^ z;
|
|
19
|
+
}
|
|
20
|
+
/** Round-1 order is 0..15; rounds 2 and 3 permute the block words per RFC 1320 §3.4. */
|
|
21
|
+
const ROUND2_ORDER = [0, 4, 8, 12, 1, 5, 9, 13, 2, 6, 10, 14, 3, 7, 11, 15];
|
|
22
|
+
const ROUND3_ORDER = [0, 8, 4, 12, 2, 10, 6, 14, 1, 9, 5, 13, 3, 11, 7, 15];
|
|
23
|
+
const SHIFTS_1 = [3, 7, 11, 19];
|
|
24
|
+
const SHIFTS_2 = [3, 5, 9, 13];
|
|
25
|
+
const SHIFTS_3 = [3, 9, 11, 15];
|
|
26
|
+
/**
|
|
27
|
+
* Computes the MD4 digest of `bytes`.
|
|
28
|
+
*
|
|
29
|
+
* @param bytes the message to hash
|
|
30
|
+
* @returns the 16-byte digest
|
|
31
|
+
*/
|
|
32
|
+
export function md4(bytes) {
|
|
33
|
+
// Pad to a multiple of 64 bytes: 0x80, zeroes, then the bit length as 64-bit little-endian.
|
|
34
|
+
const bitLength = BigInt(bytes.length) * 8n;
|
|
35
|
+
const paddedLength = (((bytes.length + 8) >> 6) + 1) << 6;
|
|
36
|
+
const message = new Uint8Array(paddedLength);
|
|
37
|
+
message.set(bytes, 0);
|
|
38
|
+
message[bytes.length] = 0x80;
|
|
39
|
+
const view = new DataView(message.buffer);
|
|
40
|
+
view.setBigUint64(paddedLength - 8, bitLength & 0xffffffffffffffffn, true);
|
|
41
|
+
let a = 0x67452301;
|
|
42
|
+
let b = 0xefcdab89;
|
|
43
|
+
let c = 0x98badcfe;
|
|
44
|
+
let d = 0x10325476;
|
|
45
|
+
const words = new Array(16);
|
|
46
|
+
for (let offset = 0; offset < paddedLength; offset += 64) {
|
|
47
|
+
for (let i = 0; i < 16; i++) {
|
|
48
|
+
words[i] = view.getUint32(offset + i * 4, true);
|
|
49
|
+
}
|
|
50
|
+
const [aa, bb, cc, dd] = [a, b, c, d];
|
|
51
|
+
for (let i = 0; i < 16; i++) {
|
|
52
|
+
const shift = SHIFTS_1[i % 4] ?? 0;
|
|
53
|
+
const word = words[i] ?? 0;
|
|
54
|
+
const value = (a + f(b, c, d) + word) >>> 0;
|
|
55
|
+
[a, b, c, d] = [d, rotl(value, shift), b, c];
|
|
56
|
+
}
|
|
57
|
+
for (let i = 0; i < 16; i++) {
|
|
58
|
+
const shift = SHIFTS_2[i % 4] ?? 0;
|
|
59
|
+
const word = words[ROUND2_ORDER[i] ?? 0] ?? 0;
|
|
60
|
+
const value = (a + g(b, c, d) + word + 0x5a827999) >>> 0;
|
|
61
|
+
[a, b, c, d] = [d, rotl(value, shift), b, c];
|
|
62
|
+
}
|
|
63
|
+
for (let i = 0; i < 16; i++) {
|
|
64
|
+
const shift = SHIFTS_3[i % 4] ?? 0;
|
|
65
|
+
const word = words[ROUND3_ORDER[i] ?? 0] ?? 0;
|
|
66
|
+
const value = (a + h(b, c, d) + word + 0x6ed9eba1) >>> 0;
|
|
67
|
+
[a, b, c, d] = [d, rotl(value, shift), b, c];
|
|
68
|
+
}
|
|
69
|
+
a = (a + aa) >>> 0;
|
|
70
|
+
b = (b + bb) >>> 0;
|
|
71
|
+
c = (c + cc) >>> 0;
|
|
72
|
+
d = (d + dd) >>> 0;
|
|
73
|
+
}
|
|
74
|
+
const digest = new Uint8Array(16);
|
|
75
|
+
const out = new DataView(digest.buffer);
|
|
76
|
+
out.setUint32(0, a, true);
|
|
77
|
+
out.setUint32(4, b, true);
|
|
78
|
+
out.setUint32(8, c, true);
|
|
79
|
+
out.setUint32(12, d, true);
|
|
80
|
+
return digest;
|
|
81
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The NTLM three-leg handshake over HTTP. NTLM authenticates the *connection*, so every leg
|
|
3
|
+
* has to travel over one socket: this module opens a dedicated single-connection dispatcher,
|
|
4
|
+
* runs the legs sequentially over it, and closes it again.
|
|
5
|
+
*
|
|
6
|
+
* leg 1 bare request, the real body → 200 (no auth needed), or 401 + `WWW-Authenticate: NTLM`
|
|
7
|
+
* leg 2 Type 1, empty body → 401 + `WWW-Authenticate: NTLM <Type 2>`
|
|
8
|
+
* leg 3 Type 3, the real body again → the final response
|
|
9
|
+
*
|
|
10
|
+
* Leg 1 *is* the caller's real request — most servers never challenge it, so the common
|
|
11
|
+
* case pays for the envelope exactly once. The empty-body optimisation applies only to leg
|
|
12
|
+
* 2, the Type 1 token, which never carries a body of its own; a server that does challenge
|
|
13
|
+
* causes the envelope to cross the wire a second time, on leg 3.
|
|
14
|
+
*/
|
|
15
|
+
import type { Dispatcher } from 'undici';
|
|
16
|
+
import type { HttpExchange, HttpRequest } from '../types.js';
|
|
17
|
+
/** The NTLM credentials, as resolved by the caller. The password is never logged or stored. */
|
|
18
|
+
export interface NtlmCredentials {
|
|
19
|
+
readonly username: string;
|
|
20
|
+
readonly password: string;
|
|
21
|
+
readonly domain?: string;
|
|
22
|
+
readonly workstation?: string;
|
|
23
|
+
}
|
|
24
|
+
/** The outcome of {@link ntlmHandshake}: the final exchange plus how it was reached. */
|
|
25
|
+
export interface NtlmHandshakeResult {
|
|
26
|
+
/** The exchange of the last leg actually made — its raw capture is the one to surface. */
|
|
27
|
+
readonly http: HttpExchange;
|
|
28
|
+
/** 1 (no challenge), 2 (challenge without a usable Type 2) or 3 (full handshake). */
|
|
29
|
+
readonly attempts: 1 | 2 | 3;
|
|
30
|
+
/** True once the server answered any leg with an NTLM challenge. */
|
|
31
|
+
readonly challenged: boolean;
|
|
32
|
+
/** The summed wall time of every leg, so a handshake reports its true cost. */
|
|
33
|
+
readonly durationMs: number;
|
|
34
|
+
}
|
|
35
|
+
/** Injection points for tests: the clock, the client nonce and the timestamp in the NTLMv2 blob. */
|
|
36
|
+
export interface NtlmHandshakeOptions {
|
|
37
|
+
readonly now?: () => number;
|
|
38
|
+
/** The 8-byte client challenge; random when omitted. */
|
|
39
|
+
readonly clientChallenge?: Uint8Array;
|
|
40
|
+
/** The NTLMv2 blob timestamp as a Windows FILETIME; `now()` when omitted. */
|
|
41
|
+
readonly timestamp?: bigint;
|
|
42
|
+
/**
|
|
43
|
+
* A dispatcher to run the legs on instead of a freshly created single-connection one.
|
|
44
|
+
* Only tests pass this; it is the caller's to close.
|
|
45
|
+
*/
|
|
46
|
+
readonly dispatcher?: Dispatcher;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Runs the NTLM handshake for `request` and returns the final exchange.
|
|
50
|
+
*
|
|
51
|
+
* All legs share the one `request.timeoutMs` budget (each leg gets what is left of it) and
|
|
52
|
+
* the caller's `AbortSignal`; a budget already spent stops the handshake and reports the
|
|
53
|
+
* last exchange as it stands, rather than firing a leg doomed to time out immediately.
|
|
54
|
+
* A 401 from the final leg (a wrong password, typically) is returned as a normal exchange,
|
|
55
|
+
* not thrown.
|
|
56
|
+
*
|
|
57
|
+
* @param request the fully-built request, including the real body for the final leg
|
|
58
|
+
* @param credentials the NTLM account to authenticate as
|
|
59
|
+
* @param options injected clock/nonce/dispatcher, for deterministic tests
|
|
60
|
+
*/
|
|
61
|
+
export declare function ntlmHandshake(request: HttpRequest, credentials: NtlmCredentials, options?: NtlmHandshakeOptions): Promise<NtlmHandshakeResult>;
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The NTLM three-leg handshake over HTTP. NTLM authenticates the *connection*, so every leg
|
|
3
|
+
* has to travel over one socket: this module opens a dedicated single-connection dispatcher,
|
|
4
|
+
* runs the legs sequentially over it, and closes it again.
|
|
5
|
+
*
|
|
6
|
+
* leg 1 bare request, the real body → 200 (no auth needed), or 401 + `WWW-Authenticate: NTLM`
|
|
7
|
+
* leg 2 Type 1, empty body → 401 + `WWW-Authenticate: NTLM <Type 2>`
|
|
8
|
+
* leg 3 Type 3, the real body again → the final response
|
|
9
|
+
*
|
|
10
|
+
* Leg 1 *is* the caller's real request — most servers never challenge it, so the common
|
|
11
|
+
* case pays for the envelope exactly once. The empty-body optimisation applies only to leg
|
|
12
|
+
* 2, the Type 1 token, which never carries a body of its own; a server that does challenge
|
|
13
|
+
* causes the envelope to cross the wire a second time, on leg 3.
|
|
14
|
+
*/
|
|
15
|
+
import { randomBytes } from 'node:crypto';
|
|
16
|
+
import { createSingleConnectionDispatcher } from '../client.js';
|
|
17
|
+
import { sendHttp } from '../client.js';
|
|
18
|
+
import { headerValue, withoutHeader } from '../headers.js';
|
|
19
|
+
import { createType1, createType3, encodeNtlmAuthorization, offersNtlm, parseNtlmChallengeHeader, parseType2, toFileTime, } from './ntlm.js';
|
|
20
|
+
const EMPTY_BODY = new Uint8Array(0);
|
|
21
|
+
/**
|
|
22
|
+
* Runs the NTLM handshake for `request` and returns the final exchange.
|
|
23
|
+
*
|
|
24
|
+
* All legs share the one `request.timeoutMs` budget (each leg gets what is left of it) and
|
|
25
|
+
* the caller's `AbortSignal`; a budget already spent stops the handshake and reports the
|
|
26
|
+
* last exchange as it stands, rather than firing a leg doomed to time out immediately.
|
|
27
|
+
* A 401 from the final leg (a wrong password, typically) is returned as a normal exchange,
|
|
28
|
+
* not thrown.
|
|
29
|
+
*
|
|
30
|
+
* @param request the fully-built request, including the real body for the final leg
|
|
31
|
+
* @param credentials the NTLM account to authenticate as
|
|
32
|
+
* @param options injected clock/nonce/dispatcher, for deterministic tests
|
|
33
|
+
*/
|
|
34
|
+
export async function ntlmHandshake(request, credentials, options) {
|
|
35
|
+
const now = options?.now ?? Date.now;
|
|
36
|
+
const startedAt = now();
|
|
37
|
+
const budgetMs = request.timeoutMs;
|
|
38
|
+
const remaining = () => budgetMs - (now() - startedAt);
|
|
39
|
+
let ownDispatcher;
|
|
40
|
+
let dispatcher = options?.dispatcher;
|
|
41
|
+
if (dispatcher === undefined) {
|
|
42
|
+
ownDispatcher = createSingleConnectionDispatcher({
|
|
43
|
+
...(request.tls !== undefined ? { tls: request.tls } : {}),
|
|
44
|
+
...(request.proxy !== undefined ? { proxy: request.proxy } : {}),
|
|
45
|
+
...(request.localAddress !== undefined ? { localAddress: request.localAddress } : {}),
|
|
46
|
+
});
|
|
47
|
+
dispatcher = ownDispatcher;
|
|
48
|
+
}
|
|
49
|
+
const sendOptions = { dispatcher, ...(options?.now !== undefined ? { now: options.now } : {}) };
|
|
50
|
+
let durationMs = 0;
|
|
51
|
+
const leg = async (headers, body) => {
|
|
52
|
+
const exchange = await sendHttp({ ...request, headers, body, timeoutMs: Math.max(1, remaining()) }, sendOptions);
|
|
53
|
+
durationMs += exchange.timings.totalMs;
|
|
54
|
+
return exchange;
|
|
55
|
+
};
|
|
56
|
+
try {
|
|
57
|
+
// Leg 1: the real request, real body. A server that needs no auth answers here and we
|
|
58
|
+
// are done — the envelope has already made it, so nothing is resent.
|
|
59
|
+
const first = await leg(request.headers, request.body ?? EMPTY_BODY);
|
|
60
|
+
if (first.status !== 401 || !offersNtlm(headerValue(first.headers, 'www-authenticate'))) {
|
|
61
|
+
return { http: first, attempts: 1, challenged: false, durationMs };
|
|
62
|
+
}
|
|
63
|
+
if (remaining() <= 0) {
|
|
64
|
+
return { http: first, attempts: 1, challenged: true, durationMs };
|
|
65
|
+
}
|
|
66
|
+
// Leg 2: the Type 1 negotiate message, bodyless. Strip any content-encoding/length
|
|
67
|
+
// that described leg 1's body — a gzip-declared zero-length body can trip up a strict
|
|
68
|
+
// server — the server answers with its Type 2 challenge.
|
|
69
|
+
const type1 = createType1({
|
|
70
|
+
...(credentials.domain !== undefined ? { domain: credentials.domain } : {}),
|
|
71
|
+
...(credentials.workstation !== undefined ? { workstation: credentials.workstation } : {}),
|
|
72
|
+
});
|
|
73
|
+
const type1Headers = withoutHeader(withoutHeader({ ...request.headers, Authorization: encodeNtlmAuthorization(type1) }, 'content-encoding'), 'content-length');
|
|
74
|
+
const second = await leg(type1Headers, EMPTY_BODY);
|
|
75
|
+
const challengeBytes = parseNtlmChallengeHeader(headerValue(second.headers, 'www-authenticate'));
|
|
76
|
+
if (challengeBytes === undefined || remaining() <= 0) {
|
|
77
|
+
return { http: second, attempts: 2, challenged: true, durationMs };
|
|
78
|
+
}
|
|
79
|
+
// Leg 3: the Type 3 authenticate message, this time carrying the real body.
|
|
80
|
+
const type2 = parseType2(challengeBytes);
|
|
81
|
+
const type3 = createType3({
|
|
82
|
+
username: credentials.username,
|
|
83
|
+
password: credentials.password,
|
|
84
|
+
...(credentials.domain !== undefined ? { domain: credentials.domain } : {}),
|
|
85
|
+
...(credentials.workstation !== undefined ? { workstation: credentials.workstation } : {}),
|
|
86
|
+
type2,
|
|
87
|
+
clientChallenge: options?.clientChallenge ?? new Uint8Array(randomBytes(8)),
|
|
88
|
+
timestamp: options?.timestamp ?? toFileTime(now()),
|
|
89
|
+
});
|
|
90
|
+
const third = await leg({ ...request.headers, Authorization: encodeNtlmAuthorization(type3.message) }, request.body ?? EMPTY_BODY);
|
|
91
|
+
return { http: third, attempts: 3, challenged: true, durationMs };
|
|
92
|
+
}
|
|
93
|
+
finally {
|
|
94
|
+
if (ownDispatcher !== undefined)
|
|
95
|
+
await ownDispatcher.close().catch(() => undefined);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NTLM (MS-NLMP) message codec: the Type 1 (NEGOTIATE), Type 2 (CHALLENGE) and
|
|
3
|
+
* Type 3 (AUTHENTICATE) messages plus the NTLMv2/LMv2 response computation, as a
|
|
4
|
+
* pure byte-level module. The connection choreography lives in `ntlm-transport.ts`.
|
|
5
|
+
*
|
|
6
|
+
* Only NTLMv2 with extended session security is produced; no session key exchange,
|
|
7
|
+
* signing or sealing, none of which HTTP needs. No MIC is emitted (it is optional
|
|
8
|
+
* for a client that negotiates no key exchange).
|
|
9
|
+
*/
|
|
10
|
+
/** NTLM negotiate flags (MS-NLMP §2.2.2.5) this codec cares about. */
|
|
11
|
+
export declare const NTLM_FLAGS: {
|
|
12
|
+
readonly NEGOTIATE_UNICODE: 1;
|
|
13
|
+
readonly NEGOTIATE_OEM: 2;
|
|
14
|
+
readonly REQUEST_TARGET: 4;
|
|
15
|
+
readonly NEGOTIATE_NTLM: 512;
|
|
16
|
+
readonly NEGOTIATE_OEM_DOMAIN_SUPPLIED: 4096;
|
|
17
|
+
readonly NEGOTIATE_OEM_WORKSTATION_SUPPLIED: 8192;
|
|
18
|
+
readonly NEGOTIATE_ALWAYS_SIGN: 32768;
|
|
19
|
+
readonly NEGOTIATE_EXTENDED_SESSIONSECURITY: 524288;
|
|
20
|
+
readonly NEGOTIATE_TARGET_INFO: 8388608;
|
|
21
|
+
readonly NEGOTIATE_VERSION: 33554432;
|
|
22
|
+
readonly NEGOTIATE_128: 536870912;
|
|
23
|
+
readonly NEGOTIATE_56: 2147483648;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* The flag set every Wirebench Type 1/Type 3 message carries: Unicode names, NTLM with
|
|
27
|
+
* extended session security (NTLMv2), target info, a version block, and 128/56-bit key
|
|
28
|
+
* strengths. Deliberately *without* `NEGOTIATE_SIGN`/`SEAL`/`KEY_EXCH` — HTTP carries no
|
|
29
|
+
* signed or sealed payloads, so advertising them would only invite a server to expect one.
|
|
30
|
+
*/
|
|
31
|
+
export declare const DEFAULT_NEGOTIATE_FLAGS: number;
|
|
32
|
+
/** AV pair identifiers (MS-NLMP §2.2.2.1). */
|
|
33
|
+
export declare const AV_IDS: {
|
|
34
|
+
readonly MsvAvEOL: 0;
|
|
35
|
+
readonly MsvAvNbComputerName: 1;
|
|
36
|
+
readonly MsvAvNbDomainName: 2;
|
|
37
|
+
readonly MsvAvDnsComputerName: 3;
|
|
38
|
+
readonly MsvAvDnsDomainName: 4;
|
|
39
|
+
readonly MsvAvTimestamp: 7;
|
|
40
|
+
readonly MsvAvFlags: 6;
|
|
41
|
+
};
|
|
42
|
+
/** Converts a Unix millisecond timestamp to a Windows FILETIME (100 ns ticks since 1601). */
|
|
43
|
+
export declare function toFileTime(unixMillis: number): bigint;
|
|
44
|
+
/** Options for {@link createType1}. */
|
|
45
|
+
export interface Type1Options {
|
|
46
|
+
/** Override the negotiate flags; defaults to {@link DEFAULT_NEGOTIATE_FLAGS}. */
|
|
47
|
+
readonly flags?: number;
|
|
48
|
+
/** Optional NetBIOS domain to advertise (OEM-encoded, as the Type 1 message requires). */
|
|
49
|
+
readonly domain?: string;
|
|
50
|
+
/** Optional NetBIOS workstation name to advertise (OEM-encoded). */
|
|
51
|
+
readonly workstation?: string;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Builds a Type 1 NEGOTIATE message.
|
|
55
|
+
*
|
|
56
|
+
* @param options negotiate flags plus the optional domain/workstation to advertise
|
|
57
|
+
* @returns the raw message bytes, ready for {@link encodeNtlmAuthorization}
|
|
58
|
+
*/
|
|
59
|
+
export declare function createType1(options?: Type1Options): Uint8Array;
|
|
60
|
+
/** A decoded Type 2 CHALLENGE message. */
|
|
61
|
+
export interface Type2Message {
|
|
62
|
+
readonly flags: number;
|
|
63
|
+
/** The 8-byte server challenge. */
|
|
64
|
+
readonly serverChallenge: Uint8Array;
|
|
65
|
+
/** The target name, decoded as UTF-16LE or OEM depending on the negotiated flags. */
|
|
66
|
+
readonly targetName: string;
|
|
67
|
+
/** The raw AV-pair block, copied verbatim into the NTLMv2 blob. */
|
|
68
|
+
readonly targetInfo: Uint8Array;
|
|
69
|
+
/** The 8-byte version block, when the server sent one. */
|
|
70
|
+
readonly version?: Uint8Array;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Parses a Type 2 CHALLENGE message.
|
|
74
|
+
*
|
|
75
|
+
* @param bytes the raw message (already base64-decoded)
|
|
76
|
+
* @throws WirebenchError (`ntlm-invalid-message`) when the signature or message type is not a Type 2 message
|
|
77
|
+
*/
|
|
78
|
+
export declare function parseType2(bytes: Uint8Array): Type2Message;
|
|
79
|
+
/**
|
|
80
|
+
* `NTOWFv2` (MS-NLMP §3.3.2): `HMAC_MD5(MD4(UTF16LE(password)), UTF16LE(UPPER(user) + domain))`.
|
|
81
|
+
* The domain keeps its case; only the user name is upper-cased.
|
|
82
|
+
*
|
|
83
|
+
* @param username the account name
|
|
84
|
+
* @param domain the domain (empty string when there is none)
|
|
85
|
+
* @param password the plaintext password — never logged, never stored by this module
|
|
86
|
+
*/
|
|
87
|
+
export declare function ntowfv2(username: string, domain: string, password: string): Uint8Array;
|
|
88
|
+
/**
|
|
89
|
+
* Builds the NTLMv2 `temp` blob: version bytes, the timestamp, the client challenge and the
|
|
90
|
+
* server's AV pairs. Exported so a verifier can rebuild the exact blob it received.
|
|
91
|
+
*/
|
|
92
|
+
export declare function ntlmv2Blob(params: {
|
|
93
|
+
readonly timestamp: bigint;
|
|
94
|
+
readonly clientChallenge: Uint8Array;
|
|
95
|
+
readonly targetInfo: Uint8Array;
|
|
96
|
+
}): Uint8Array;
|
|
97
|
+
/**
|
|
98
|
+
* `NTProofStr` (MS-NLMP §3.3.2): `HMAC_MD5(NTOWFv2, serverChallenge || temp)`.
|
|
99
|
+
*
|
|
100
|
+
* @param responseKeyNt the `NTOWFv2` for the account
|
|
101
|
+
* @param serverChallenge the 8-byte challenge from the Type 2 message
|
|
102
|
+
* @param blob the `temp` blob from {@link ntlmv2Blob}
|
|
103
|
+
*/
|
|
104
|
+
export declare function ntProofString(responseKeyNt: Uint8Array, serverChallenge: Uint8Array, blob: Uint8Array): Uint8Array;
|
|
105
|
+
/**
|
|
106
|
+
* The LMv2 response: `HMAC_MD5(NTOWFv2, serverChallenge || clientChallenge) || clientChallenge`.
|
|
107
|
+
*/
|
|
108
|
+
export declare function lmv2Response(responseKeyNt: Uint8Array, serverChallenge: Uint8Array, clientChallenge: Uint8Array): Uint8Array;
|
|
109
|
+
/** Reads an AV-pair block into a list of `{id, value}` entries, stopping at `MsvAvEOL`. */
|
|
110
|
+
export declare function parseAvPairs(bytes: Uint8Array): readonly {
|
|
111
|
+
readonly id: number;
|
|
112
|
+
readonly value: Uint8Array;
|
|
113
|
+
}[];
|
|
114
|
+
/** Builds an AV-pair block from `{id, value}` entries, terminated with `MsvAvEOL`. */
|
|
115
|
+
export declare function buildAvPairs(pairs: readonly {
|
|
116
|
+
readonly id: number;
|
|
117
|
+
readonly value: Uint8Array;
|
|
118
|
+
}[]): Uint8Array;
|
|
119
|
+
/** Inputs for {@link createType3}. */
|
|
120
|
+
export interface Type3Params {
|
|
121
|
+
readonly username: string;
|
|
122
|
+
readonly password: string;
|
|
123
|
+
readonly domain?: string;
|
|
124
|
+
readonly workstation?: string;
|
|
125
|
+
readonly type2: Type2Message;
|
|
126
|
+
/** The 8-byte client challenge; injected in tests, random in production. */
|
|
127
|
+
readonly clientChallenge: Uint8Array;
|
|
128
|
+
/** The timestamp as a Windows FILETIME; injected in tests, `toFileTime(Date.now())` otherwise. */
|
|
129
|
+
readonly timestamp: bigint;
|
|
130
|
+
}
|
|
131
|
+
/** The Type 3 message plus the intermediate values a test (or a verifier) wants to assert on. */
|
|
132
|
+
export interface Type3Result {
|
|
133
|
+
readonly message: Uint8Array;
|
|
134
|
+
readonly ntProofStr: Uint8Array;
|
|
135
|
+
readonly ntChallengeResponse: Uint8Array;
|
|
136
|
+
readonly lmChallengeResponse: Uint8Array;
|
|
137
|
+
readonly responseKeyNt: Uint8Array;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Builds a Type 3 AUTHENTICATE message answering `params.type2`, computing the NTLMv2 and
|
|
141
|
+
* LMv2 responses. The server's target info is carried through verbatim (with an
|
|
142
|
+
* `MsvAvTimestamp` added when the server sent none, and `MsvAvFlags` = 0 to state
|
|
143
|
+
* explicitly that no MIC follows).
|
|
144
|
+
*
|
|
145
|
+
* The password is used only to derive `NTOWFv2` and never appears in the message.
|
|
146
|
+
*
|
|
147
|
+
* When the server's Type 2 did not negotiate `NEGOTIATE_UNICODE`, the domain/user/workstation
|
|
148
|
+
* are OEM- (latin1-) encoded instead of UTF-16LE, and the Type 3's own flags clear the Unicode
|
|
149
|
+
* bit and set `NEGOTIATE_OEM`, matching what the server asked for.
|
|
150
|
+
*
|
|
151
|
+
* @param params the credentials, the parsed challenge and the injectable nonce/clock
|
|
152
|
+
*/
|
|
153
|
+
export declare function createType3(params: Type3Params): Type3Result;
|
|
154
|
+
/** A decoded Type 3 AUTHENTICATE message, as a server verifier sees it. */
|
|
155
|
+
export interface Type3Message {
|
|
156
|
+
readonly flags: number;
|
|
157
|
+
readonly domain: string;
|
|
158
|
+
readonly username: string;
|
|
159
|
+
readonly workstation: string;
|
|
160
|
+
readonly lmChallengeResponse: Uint8Array;
|
|
161
|
+
readonly ntChallengeResponse: Uint8Array;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Parses a Type 3 AUTHENTICATE message. Used by the test NTLM server to verify a client's
|
|
165
|
+
* response independently of {@link createType3}.
|
|
166
|
+
*
|
|
167
|
+
* @param bytes the raw message (already base64-decoded)
|
|
168
|
+
* @throws WirebenchError (`ntlm-invalid-message`) when the signature or message type is not a Type 3 message
|
|
169
|
+
*/
|
|
170
|
+
export declare function parseType3(bytes: Uint8Array): Type3Message;
|
|
171
|
+
/**
|
|
172
|
+
* Formats a message as an `Authorization`/`WWW-Authenticate` value: `NTLM <base64>`.
|
|
173
|
+
* Wirebench always answers with the `NTLM` scheme, even when the server advertised
|
|
174
|
+
* `Negotiate` — every server that offers raw NTLMSSP under `Negotiate` accepts it.
|
|
175
|
+
*/
|
|
176
|
+
export declare function encodeNtlmAuthorization(message: Uint8Array): string;
|
|
177
|
+
/**
|
|
178
|
+
* Extracts an NTLMSSP message from a `WWW-Authenticate` header value. Accepts both
|
|
179
|
+
* `NTLM <base64>` and `Negotiate <base64>` (only when the payload really is NTLMSSP,
|
|
180
|
+
* not a Kerberos/SPNEGO token), and tolerates several challenges in one header.
|
|
181
|
+
*
|
|
182
|
+
* @param header the raw header value, or `undefined` when the response had none
|
|
183
|
+
* @returns the decoded message bytes, or `undefined` when there is no usable NTLM challenge
|
|
184
|
+
*/
|
|
185
|
+
export declare function parseNtlmChallengeHeader(header: string | undefined): Uint8Array | undefined;
|
|
186
|
+
/**
|
|
187
|
+
* True when `header` offers an NTLM (or NTLMSSP-over-Negotiate) challenge at all, including
|
|
188
|
+
* the bare `WWW-Authenticate: NTLM` that starts a handshake.
|
|
189
|
+
*/
|
|
190
|
+
export declare function offersNtlm(header: string | undefined): boolean;
|