From 3825b1545c3c0569084e2d349758b288c260677b Mon Sep 17 00:00:00 2001 From: wolfy1339 <4595477+wolfy1339@users.noreply.github.com> Date: Mon, 24 Aug 2020 14:29:58 -0400 Subject: [PATCH] Revert 2b7c0bb and instead add a ts-ignore statement Adds back the existing error message that was removed --- src/sign/index.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/sign/index.ts b/src/sign/index.ts index 176cfe9e..d6484065 100644 --- a/src/sign/index.ts +++ b/src/sign/index.ts @@ -1,6 +1,11 @@ import { createHmac } from "crypto"; export function sign(secret: string, payload: string | object): string { + // @ts-ignore throw friendly error message when required options are missing + if (!secret || !payload) { + throw new TypeError("secret & payload required"); + } + payload = typeof payload === "string" ? payload : toNormalizedJsonString(payload); return "sha1=" + createHmac("sha1", secret).update(payload).digest("hex");