Skip to content

Commit 56620c6

Browse files
authored
Merge pull request #371 from felixarjuna/fix-verify-signature-double-negation
Fix verify signature double negation
2 parents 441e43d + d3bea58 commit 56620c6

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -976,7 +976,7 @@ export class WhatsAppAPI<EmittersReturnType = void> {
976976
.map((b) => b.toString(16).padStart(2, "0"))
977977
.join("");
978978

979-
return signature !== check;
979+
return signature === check;
980980
}
981981

982982
/**

test/index.test.cjs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1629,7 +1629,11 @@ describe("WhatsAppAPI", function () {
16291629

16301630
it("should throw 401 if the signature doesn't match the hash", async function () {
16311631
await rejects(
1632-
Whatsapp.post(valid_message_mock, body, "wrong"),
1632+
Whatsapp.post(
1633+
valid_message_mock,
1634+
body,
1635+
"sha256=wrong"
1636+
),
16331637
threw(401)
16341638
);
16351639
});

0 commit comments

Comments
 (0)