diff --git a/api/tangled/cbor_gen.go b/api/tangled/cbor_gen.go --- a/api/tangled/cbor_gen.go +++ b/api/tangled/cbor_gen.go @@ -2467,7 +2467,11 @@ } cw := cbg.NewCborWriter(w) - fieldCount := 4 + fieldCount := 5 + + if t.Evidences == nil { + fieldCount-- + } if t.Reason == nil { fieldCount-- @@ -2573,6 +2577,42 @@ if _, err := cw.WriteString(string(t.CreatedAt)); err != nil { return err } + + // t.Evidences ([]string) (slice) + if t.Evidences != nil { + + if len("evidences") > 1000000 { + return xerrors.Errorf("Value in field \"evidences\" was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("evidences"))); err != nil { + return err + } + if _, err := cw.WriteString(string("evidences")); err != nil { + return err + } + + if len(t.Evidences) > 8192 { + return xerrors.Errorf("Slice value in field t.Evidences was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajArray, uint64(len(t.Evidences))); err != nil { + return err + } + for _, v := range t.Evidences { + if len(v) > 1000000 { + return xerrors.Errorf("Value in field v was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(v))); err != nil { + return err + } + if _, err := cw.WriteString(string(v)); err != nil { + return err + } + + } + } return nil } @@ -2670,6 +2710,46 @@ } t.CreatedAt = string(sval) + } + // t.Evidences ([]string) (slice) + case "evidences": + + maj, extra, err = cr.ReadHeader() + if err != nil { + return err + } + + if extra > 8192 { + return fmt.Errorf("t.Evidences: array too large (%d)", extra) + } + + if maj != cbg.MajArray { + return fmt.Errorf("expected cbor array") + } + + if extra > 0 { + t.Evidences = make([]string, extra) + } + + for i := 0; i < int(extra); i++ { + { + var maj byte + var extra uint64 + var err error + _ = maj + _ = extra + _ = err + + { + sval, err := cbg.ReadStringWithMax(cr, 1000000) + if err != nil { + return err + } + + t.Evidences[i] = string(sval) + } + + } } default: diff --git a/api/tangled/graphvouch.go b/api/tangled/graphvouch.go --- a/api/tangled/graphvouch.go +++ b/api/tangled/graphvouch.go @@ -19,6 +19,8 @@ type GraphVouch struct { LexiconTypeID string `json:"$type,const=sh.tangled.graph.vouch" cborgen:"$type,const=sh.tangled.graph.vouch"` CreatedAt string `json:"createdAt" cborgen:"createdAt"` + // evidences: Optional list of ATURIs serving as evidence for this vouch (ex. issues, PRs) + Evidences []string `json:"evidences,omitempty" cborgen:"evidences,omitempty"` // kind: Whether this user is being vouched for or denounced Kind string `json:"kind" cborgen:"kind"` // reason: The reason for this vouch/denouncement diff --git a/lexicons/graph/vouch.json b/lexicons/graph/vouch.json --- a/lexicons/graph/vouch.json +++ b/lexicons/graph/vouch.json @@ -29,6 +29,15 @@ "createdAt": { "type": "string", "format": "datetime" + }, + "evidences": { + "type": "array", + "description": "Optional list of ATURIs serving as evidence for this vouch (ex. issues, PRs)", + "maxLength": 10, + "items": { + "type": "string", + "format": "at-uri" + } } } }