Skip to content

Enabling HMAC security logic by setting AbstractEventSubscription.SecretKey has no effect #167

@jansokoly

Description

@jansokoly

While trying to enable HMAC security logic for webhook requests, I've stumbled on why something like this has no effect:

await signNowContext.Events.CreateEventSubscriptionAsync(new CreateEventSubscription(EventType.DocumentFieldInviteSent, entityId, callbackUrl) { SecretKey = "SomeHmacSecretKey" });

Turns out there are actually 2 places where SecretKey can be set when subscribing to an event:

So, to enable HMAC when subscribing to an event, it's possible to achieve it like this:

await signNowContext.Events.CreateEventSubscriptionAsync(new CreateEventSubscription(EventType.DocumentFieldInviteSent, entityId, callbackUrl) { Attributes = new EventCreateAttributes { CallbackUrl = callbackUrl, SecretKey = "SomeHmacSecretKey" } });

I'm not sure what the idea is with having 2 of these keys, but the one among Attributes seems to be more consistent with API.
Is there any purpose for AbstractEventSubscription.SecretKey actually?
Also, I think it would be handy to be able to pass SecretKey as an optional param in CreateEventSubscription constructor.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions