Documentation
¶
Overview ¶
Package fiberadapter provides Fiber middleware for MPP-protected routes.
Index ¶
- func ChargeMiddleware(m *server.Mpp, params server.ChargeParams) fiberfw.Handler
- func Credential(c *fiberfw.Ctx) *mpp.Credential
- func Receipt(c *fiberfw.Ctx) *mpp.Receipt
- func WriteChallenge(c *fiberfw.Ctx, challenge *mpp.Challenge, realm string)
- func WriteChallenges(c *fiberfw.Ctx, challenges []*mpp.Challenge, realm string)
- func WritePaymentError(c *fiberfw.Ctx, err error)
- func WritePaymentErrorWithChallenge(c *fiberfw.Ctx, err error, challenge *mpp.Challenge, realm string)
- func WritePaymentErrorWithChallenges(c *fiberfw.Ctx, err error, challenges []*mpp.Challenge, realm string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ChargeMiddleware ¶
ChargeMiddleware protects a Fiber route with the server charge flow.
func Credential ¶
func Credential(c *fiberfw.Ctx) *mpp.Credential
Credential returns the verified credential stored on the Fiber context.
func WriteChallenge ¶
WriteChallenge serializes a 402 challenge response using RFC 9457 problem details.
This is the Fiber equivalent of server.WriteChallenge. Fiber is built on fasthttp and cannot use http.ResponseWriter directly.
func WriteChallenges ¶ added in v0.4.0
WriteChallenges serializes a 402 response offering every challenge, one WWW-Authenticate field value per challenge in presentation order.
This is the Fiber equivalent of server.WriteChallenges.
func WritePaymentError ¶
WritePaymentError serializes MPP verification errors as problem details.
This is the Fiber equivalent of server.WritePaymentError. Fiber is built on fasthttp and cannot use http.ResponseWriter directly.
func WritePaymentErrorWithChallenge ¶ added in v0.4.0
func WritePaymentErrorWithChallenge(c *fiberfw.Ctx, err error, challenge *mpp.Challenge, realm string)
WritePaymentErrorWithChallenge serializes an MPP error with a fresh retry challenge.
func WritePaymentErrorWithChallenges ¶ added in v0.4.0
func WritePaymentErrorWithChallenges(c *fiberfw.Ctx, err error, challenges []*mpp.Challenge, realm string)
WritePaymentErrorWithChallenges serializes an MPP error with fresh retry challenges, one WWW-Authenticate field value per challenge in order.
Types ¶
This section is empty.