From 9050952102866464d0c09e9a071ebec27b479fd3 Mon Sep 17 00:00:00 2001 From: Daniel Hensby Date: Fri, 16 Sep 2022 23:35:07 +0100 Subject: [PATCH 1/3] Optimise lock file --- package-lock.json | 104 ---------------------------------------------- 1 file changed, 104 deletions(-) diff --git a/package-lock.json b/package-lock.json index c6b3a5e..2f79cef 100644 --- a/package-lock.json +++ b/package-lock.json @@ -170,34 +170,6 @@ "regexpp": "^3.2.0", "semver": "^7.3.7", "tsutils": "^3.21.0" - }, - "dependencies": { - "@typescript-eslint/scope-manager": { - "version": "5.37.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.37.0.tgz", - "integrity": "sha512-F67MqrmSXGd/eZnujjtkPgBQzgespu/iCZ+54Ok9X5tALb9L2v3G+QBSoWkXG0p3lcTJsL+iXz5eLUEdSiJU9Q==", - "dev": true, - "requires": { - "@typescript-eslint/types": "5.37.0", - "@typescript-eslint/visitor-keys": "5.37.0" - } - }, - "@typescript-eslint/types": { - "version": "5.37.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.37.0.tgz", - "integrity": "sha512-3frIJiTa5+tCb2iqR/bf7XwU20lnU05r/sgPJnRpwvfZaqCJBrl8Q/mw9vr3NrNdB/XtVyMA0eppRMMBqdJ1bA==", - "dev": true - }, - "@typescript-eslint/visitor-keys": { - "version": "5.37.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.37.0.tgz", - "integrity": "sha512-Hp7rT4cENBPIzMwrlehLW/28EVCOcE9U1Z1BQTc8EA8v5qpr7GRGuG+U58V5tTY48zvUOA3KHvw3rA8tY9fbdA==", - "dev": true, - "requires": { - "@typescript-eslint/types": "5.37.0", - "eslint-visitor-keys": "^3.3.0" - } - } } }, "@typescript-eslint/parser": { @@ -232,39 +204,6 @@ "@typescript-eslint/utils": "5.37.0", "debug": "^4.3.4", "tsutils": "^3.21.0" - }, - "dependencies": { - "@typescript-eslint/types": { - "version": "5.37.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.37.0.tgz", - "integrity": "sha512-3frIJiTa5+tCb2iqR/bf7XwU20lnU05r/sgPJnRpwvfZaqCJBrl8Q/mw9vr3NrNdB/XtVyMA0eppRMMBqdJ1bA==", - "dev": true - }, - "@typescript-eslint/typescript-estree": { - "version": "5.37.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.37.0.tgz", - "integrity": "sha512-JkFoFIt/cx59iqEDSgIGnQpCTRv96MQnXCYvJi7QhBC24uyuzbD8wVbajMB1b9x4I0octYFJ3OwjAwNqk1AjDA==", - "dev": true, - "requires": { - "@typescript-eslint/types": "5.37.0", - "@typescript-eslint/visitor-keys": "5.37.0", - "debug": "^4.3.4", - "globby": "^11.1.0", - "is-glob": "^4.0.3", - "semver": "^7.3.7", - "tsutils": "^3.21.0" - } - }, - "@typescript-eslint/visitor-keys": { - "version": "5.37.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.37.0.tgz", - "integrity": "sha512-Hp7rT4cENBPIzMwrlehLW/28EVCOcE9U1Z1BQTc8EA8v5qpr7GRGuG+U58V5tTY48zvUOA3KHvw3rA8tY9fbdA==", - "dev": true, - "requires": { - "@typescript-eslint/types": "5.37.0", - "eslint-visitor-keys": "^3.3.0" - } - } } }, "@typescript-eslint/types": { @@ -300,49 +239,6 @@ "@typescript-eslint/typescript-estree": "5.37.0", "eslint-scope": "^5.1.1", "eslint-utils": "^3.0.0" - }, - "dependencies": { - "@typescript-eslint/scope-manager": { - "version": "5.37.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.37.0.tgz", - "integrity": "sha512-F67MqrmSXGd/eZnujjtkPgBQzgespu/iCZ+54Ok9X5tALb9L2v3G+QBSoWkXG0p3lcTJsL+iXz5eLUEdSiJU9Q==", - "dev": true, - "requires": { - "@typescript-eslint/types": "5.37.0", - "@typescript-eslint/visitor-keys": "5.37.0" - } - }, - "@typescript-eslint/types": { - "version": "5.37.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.37.0.tgz", - "integrity": "sha512-3frIJiTa5+tCb2iqR/bf7XwU20lnU05r/sgPJnRpwvfZaqCJBrl8Q/mw9vr3NrNdB/XtVyMA0eppRMMBqdJ1bA==", - "dev": true - }, - "@typescript-eslint/typescript-estree": { - "version": "5.37.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.37.0.tgz", - "integrity": "sha512-JkFoFIt/cx59iqEDSgIGnQpCTRv96MQnXCYvJi7QhBC24uyuzbD8wVbajMB1b9x4I0octYFJ3OwjAwNqk1AjDA==", - "dev": true, - "requires": { - "@typescript-eslint/types": "5.37.0", - "@typescript-eslint/visitor-keys": "5.37.0", - "debug": "^4.3.4", - "globby": "^11.1.0", - "is-glob": "^4.0.3", - "semver": "^7.3.7", - "tsutils": "^3.21.0" - } - }, - "@typescript-eslint/visitor-keys": { - "version": "5.37.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.37.0.tgz", - "integrity": "sha512-Hp7rT4cENBPIzMwrlehLW/28EVCOcE9U1Z1BQTc8EA8v5qpr7GRGuG+U58V5tTY48zvUOA3KHvw3rA8tY9fbdA==", - "dev": true, - "requires": { - "@typescript-eslint/types": "5.37.0", - "eslint-visitor-keys": "^3.3.0" - } - } } }, "@typescript-eslint/visitor-keys": { From fecb7b11e2a99e5b314ce4511f199c9886f5e86a Mon Sep 17 00:00:00 2001 From: Daniel Hensby Date: Fri, 16 Sep 2022 23:35:21 +0100 Subject: [PATCH 2/3] Add lint:fix command --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index 965aa0f..c3d3d1e 100644 --- a/package.json +++ b/package.json @@ -7,6 +7,7 @@ "scripts": { "build": "tsc", "lint": "eslint -c .eslintrc ./src/**/*.ts ./test/**/*.ts", + "lint:fix": "npm run lint --silent -- --fix", "prepare": "npm run build", "preversion": "npm run lint", "test": "mocha -r ts-node/register test/**/*.ts" From d23025305a970df239703b668c18477daf5e666d Mon Sep 17 00:00:00 2001 From: Daniel Hensby Date: Fri, 16 Sep 2022 23:35:55 +0100 Subject: [PATCH 3/3] Remove body from HttpLike type There is no need for the body prop as signatures are not concerned with the body of the request. All data required for signing/verifying http-signatures are based in the request line and headers. --- src/types/index.ts | 1 - test/httpbis/httpbis.ts | 1 - 2 files changed, 2 deletions(-) diff --git a/src/types/index.ts b/src/types/index.ts index ccd1893..ce36d2c 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -4,7 +4,6 @@ type HttpLike = { method: string, url: string, headers: Record, - body?: string | Buffer, } export type RequestLike = HttpLike; diff --git a/test/httpbis/httpbis.ts b/test/httpbis/httpbis.ts index 3f7ff42..3dd5fc4 100644 --- a/test/httpbis/httpbis.ts +++ b/test/httpbis/httpbis.ts @@ -149,7 +149,6 @@ describe('httpbis', () => { 'Digest': 'SHA-256=X48E9qOokqqrvdts8nOJRJN3OWDUoyWxBf7kbu9DBPE=', 'Content-Length': '18', }, - body: '{"hello": "world"}', }; it('constructs minimal example', () => { const components: Component[] = [];