Skip to content

@saflib/ory-kratos-http


index

Interfaces

InterfaceDescription
CreateOryKratosAppOptions-
KratosActionA single Kratos webhook delivery, packaged for the application.
KratosActionContextKratos webhook context as templated by function(ctx) ctx. Fields are documented in https://www.ory.sh/docs/kratos/hooks/configure-hooks under "Available web hook context". All fields are optional from saflib's perspective: presence depends on which flow stage fired the hook (e.g. identity is present on after.<method> hooks, absent on before).
KratosActionHandlerApplication-level handler. Called once per accepted webhook delivery.
KratosCourierCallbacksHooks for each supported valid template type. Unsupported / invalid templates are rejected before dispatch.
LoginCodeValidPayload-
RecoveryCodeValidPayload-
RecoveryValidPayload-
RegistrationCodeValidPayload-
StartOryKratosServiceOptions-
UserCourier callbacks aligned with Ory Identities built-in email templates (valid flows only).
VerificationCodeValidPayload-
VerificationValidPayload-

Type Aliases

Type AliasDescription
KratosCourierTemplateIdCanonical IDs use dots, e.g. verification_code.valid.

Functions

FunctionDescription
createOryKratosAppExpress app for the Ory Kratos HTTP courier callback only (internal network).
createPostKratosCourierHandler-
fetchKratosIdentityByIdFetches a Kratos identity by id from the admin API.
kratosAdminBaseUrlShared Kratos Admin API helpers (identity lookup by id / email).
makePostKratosActionHandlerMounts as POST /kratos/action. Parses JSON body, packages it as a KratosAction, and forwards to handler.onAction.
resolveAuthFromIdentityIdResolve a fresh Auth (from @saflib/node) for userId via the Kratos admin API.
resolveEmailFromIdentityIdResolves a member's email from the Kratos admin API. Returns null when the lookup fails.
resolveUserIdByEmailResolves a user's id from the Kratos admin API by email. Returns null when the lookup fails or no identity matches.
startOryKratosService-