Implement authorization and control surfaces

This commit is contained in:
kami
2026-07-26 19:13:09 +04:00
parent 1c889167fa
commit 9937cd5cd0
5 changed files with 177 additions and 12 deletions
+10
View File
@@ -136,6 +136,16 @@ func ValidatePayload(typ string, p map[string]any) error {
if len(p) == 0 {
return fmt.Errorf("%w: amendment cannot be empty", ErrInvalid)
}
case "ApprovalRequested":
for _, k := range []string{"subject_ref", "options"} {
if _, ok := p[k]; !ok {
return fmt.Errorf("%w: %s required", ErrInvalid, k)
}
}
case "ApprovalGranted", "ApprovalDenied":
if err := requiredString("subject_ref"); err != nil {
return err
}
}
return nil
}