MCPcopy Create free account
hub / github.com/Mnexa-AI/e2a / handleRotateWebhookSecret

Method handleRotateWebhookSecret

internal/httpapi/webhooks.go:459–483  ·  view source on GitHub ↗
(ctx context.Context, in *rotateSecretInput)

Source from the content-addressed store, hash-verified

457}
458
459func (s *Server) handleRotateWebhookSecret(ctx context.Context, in *rotateSecretInput) (*rotateSecretOutput, error) {
460 user, err := s.requireAccountUser(ctx)
461 if err != nil {
462 return nil, err
463 }
464 _, body, err := runIdempotent(s, ctx, user.ID, in.IdempotencyKey,
465 "/v1/webhooks/"+in.ID+"/rotate-secret", nil,
466 func() (int, rotateSecretResponse, error) {
467 secret, prevExpires, rerr := s.deps.RotateSecret(ctx, in.ID, user.ID)
468 if rerr != nil {
469 if errors.Is(rerr, identity.ErrWebhookNotFound) {
470 return 0, rotateSecretResponse{}, NewError(http.StatusNotFound, "not_found", "webhook not found")
471 }
472 return 0, rotateSecretResponse{}, NewError(http.StatusInternalServerError, "internal_error", "failed to rotate webhook secret")
473 }
474 return http.StatusOK, rotateSecretResponse{
475 SigningSecret: secret,
476 PreviousSecretExpiresAt: prevExpires.UTC().Format(time.RFC3339),
477 }, nil
478 })
479 if err != nil {
480 return nil, err
481 }
482 return &rotateSecretOutput{Body: body}, nil
483}
484
485func (s *Server) handleCreateWebhook(ctx context.Context, in *createWebhookInput) (*webhookCreateOutput, error) {
486 user, err := s.requireAccountUser(ctx)

Callers

nothing calls this directly

Calls 4

requireAccountUserMethod · 0.95
runIdempotentFunction · 0.85
NewErrorFunction · 0.85
RotateSecretMethod · 0.80

Tested by

no test coverage detected