Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix body encoding in mock Rekor server #1318

Merged
merged 1 commit into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/thin-garlics-reflect.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@sigstore/mock': patch
---

Fix encoding of body field returned by mock Rekor server
1 change: 1 addition & 0 deletions packages/mock/src/rekor/tlog.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ describe('TLog', () => {

const entry = result[uuid];
expect(entry.body).toBeDefined();
expect(typeof entry.body).toBe('string');
expect(JSON.parse(Buffer.from(entry.body, 'base64').toString())).toEqual(
proposedEntry
);
Expand Down
4 changes: 2 additions & 2 deletions packages/mock/src/rekor/tlog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

import { LogEntry } from '@sigstore/rekor-types';
import canonicalize from 'canonicalize';
import crypto from 'crypto';
Expand Down Expand Up @@ -70,7 +70,7 @@ class TLogImpl implements TLog {

return {
[uuid]: {
body: body,
body: body.toString('base64'),
integratedTime: timestamp,
logID: logID.toString('hex'),
logIndex: logIndex,
Expand Down