Skip to content

Commit

Permalink
sign the envelope directly
Browse files Browse the repository at this point in the history
Signed-off-by: Ramon Petgrave <[email protected]>
  • Loading branch information
ramonpetgrave64 committed Aug 1, 2024
1 parent 0405b72 commit f6b4b61
Showing 1 changed file with 12 additions and 15 deletions.
27 changes: 12 additions & 15 deletions internal/builders/generic/attest.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,21 +112,18 @@ run in the context of a Github Actions workflow.`,
attBytes, err = json.Marshal(p)
check(err)
} else {
// att, err := signer.Sign(ctx, &intoto.Statement{
// StatementHeader: p.StatementHeader,
// Predicate: p.Predicate,
// })
// check(err)
att, err := signer.Sign(ctx, &intoto.Statement{
StatementHeader: p.StatementHeader,
Predicate: p.Predicate,
})
check(err)

// _, err = tlog.Upload(ctx, att)

Check failure on line 121 in internal/builders/generic/attest.go

View workflow job for this annotation

GitHub Actions / golangci-lint

commentedOutCode: may want to remove commented-out code (gocritic)
// check(err)

// attBytes = att.Bytes()

Check failure on line 124 in internal/builders/generic/attest.go

View workflow job for this annotation

GitHub Actions / golangci-lint

commentedOutCode: may want to remove commented-out code (gocritic)

att, err := makeSigstoreBundleAttestation(ctx, &intoto.Statement{
StatementHeader: p.StatementHeader,
Predicate: p.Predicate,
})
att, err = makeSigstoreBundleAttestation(ctx, att)
check(err)

attBytes = att.Bytes()
Expand Down Expand Up @@ -155,14 +152,14 @@ run in the context of a Github Actions workflow.`,
return c
}

func makeSigstoreBundleAttestation(ctx context.Context, statement *intoto.Statement) (signing.Attestation, error) {
func makeSigstoreBundleAttestation(ctx context.Context, att signing.Attestation) (signing.Attestation, error) {
fmt.Println("debug: running makeSigstoreBundle")
statementBytes, err := json.Marshal(*statement)
if err != nil {
return nil, err
}
// statementBytes, err := json.Marshal(*statement)

Check failure on line 157 in internal/builders/generic/attest.go

View workflow job for this annotation

GitHub Actions / golangci-lint

commentedOutCode: may want to remove commented-out code (gocritic)
// if err != nil {
// return nil, err
// }
content := &sigstoreSign.DSSEData{
Data: statementBytes,
Data: att.Bytes(),
PayloadType: "application/vnd.in-toto+json",
}
// content := &sigstoreSign.PlainData{

Check failure on line 165 in internal/builders/generic/attest.go

View workflow job for this annotation

GitHub Actions / golangci-lint

commentedOutCode: may want to remove commented-out code (gocritic)
Expand Down

0 comments on commit f6b4b61

Please sign in to comment.