n8n-nodes-base
Version:
Base nodes of n8n
60 lines • 2.07 kB
TypeScript
import type { IHookFunctions, IWebhookFunctions } from 'n8n-workflow';
/**
* Currents webhook object returned from the API.
*/
export interface CurrentsWebhook {
hookId: string;
projectId: string;
url: string;
headers?: string | null;
hookEvents: string[];
label?: string | null;
createdAt?: string;
updatedAt?: string;
}
/**
* Options for creating a Currents webhook.
*/
export interface CreateWebhookOptions {
url: string;
hookEvents?: string[];
headers?: string;
label?: string;
}
/**
* Generates a cryptographically secure random secret for webhook validation.
*/
export declare function generateWebhookSecret(): string;
/**
* Lists all webhooks for a project.
*/
export declare function listWebhooks(this: IHookFunctions, projectId: string): Promise<CurrentsWebhook[]>;
/**
* Finds an existing webhook by URL for a project.
*/
export declare function findWebhookByUrl(this: IHookFunctions, projectId: string, webhookUrl: string): Promise<CurrentsWebhook | undefined>;
/**
* Creates a new webhook in Currents.
*/
export declare function createWebhook(this: IHookFunctions, projectId: string, options: CreateWebhookOptions): Promise<CurrentsWebhook>;
/**
* Updates an existing webhook in Currents.
*/
export declare function updateWebhook(this: IHookFunctions, hookId: string, options: Partial<CreateWebhookOptions>): Promise<CurrentsWebhook>;
/**
* Deletes a webhook from Currents.
*/
export declare function deleteWebhook(this: IHookFunctions, hookId: string): Promise<void>;
/**
* Verifies the webhook request is recent and validates the secret.
*
* Uses auto-managed secret from workflow static data.
*
* Currents.dev includes an `x-timestamp` header with the epoch timestamp in milliseconds.
* This function validates that the timestamp is within an acceptable window to prevent
* replay attacks.
*
* @returns true if the request is valid, false otherwise
*/
export declare function verifyWebhook(this: IWebhookFunctions): boolean;
//# sourceMappingURL=CurrentsTriggerHelpers.d.ts.map