Anchorage API reference
    Preparing search index...

    The DO-host + webhook contract a flowsafe-hosted provider exposes. The host DO drives pollForDeliveries; the webhook route drives verifyWebhookSignature (over the RAW bytes, before any parse), extractResourceIds, and buildNotification. A provider implements only the seams its transport needs — a webhook-only provider omits pollForDeliveries, a poll-only one omits the webhook trio.

    interface SignalProviderAdapter {
        id: string;
        pollInterval?: number;
        buildNotification(
            payload: unknown,
            subscription: SignalSubscription,
        ): SendNotificationSignalInput;
        extractResourceIds?(payload: unknown): string[];
        pollForDeliveries?(
            subscriptions: SignalSubscription[],
        ): Promise<ProviderDelivery[]>;
        verifyWebhookSignature?(
            rawBody: Uint8Array,
            headers: WebhookHeaders,
            secret: string,
        ): boolean | Promise<boolean>;
    }
    Index

    Properties

    id: string
    pollInterval?: number

    Poll cadence in ms for the host DO's alarm. Absent/0 disables automatic alarms; a supplied pollForDeliveries remains callable through /poll.

    Methods

    • Shape the notification a matched subscription receives (webhook AND poll).

      Parameters

      • payload: unknown
      • subscription: SignalSubscription

      Returns SendNotificationSignalInput

    • The external-resource key(s) a parsed webhook payload concerns, matched against subscriptions' externalResourceId. Returns an empty array when the payload names no resource this provider tracks.

      Parameters

      • payload: unknown

      Returns string[]

    • Check external state for a batch of REHYDRATED subscriptions (the host DO passes the D1 rows, not core's in-memory registry) and return the deliveries. The host routes each through the topology. Absent ⇒ webhook-only.

      Parameters

      • subscriptions: SignalSubscription[]

      Returns Promise<ProviderDelivery[]>

    • Verify a webhook's provider signature over the RAW request bytes, BEFORE the body is parsed — a forged signature must be refused without ever inspecting the payload. MUST be constant-time. Absent ⇒ the provider accepts no webhooks (every webhook fails closed), so a webhook provider MUST supply it.

      Parameters

      Returns boolean | Promise<boolean>