Skip to content

Commit

Permalink
style: set print width to 120
Browse files Browse the repository at this point in the history
  • Loading branch information
screendriver committed Nov 10, 2021
1 parent 79ab30d commit a9e08e0
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 32 deletions.
3 changes: 2 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"singleQuote": true,
"trailingComma": "all"
"trailingComma": "all",
"printWidth": 120
}
18 changes: 6 additions & 12 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,44 +1,38 @@
## [2.0.6](https://github.com/screendriver/verify-github-webhook-secret/compare/v2.0.5...v2.0.6) (2021-08-12)


### Bug Fixes

* **deps:** update dependency tslib to v2.3.1 ([fa0d482](https://github.com/screendriver/verify-github-webhook-secret/commit/fa0d4820ab4408046f02937540d586fb5dad303a))
- **deps:** update dependency tslib to v2.3.1 ([fa0d482](https://github.com/screendriver/verify-github-webhook-secret/commit/fa0d4820ab4408046f02937540d586fb5dad303a))

## [2.0.5](https://github.com/screendriver/verify-github-webhook-secret/compare/v2.0.4...v2.0.5) (2021-06-12)


### Bug Fixes

* **deps:** update dependency tslib to v2.3.0 ([662ea26](https://github.com/screendriver/verify-github-webhook-secret/commit/662ea26c57ccaef3c076c95e6d259ff4d1c2e5d1))
- **deps:** update dependency tslib to v2.3.0 ([662ea26](https://github.com/screendriver/verify-github-webhook-secret/commit/662ea26c57ccaef3c076c95e6d259ff4d1c2e5d1))

## [2.0.4](https://github.com/screendriver/verify-github-webhook-secret/compare/v2.0.3...v2.0.4) (2021-05-07)


### Bug Fixes

* **deps:** update dependency tslib to v2.2.0 ([749f453](https://github.com/screendriver/verify-github-webhook-secret/commit/749f453df0b16b63096cf67156ab346ddc6f1fde))
- **deps:** update dependency tslib to v2.2.0 ([749f453](https://github.com/screendriver/verify-github-webhook-secret/commit/749f453df0b16b63096cf67156ab346ddc6f1fde))

## [2.0.3](https://github.com/screendriver/verify-github-webhook-secret/compare/v2.0.2...v2.0.3) (2021-01-06)


### Bug Fixes

* **deps:** update dependency tslib to v2.1.0 ([b100ef4](https://github.com/screendriver/verify-github-webhook-secret/commit/b100ef4092526968dcf7ddcbfce0cae9a1b99a56))
- **deps:** update dependency tslib to v2.1.0 ([b100ef4](https://github.com/screendriver/verify-github-webhook-secret/commit/b100ef4092526968dcf7ddcbfce0cae9a1b99a56))

## [2.0.2](https://github.com/screendriver/verify-github-webhook-secret/compare/v2.0.1...v2.0.2) (2020-10-11)


### Bug Fixes

* **deps:** update dependency tslib to v2.0.3 ([6e5a6a0](https://github.com/screendriver/verify-github-webhook-secret/commit/6e5a6a0b6bff843db1b1c18a6636436787d67b33))
- **deps:** update dependency tslib to v2.0.3 ([6e5a6a0](https://github.com/screendriver/verify-github-webhook-secret/commit/6e5a6a0b6bff843db1b1c18a6636436787d67b33))

## [2.0.1](https://github.com/screendriver/verify-github-webhook-secret/compare/v2.0.0...v2.0.1) (2020-10-07)


### Bug Fixes

* change order in lint script ([10b2679](https://github.com/screendriver/verify-github-webhook-secret/commit/10b2679dc9c366eec5836946bc1df5c9a0e497bf))
- change order in lint script ([10b2679](https://github.com/screendriver/verify-github-webhook-secret/commit/10b2679dc9c366eec5836946bc1df5c9a0e497bf))

# 2.0.0

Expand Down
6 changes: 1 addition & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,7 @@ Another way to call the function is directly with the HTTP body and the `x-hub-s
import { verifySecret } from 'verify-github-webhook-secret';

async function myFunc() {
const valid = await verifySecret(
'{"foo":"bar"}',
'my-secret',
'sha1=30a233839fe2ddd9233c49fd593e8f1aec68f553',
);
const valid = await verifySecret('{"foo":"bar"}', 'my-secret', 'sha1=30a233839fe2ddd9233c49fd593e8f1aec68f553');
return valid ? 'Allowed' : 'Not allowed';
}
```
11 changes: 2 additions & 9 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,8 @@ import { IncomingMessage } from 'http';
import { text } from 'micro';
import { verify } from './verify';

export async function verifySecret(
req: IncomingMessage,
secret: string,
): Promise<boolean>;
export async function verifySecret(
body: string,
secret: string,
xHubSignature?: string | string[],
): Promise<boolean>;
export async function verifySecret(req: IncomingMessage, secret: string): Promise<boolean>;
export async function verifySecret(body: string, secret: string, xHubSignature?: string | string[]): Promise<boolean>;
export async function verifySecret(
reqOrBody: IncomingMessage | string,
secret: string,
Expand Down
6 changes: 1 addition & 5 deletions src/verify.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
import { createHmac } from 'crypto';

export function verify(
body: string,
secret: string,
signature?: string | string[],
): boolean {
export function verify(body: string, secret: string, signature?: string | string[]): boolean {
if (!signature) {
return false;
}
Expand Down

0 comments on commit a9e08e0

Please sign in to comment.