Download api/v1/auth/handler.go from Mrkiti/Mexa: direct link, hf CLI and curl.
- Browser
- Download file 1.54 kB
-
https://huggingface.co/spaces/Mrkiti/Mexa/resolve/main/api/v1/auth/handler.go
- Command line
-
hf download hf://spaces/Mrkiti/Mexa/api/v1/auth/handler.go
-
curl -L -o handler.go https://huggingface.co/spaces/Mrkiti/Mexa/resolve/main/api/v1/auth/handler.go
1.54 kB
| package auth | |
| import ( | |
| "github.com/gin-gonic/gin" | |
| "mexa/api/v1/actiongate" | |
| "mexa/api/v1/doors" | |
| "mexa/api/v1/kyc" | |
| "mexa/middleware" | |
| ) | |
| // RegisterRoutes — mounts all auth routes on the router group | |
| func RegisterRoutes(rg *gin.RouterGroup) { | |
| auth := rg.Group("/auth") | |
| { | |
| // Public — no JWT required | |
| auth.POST("/register", Register) | |
| auth.POST("/register/activate", doors.Locked) | |
| auth.POST("/register/staff", middleware.RequireAuth(), middleware.RequireRole("XA", "XO", "RM", "OM"), RegisterStaff) | |
| auth.POST("/login", Login) | |
| auth.POST("/logout", Logout) | |
| auth.POST("/otp/verify", VerifyOTP) | |
| auth.POST("/reset/initiate", InitiateReset) | |
| auth.POST("/reset/verify", VerifyReset) | |
| auth.POST("/set-password", SetPassword) | |
| // KYC webhook — stub — Peleza integration pending government approval | |
| auth.POST("/kyc/webhook", kyc.HandleWebhook) | |
| // Signed meza-vault event boundary — OTP/consent/payment replies | |
| auth.POST("/events/meza-vault", actiongate.HandleVaultEvent) | |
| // Protected — JWT required | |
| auth.GET("/me", middleware.RequireAuth(), Me) | |
| keys := auth.Group("/keys", middleware.RequireAuth()) | |
| { | |
| keys.POST("/generate", middleware.RequireRole("DIR", "XA"), doors.Locked) | |
| keys.POST("/revoke", middleware.RequireRole("DIR"), doors.Locked) | |
| } | |
| rc := auth.Group("/role-change", middleware.RequireAuth()) | |
| { | |
| rc.POST("/request", doors.Locked) | |
| rc.POST("/approve", middleware.RequireRole("XA"), doors.Locked) | |
| rc.GET("/pending", middleware.RequireRole("XA"), PendingRoleChanges) | |
| } | |
| } | |
| } | |