To reduce bot traffic you must login to view /lordwelch/gokrazy/commit/b48fd2647893ae0d5322d6842d0607584e21cd55.
The GitHub login only links via username.

Files
2023-02-05 21:53:53 +01:00

24 lines
446 B
Go

package gokrazy
import (
"encoding/json"
"os"
)
func ReadSBOM() (*json.RawMessage, string, error) {
b, err := os.ReadFile("/etc/gokrazy/sbom.json")
if err != nil {
return nil, "", err
}
type SBOMWithHash struct {
SBOMHash string `json:"sbom_hash"`
SBOM *json.RawMessage `json:"sbom"`
}
var sh SBOMWithHash
if err := json.Unmarshal(b, &sh); err != nil {
return nil, "", err
}
return sh.SBOM, sh.SBOMHash, nil
}