mirror of
https://github.com/hanzoai/mpc.git
synced 2026-10-30 19:45:28 +00:00
Adds a REST API layer that bridges HTTP requests to NATS for MPC node coordination. All wallet endpoints require bearer token auth validated against hanzo.id/api/userinfo. Health/readiness probes remain public. Endpoints: POST /api/v1/wallets (keygen), GET /api/v1/wallets, POST /api/v1/sign, POST /api/v1/reshare Also updates Dockerfile to Go 1.25 and hanzo-mpc binary naming.
18 lines
406 B
Go
18 lines
406 B
Go
package api
|
|
|
|
import "context"
|
|
|
|
type contextKey string
|
|
|
|
const userContextKey contextKey = "iam_user"
|
|
|
|
func setUser(ctx context.Context, user *IAMUser) context.Context {
|
|
return context.WithValue(ctx, userContextKey, user)
|
|
}
|
|
|
|
// GetUser extracts the authenticated IAM user from the request context.
|
|
func GetUser(ctx context.Context) *IAMUser {
|
|
user, _ := ctx.Value(userContextKey).(*IAMUser)
|
|
return user
|
|
}
|