git.sr.ht/~pingoo/stdx@v0.0.0-20240218134121-094174641f6e/zign/manifest.go (about) 1 package zign 2 3 import ( 4 "encoding/json" 5 "fmt" 6 ) 7 8 const ( 9 Version1 = 1 10 11 DefaultManifestFilename = "zign.json" 12 ) 13 14 type Manifest struct { 15 Version uint64 `json:"version"` 16 Files []SignOutput `json:"files"` 17 } 18 19 func (manifest Manifest) ToJson() (manifestJSON []byte, err error) { 20 manifestJSON, err = json.MarshalIndent(manifest, "", " ") 21 if err != nil { 22 err = fmt.Errorf("zign: encoding manifest to JSON: %w", err) 23 return 24 } 25 26 return 27 } 28 29 func GenerateManifest(signOutput []SignOutput) (manifest Manifest) { 30 manifest = Manifest{ 31 Version: Version1, 32 Files: signOutput, 33 } 34 35 return 36 }