Skip to content

Commit

Permalink
fix bug in mocked inclusion proof calculation (#737)
Browse files Browse the repository at this point in the history
Signed-off-by: Brian DeHamer <[email protected]>
  • Loading branch information
bdehamer authored Sep 8, 2023
1 parent c4489fc commit 13e78ac
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/slow-weeks-shop.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@sigstore/mock': patch
---

Fix bug in mocked inclusion proof calculation
8 changes: 4 additions & 4 deletions packages/mock/src/rekor/tlog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class TLogImpl implements TLog {
const logID = crypto.createHash('sha256').update(this.publicKey).digest();
const logIndex = crypto.randomInt(10_000_000);
const timestamp = Math.floor(Date.now() / 1000);
const body = Buffer.from(canonicalize(proposedEntry)!).toString('base64');
const body = Buffer.from(canonicalize(proposedEntry)!);

const entry = { logID, logIndex, timestamp, body };
const set = this.calculateSET(entry);
Expand Down Expand Up @@ -86,13 +86,13 @@ class TLogImpl implements TLog {
logIndex,
logID,
}: {
body: string;
body: Buffer;
timestamp: number;
logIndex: number;
logID: Buffer;
}): Buffer {
const setData = {
body: body,
body: body.toString('base64'),
integratedTime: timestamp,
logIndex: logIndex,
logID: logID.toString('hex'),
Expand All @@ -109,7 +109,7 @@ class TLogImpl implements TLog {
timestamp,
logID,
}: {
body: string;
body: Buffer;
timestamp: number;
logID: Buffer;
}): InclusionProof {
Expand Down

0 comments on commit 13e78ac

Please sign in to comment.