Skip to content
This repository was archived by the owner on Feb 5, 2025. It is now read-only.
This repository was archived by the owner on Feb 5, 2025. It is now read-only.

Improve parameter detection and errors #8

Description

@leggetter

For example, passing an empty string for the Hookdeck Signing Secret results in the following upon the call to verifyWebhookSignature:

DOMException [DataError]: Zero-length key is not supported
    at Object.hmacImportKey (node:internal/crypto/mac:103:15)
    at SubtleCrypto.importKey (node:internal/crypto/webcrypto:635:10)
    at eval (webpack-internal:///(rsc)/./node_modules/@hookdeck/sdk/webhooks/helpers.js:42:32)
    at Generator.next (<anonymous>)
    at eval (webpack-internal:///(rsc)/./node_modules/@hookdeck/sdk/webhooks/helpers.js:31:71)
    at new Promise (<anonymous>)
    at __awaiter (webpack-internal:///(rsc)/./node_modules/@hookdeck/sdk/webhooks/helpers.js:13:12)
    at createSHA256Signature (webpack-internal:///(rsc)/./node_modules/@hookdeck/sdk/webhooks/helpers.js:40:58)
    at eval (webpack-internal:///(rsc)/./node_modules/@hookdeck/sdk/webhooks/helpers.js:120:38)
    at Generator.next (<anonymous>)
    at eval (webpack-internal:///(rsc)/./node_modules/@hookdeck/sdk/webhooks/helpers.js:31:71)
    at new Promise (<anonymous>)
    at __awaiter (webpack-internal:///(rsc)/./node_modules/@hookdeck/sdk/webhooks/helpers.js:13:12)
    at verifyWebhookSignature (webpack-internal:///(rsc)/./node_modules/@hookdeck/sdk/webhooks/helpers.js:100:88)
    at POST (webpack-internal:///(rsc)/./app/webhooks/vote/route.ts:16:124)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async /Users/leggetter/hookdeck/git/next-supabase-vote/node_modules/next/dist/compiled/next-server/app-route.runtime.dev.js:6:62609

The empty string value should be caught before the signature generation is attempted.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions