#nosec G101 SetTestRekorPublicKey writes the test Rekor public key to disk and sets the corresponding environment variable to make it available to cosign.
(t *testing.T)
| 132 | // SetTestRekorPublicKey writes the test Rekor public key to disk and sets the corresponding |
| 133 | // environment variable to make it available to cosign. |
| 134 | func SetTestRekorPublicKey(t *testing.T) { |
| 135 | // Do not use afero.NewMemMapFs() here because the file is read by cosign |
| 136 | // which does not understand the filesystem-from-context pattern |
| 137 | f, err := os.Create(path.Join(t.TempDir(), "rekor.pub")) |
| 138 | assert.NoError(t, err) |
| 139 | defer f.Close() |
| 140 | _, err = f.Write([]byte(TestRekorPublicKey)) |
| 141 | assert.NoError(t, err) |
| 142 | t.Setenv("SIGSTORE_REKOR_PUBLIC_KEY", f.Name()) |
| 143 | } |