feat(stripe-core): dunite-stripe-core shared Stripe primitives (DEV-514) #27
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/DEV-514-dunite-stripe-core"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
First shared-crate extraction under the DEV-495 epic (DEV-514). Adds
dunite-stripe-core: a framework-agnostic crate holding the small, security-relevant Stripe primitives that a8n-tools, bunyip, and mokosh had each reimplemented.Contents
verify_webhook_signature- constant-timeStripe-Signatureverification (t=/v1=, timestamp tolerance, multi-v1rotation). Useshmac'sverify_slicefor a constant-time compare.parse_event_envelope- pulls the eventid+typeoff a verified body and returns the raw JSON so the consumer decodesdata.objectin whatever shape it needs (typedasync-stripefor a8n/bunyip, raw fields for mokosh).to_minor_units/from_minor_units- money major<->minor conversion (rust_decimal, two-decimal currencies).Why framework-agnostic
a8n-api and bunyip-api are actix; bunyip-web and mokosh are axum. The crate has no HTTP framework, no database, and no
async-stripedependency, so all three consumers call it from their own handlers. Larger SDK-coupled Stripe code (product/price/subscription API wrappers, response DTOs) is deliberately out of scope, tracked as DEV-515.Notable
Standardizes on the constant-time signature comparison, which fixes a8n-tools' non-constant-time
==on a billing path (the bug bunyip filed as BUNYIP-107) once a8n adopts the crate.Tests
15 unit tests (signature accept/reject/stale/future/rotation/malformed, event parse, money round-trip/rounding) + 1 doctest.
cargo test -p dunite-stripe-core,cargo clippy -p dunite-stripe-core --all-targets -- -D warnings, andcargo fmt --checkall clean. The crate joins the virtual workspace, so its tests run in dunite'scheck.yml.Consumers
Wired first into mokosh-server (separate PR). bunyip and a8n-tools adoption follow under DEV-514.
🤖 Generated with Claude Code
https://claude.ai/code/session_01QLd9c7niucrqx68v4AxVss