Skip to content

Commit 8279f49

Browse files
bdehamersegiddins
andauthored
Fix body encoding in mock Rekor server (#1318)
Signed-off-by: Brian DeHamer <[email protected]> Co-authored-by: Samuel Giddins <[email protected]>
1 parent e529e31 commit 8279f49

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

.changeset/thin-garlics-reflect.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@sigstore/mock': patch
3+
---
4+
5+
Fix encoding of body field returned by mock Rekor server

packages/mock/src/rekor/tlog.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ describe('TLog', () => {
4747

4848
const entry = result[uuid];
4949
expect(entry.body).toBeDefined();
50+
expect(typeof entry.body).toBe('string');
5051
expect(JSON.parse(Buffer.from(entry.body, 'base64').toString())).toEqual(
5152
proposedEntry
5253
);

packages/mock/src/rekor/tlog.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1313
See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
16-
16+
1717
import { LogEntry } from '@sigstore/rekor-types';
1818
import canonicalize from 'canonicalize';
1919
import crypto from 'crypto';
@@ -70,7 +70,7 @@ class TLogImpl implements TLog {
7070

7171
return {
7272
[uuid]: {
73-
body: body,
73+
body: body.toString('base64'),
7474
integratedTime: timestamp,
7575
logID: logID.toString('hex'),
7676
logIndex: logIndex,

0 commit comments

Comments
 (0)