AshHooks.Provider.Mock (AshHooks v0.1.1)

Copy Markdown View Source

Reference provider for tests and examples: HMAC-SHA256 over the raw body via the default implementation, event type from payload["type"], and an echoing typed event.

parse_event_type/1 resolves the type string with String.to_existing_atom/1 — fail-closed: a type that was not already an atom is reported as an unknown event, never converted into a newly created one (no atom-table growth from webhook input). The Mock imposes NO taxonomy beyond that: any pre-existing atom is accepted as a type (it is a general test double — real providers match their vendor's known type strings). JSON scalar values (nil, true, false, decoded from JSON null/true/false and from their string forms) are rejected as malformed, not event types.

The optional secret callbacks are deliberately NOT implemented: the Mock exercises the app-level default scope, with the secret supplied by the consumer's DSL secret source.