Comparing version 0.8.2 to 0.9.1
{ | ||
"name": "diahook", | ||
"version": "0.8.2", | ||
"version": "0.9.1", | ||
"description": "Diahook API client", | ||
@@ -5,0 +5,0 @@ "author": "diahook", |
@@ -266,4 +266,9 @@ import { | ||
export class Webhook { | ||
public static verify( | ||
secret: string, | ||
private readonly key: Uint8Array; | ||
constructor(secret: string) { | ||
this.key = base64.decode(secret); | ||
} | ||
public verify( | ||
payload: string, | ||
@@ -279,4 +284,3 @@ headers: WebhookRequiredHeaders | Record<string, string> | ||
); | ||
const key = base64.decode(secret); | ||
const signature = base64.encode(sha256.hmac(key, toSign)); | ||
const signature = base64.encode(sha256.hmac(this.key, toSign)); | ||
if (signature !== headers["dh-signature"]) { | ||
@@ -283,0 +287,0 @@ throw new WebhookVerificationError("Signature mismatch"); |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
12720
373