oficina / equipo Public

Clone
git clone https://amadan.net/oficina/equipo

Plain git — no account needed to clone.

Download

Download this file

1package kernel
2
3import (
4 "crypto/sha256"
5 "encoding/hex"
6 "encoding/json"
7 "strings"
8 "unicode/utf8"
9)
10
11func (m Mutation) Valid() bool {
12 return strings.TrimSpace(m.RequestID) != "" && len(m.RequestID) <= 256 && utf8.ValidString(m.RequestID) && m.Revision >= 0
13}
14
15// InputHash preserves explicit input values, including the original revision.
16// Callers supply a concrete input struct, not an unordered HTTP body.
17func InputHash(input any) (string, error) {
18 raw, err := json.Marshal(input)
19 if err != nil {
20 return "", err
21 }
22 sum := sha256.Sum256(raw)
23 return hex.EncodeToString(sum[:]), nil
24}
25