bothy-sdk
    Preparing search index...

    Class WebhookKeyCache

    Holds the v1a public keys of getWebhookKeys as a trust list.

    The list is fetched on first use and again only after the max-age of its response's Cache-Control (without one: agent.jwks_max_age; never sooner than adapter.jwks_refresh_min_interval). A new key appears in it beforehand as next, so a failed verification is never a reason to fetch: a forged request cannot make the app call the server.

    const cache = new WebhookKeyCache({ client: createApiClient({ baseUrl }) });
    const verified = verifyWebhook({ body, headers, keys: await cache.keys() });
    Index

    Constructors

    Methods

    Constructors

    Methods

    • Returns the trusted keys, fetching them when the list is missing or older than its age. Concurrent calls share one fetch.

      Returns Promise<KeyObject[]>

      Every usable listed key in the states next, active and retiring.

      Error naming getWebhookKeys and the status when the fetch fails; the next call tries again.