@@ -23,6 +23,8 @@ import { SignatureMaterial, SignerFunc } from '../types/signature';
23
23
import { HashAlgorithm } from '../types/sigstore' ;
24
24
import { pem } from '../util' ;
25
25
26
+ import type { LogEntry } from '@sigstore/rekor-types' ;
27
+
26
28
describe ( 'Signer' , ( ) => {
27
29
const fulcioBaseURL = 'http://localhost:8001' ;
28
30
const rekorBaseURL = 'http://localhost:8002' ;
@@ -140,9 +142,16 @@ describe('Signer', () => {
140
142
verification : {
141
143
signedEntryTimestamp :
142
144
'MEUCIQD6CD7ZNLUipFoxzmSL/L8Ewic4SRkXN77UjfJZ7d/wAAIgatokSuX9Rg0iWxAgSfHMtcsagtDCQalU5IvXdQ+yLEA=' ,
145
+ inclusionProof : {
146
+ hashes : [ 'deadbeef' , 'feedface' ] ,
147
+ logIndex : 12345 ,
148
+ rootHash : 'fee1dead' ,
149
+ treeSize : 12346 ,
150
+ checkpoint : 'checkpoint' ,
151
+ } ,
143
152
} ,
144
153
} ,
145
- } ;
154
+ } satisfies LogEntry ;
146
155
147
156
beforeEach ( ( ) => {
148
157
// Mock Rekor request
@@ -211,7 +220,34 @@ describe('Signer', () => {
211
220
expect ( tlog ?. logIndex ) . toEqual (
212
221
rekorEntry [ uuid ] . logIndex . toString ( )
213
222
) ;
214
- expect ( tlog ?. inclusionProof ) . toBeFalsy ( ) ;
223
+ expect ( tlog ?. inclusionProof ?. checkpoint ?. envelope ) . toEqual (
224
+ rekorEntry [ uuid ] . verification . inclusionProof . checkpoint
225
+ ) ;
226
+ expect ( tlog ?. inclusionProof ?. hashes ) . toHaveLength ( 2 ) ;
227
+ expect ( tlog ?. inclusionProof ?. hashes [ 0 ] ) . toEqual (
228
+ Buffer . from (
229
+ rekorEntry [ uuid ] . verification . inclusionProof . hashes [ 0 ] ,
230
+ 'hex'
231
+ )
232
+ ) ;
233
+ expect ( tlog ?. inclusionProof ?. hashes [ 1 ] ) . toEqual (
234
+ Buffer . from (
235
+ rekorEntry [ uuid ] . verification . inclusionProof . hashes [ 1 ] ,
236
+ 'hex'
237
+ )
238
+ ) ;
239
+ expect ( tlog ?. inclusionProof ?. logIndex ) . toEqual (
240
+ rekorEntry [ uuid ] . verification . inclusionProof . logIndex . toString ( )
241
+ ) ;
242
+ expect ( tlog ?. inclusionProof ?. rootHash ) . toEqual (
243
+ Buffer . from (
244
+ rekorEntry [ uuid ] . verification . inclusionProof . rootHash ,
245
+ 'hex'
246
+ )
247
+ ) ;
248
+ expect ( tlog ?. inclusionProof ?. treeSize ) . toEqual (
249
+ rekorEntry [ uuid ] . verification . inclusionProof . treeSize . toString ( )
250
+ ) ;
215
251
expect ( tlog ?. kindVersion ?. kind ) . toEqual ( 'hashedrekord' ) ;
216
252
expect ( tlog ?. kindVersion ?. version ) . toEqual ( '0.0.1' ) ;
217
253
} ) ;
0 commit comments