(path string)
| 56 | } |
| 57 | |
| 58 | func loadBundlesFromJSONLinesFile(path string) ([]*api.Attestation, error) { |
| 59 | fileContent, err := os.ReadFile(path) |
| 60 | if err != nil { |
| 61 | return nil, err |
| 62 | } |
| 63 | |
| 64 | attestations := []*api.Attestation{} |
| 65 | |
| 66 | decoder := json.NewDecoder(bytes.NewReader(fileContent)) |
| 67 | |
| 68 | for decoder.More() { |
| 69 | var b bundle.Bundle |
| 70 | b.Bundle = new(protobundle.Bundle) |
| 71 | if err := decoder.Decode(&b); err != nil { |
| 72 | return nil, err |
| 73 | } |
| 74 | a := api.Attestation{Bundle: &b} |
| 75 | attestations = append(attestations, &a) |
| 76 | } |
| 77 | |
| 78 | if len(attestations) == 0 { |
| 79 | return nil, ErrEmptyBundleFile |
| 80 | } |
| 81 | |
| 82 | return attestations, nil |
| 83 | } |
| 84 | |
| 85 | func GetOCIAttestations(client oci.Client, artifact artifact.DigestedArtifact) ([]*api.Attestation, error) { |
| 86 | attestations, err := client.GetAttestations(artifact.NameRef(), artifact.DigestWithAlg()) |
no outgoing calls