@willbooster/shared-lib-blitz-next 3.0.7 → 3.1.0
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/README.md +1 -1
- package/dist/middleware.cjs +1 -1
- package/dist/middleware.cjs.map +1 -1
- package/dist/middleware.js +1 -1
- package/dist/middleware.js.map +1 -1
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @willbooster/shared-lib-blitz-next
|
package/dist/middleware.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";exports.BasicAuthMiddleware=function(
|
|
1
|
+
"use strict";var e=require("node:crypto");exports.BasicAuthMiddleware=function(r){return async(a,t,n)=>{var i;const s=null!=(i=a.headers.authorization)?i:"",[u,o]=s.split(" "),l=Buffer.from(`${r.username}:${r.password}`),d=Buffer.from(null!=o?o:"","base64");if("basic"!==(null==u?void 0:u.toLowerCase())||0===d.length||l.length!==d.length||!e.timingSafeEqual(d,l))return t.setHeader("WWW-Authenticate",`Basic realm='${r.realm||"Secure Area"}'`),t.statusCode=401,void t.end("Unauthorized");await n()}};
|
|
2
2
|
//# sourceMappingURL=middleware.cjs.map
|
package/dist/middleware.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"middleware.cjs","sources":["../src/middleware.ts"],"sourcesContent":["import type { RequestMiddleware } from 'blitz';\n\ntype BasicAuthMiddlewareOptions = {\n password: string;\n realm?: string;\n username: string;\n};\n\nexport function BasicAuthMiddleware(options: BasicAuthMiddlewareOptions): RequestMiddleware {\n return async (request, response, next) => {\n const authorizationHeader = request.headers.authorization ?? '';\n const [type, encodedCredentials] = authorizationHeader.split(' ');\n const
|
|
1
|
+
{"version":3,"file":"middleware.cjs","sources":["../src/middleware.ts"],"sourcesContent":["import crypto from 'node:crypto';\n\nimport type { RequestMiddleware } from 'blitz';\n\ntype BasicAuthMiddlewareOptions = {\n password: string;\n realm?: string;\n username: string;\n};\n\nexport function BasicAuthMiddleware(options: BasicAuthMiddlewareOptions): RequestMiddleware {\n return async (request, response, next) => {\n const authorizationHeader = request.headers.authorization ?? '';\n const [type, encodedCredentials] = authorizationHeader.split(' ');\n const expected = Buffer.from(`${options.username}:${options.password}`);\n const provided = Buffer.from(encodedCredentials ?? '', 'base64');\n\n if (\n type?.toLowerCase() !== 'basic' ||\n provided.length === 0 ||\n expected.length !== provided.length ||\n !crypto.timingSafeEqual(provided, expected)\n ) {\n response.setHeader('WWW-Authenticate', `Basic realm='${options.realm || 'Secure Area'}'`);\n response.statusCode = 401;\n response.end('Unauthorized');\n return;\n }\n\n await next();\n };\n}\n"],"names":["options","async","request","response","next","_request$headers$auth","authorizationHeader","headers","authorization","type","encodedCredentials","split","expected","Buffer","from","username","password","provided","toLowerCase","length","crypto","timingSafeEqual","setHeader","realm","statusCode","end"],"mappings":"sEAUO,SAA6BA,GAClC,OAAOC,MAAOC,EAASC,EAAUC,KAAS,IAAAC,EACxC,MAAMC,EAAmD,OAAhCD,EAAGH,EAAQK,QAAQC,eAAaH,EAAI,IACtDI,EAAMC,GAAsBJ,EAAoBK,MAAM,KACvDC,EAAWC,OAAOC,KAAK,GAAGd,EAAQe,YAAYf,EAAQgB,YACtDC,EAAWJ,OAAOC,KAAuB,MAAlBJ,EAAAA,EAAsB,GAAI,UAEvD,GAC0B,WAApB,MAAJD,OAAI,EAAJA,EAAMS,gBACc,IAApBD,EAASE,QACTP,EAASO,SAAWF,EAASE,SAC5BC,EAAOC,gBAAgBJ,EAAUL,GAKlC,OAHAT,EAASmB,UAAU,mBAAoB,gBAAgBtB,EAAQuB,OAAS,kBACxEpB,EAASqB,WAAa,SACtBrB,EAASsB,IAAI,sBAITrB,IAEV"}
|
package/dist/middleware.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
function
|
|
1
|
+
import e from"node:crypto";function r(r){return async(t,a,n)=>{var o;const i=null!=(o=t.headers.authorization)?o:"",[u,s]=i.split(" "),l=Buffer.from(`${r.username}:${r.password}`),f=Buffer.from(null!=s?s:"","base64");if("basic"!==(null==u?void 0:u.toLowerCase())||0===f.length||l.length!==f.length||!e.timingSafeEqual(f,l))return a.setHeader("WWW-Authenticate",`Basic realm='${r.realm||"Secure Area"}'`),a.statusCode=401,void a.end("Unauthorized");await n()}}export{r as BasicAuthMiddleware};
|
|
2
2
|
//# sourceMappingURL=middleware.js.map
|
package/dist/middleware.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"middleware.js","sources":["../src/middleware.ts"],"sourcesContent":["import type { RequestMiddleware } from 'blitz';\n\ntype BasicAuthMiddlewareOptions = {\n password: string;\n realm?: string;\n username: string;\n};\n\nexport function BasicAuthMiddleware(options: BasicAuthMiddlewareOptions): RequestMiddleware {\n return async (request, response, next) => {\n const authorizationHeader = request.headers.authorization ?? '';\n const [type, encodedCredentials] = authorizationHeader.split(' ');\n const
|
|
1
|
+
{"version":3,"file":"middleware.js","sources":["../src/middleware.ts"],"sourcesContent":["import crypto from 'node:crypto';\n\nimport type { RequestMiddleware } from 'blitz';\n\ntype BasicAuthMiddlewareOptions = {\n password: string;\n realm?: string;\n username: string;\n};\n\nexport function BasicAuthMiddleware(options: BasicAuthMiddlewareOptions): RequestMiddleware {\n return async (request, response, next) => {\n const authorizationHeader = request.headers.authorization ?? '';\n const [type, encodedCredentials] = authorizationHeader.split(' ');\n const expected = Buffer.from(`${options.username}:${options.password}`);\n const provided = Buffer.from(encodedCredentials ?? '', 'base64');\n\n if (\n type?.toLowerCase() !== 'basic' ||\n provided.length === 0 ||\n expected.length !== provided.length ||\n !crypto.timingSafeEqual(provided, expected)\n ) {\n response.setHeader('WWW-Authenticate', `Basic realm='${options.realm || 'Secure Area'}'`);\n response.statusCode = 401;\n response.end('Unauthorized');\n return;\n }\n\n await next();\n };\n}\n"],"names":["BasicAuthMiddleware","options","async","request","response","next","_request$headers$auth","authorizationHeader","headers","authorization","type","encodedCredentials","split","expected","Buffer","from","username","password","provided","toLowerCase","length","crypto","timingSafeEqual","setHeader","realm","statusCode","end"],"mappings":"2BAUO,SAASA,EAAoBC,GAClC,OAAOC,MAAOC,EAASC,EAAUC,KAAS,IAAAC,EACxC,MAAMC,EAAmD,OAAhCD,EAAGH,EAAQK,QAAQC,eAAaH,EAAI,IACtDI,EAAMC,GAAsBJ,EAAoBK,MAAM,KACvDC,EAAWC,OAAOC,KAAK,GAAGd,EAAQe,YAAYf,EAAQgB,YACtDC,EAAWJ,OAAOC,KAAuB,MAAlBJ,EAAAA,EAAsB,GAAI,UAEvD,GAC0B,WAApB,MAAJD,OAAI,EAAJA,EAAMS,gBACc,IAApBD,EAASE,QACTP,EAASO,SAAWF,EAASE,SAC5BC,EAAOC,gBAAgBJ,EAAUL,GAKlC,OAHAT,EAASmB,UAAU,mBAAoB,gBAAgBtB,EAAQuB,OAAS,kBACxEpB,EAASqB,WAAa,SACtBrB,EAASsB,IAAI,sBAITrB,IAEV"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@willbooster/shared-lib-blitz-next",
|
|
3
|
-
"version": "3.0
|
|
3
|
+
"version": "3.1.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"author": "WillBooster Inc.",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -40,18 +40,18 @@
|
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@types/eslint": "9.6.1",
|
|
42
42
|
"@types/micromatch": "4.0.9",
|
|
43
|
-
"@willbooster/eslint-config-ts": "11.4.
|
|
43
|
+
"@willbooster/eslint-config-ts": "11.4.7",
|
|
44
44
|
"@willbooster/prettier-config": "10.2.0",
|
|
45
|
-
"blitz": "
|
|
46
|
-
"build-ts": "16.0.
|
|
47
|
-
"eslint": "9.
|
|
45
|
+
"blitz": "3.0.2",
|
|
46
|
+
"build-ts": "16.0.8",
|
|
47
|
+
"eslint": "9.37.0",
|
|
48
48
|
"eslint-config-flat-gitignore": "2.1.0",
|
|
49
49
|
"eslint-config-prettier": "10.1.8",
|
|
50
50
|
"eslint-import-resolver-typescript": "4.4.4",
|
|
51
51
|
"eslint-plugin-import-x": "4.16.1",
|
|
52
52
|
"eslint-plugin-sort-class-members": "1.21.0",
|
|
53
53
|
"eslint-plugin-sort-destructure-keys": "2.0.0",
|
|
54
|
-
"eslint-plugin-unicorn": "
|
|
54
|
+
"eslint-plugin-unicorn": "61.0.2",
|
|
55
55
|
"eslint-plugin-unused-imports": "4.2.0",
|
|
56
56
|
"globals": "16.4.0",
|
|
57
57
|
"lint-staged": "16.2.3",
|