Skip to content

Commit

Permalink
Fix body encoding in mock Rekor server (#1318)
Browse files Browse the repository at this point in the history
Signed-off-by: Brian DeHamer <[email protected]>
Co-authored-by: Samuel Giddins <[email protected]>
  • Loading branch information
bdehamer and segiddins authored Nov 26, 2024
1 parent e529e31 commit 8279f49
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
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

0 comments on commit 8279f49

Please sign in to comment.