@@ -78,7 +78,8 @@ const createLocator = (expectedDigest, locateResponse) => ({
7878 }
7979} )
8080
81- const gatewayIdentity = ( await ed25519 . Signer . generate ( ) ) . withDID (
81+ const gatewaySigner = ( await ed25519 . Signer . generate ( ) ) . signer
82+ const gatewayIdentity = gatewaySigner . withDID (
8283 'did:web:test.w3s.link'
8384)
8485
@@ -134,7 +135,9 @@ describe('withAuthorizedSpace', async () => {
134135 nb : { token : 'a1b2c3' }
135136 } )
136137 ] ) ,
137- gatewayIdentity
138+ delegationProofs : [ ] ,
139+ gatewaySigner,
140+ gatewayIdentity,
138141 }
139142 )
140143
@@ -178,6 +181,8 @@ describe('withAuthorizedSpace', async () => {
178181 nb : { token : null }
179182 } )
180183 ] ) ,
184+ delegationProofs : [ ] ,
185+ gatewaySigner,
181186 gatewayIdentity
182187 }
183188 )
@@ -224,6 +229,8 @@ describe('withAuthorizedSpace', async () => {
224229 nb : { token : 'a1b2c3' }
225230 } )
226231 ] ) ,
232+ delegationProofs : [ ] ,
233+ gatewaySigner,
227234 gatewayIdentity
228235 }
229236 )
@@ -288,7 +295,7 @@ describe('withAuthorizedSpace', async () => {
288295 const response1 = await withAuthorizedSpace ( innerHandler ) (
289296 request ,
290297 { } ,
291- { ...ctx , authToken : 'space1-token' }
298+ { ...ctx , authToken : 'space1-token' , delegationProofs : [ ] , gatewaySigner }
292299 )
293300
294301 expect ( await response1 . json ( ) ) . to . deep . equal ( {
@@ -302,7 +309,7 @@ describe('withAuthorizedSpace', async () => {
302309 withAuthorizedSpace ( sinon . fake ( innerHandler ) ) (
303310 request ,
304311 { } ,
305- { ...ctx , authToken : 'space2-token' }
312+ { ...ctx , authToken : 'space2-token' , delegationProofs : [ ] , gatewaySigner }
306313 )
307314 )
308315
@@ -314,7 +321,7 @@ describe('withAuthorizedSpace', async () => {
314321 const response3 = await withAuthorizedSpace ( innerHandler ) (
315322 request ,
316323 { } ,
317- { ...ctx , authToken : 'space3-token' }
324+ { ...ctx , authToken : 'space3-token' , delegationProofs : [ ] , gatewaySigner }
318325 )
319326
320327 expect ( await response3 . json ( ) ) . to . deep . equal ( {
@@ -351,7 +358,7 @@ describe('withAuthorizedSpace', async () => {
351358 const responseWithoutToken = await withAuthorizedSpace ( innerHandler ) (
352359 request ,
353360 { } ,
354- { ...ctx , authToken : null }
361+ { ...ctx , authToken : null , delegationProofs : [ ] , gatewaySigner }
355362 )
356363
357364 expect ( await responseWithoutToken . json ( ) ) . to . deep . equal ( {
@@ -363,7 +370,7 @@ describe('withAuthorizedSpace', async () => {
363370
364371 const ih = sinon . fake ( innerHandler )
365372 const errorWithToken = await rejection (
366- withAuthorizedSpace ( ih ) ( request , { } , { ...ctx , authToken : 'a1b2c3' } )
373+ withAuthorizedSpace ( ih ) ( request , { } , { ...ctx , authToken : 'a1b2c3' , delegationProofs : [ ] , gatewaySigner } )
367374 )
368375
369376 expect ( ih . notCalled ) . to . be . true
@@ -400,6 +407,8 @@ describe('withAuthorizedSpace', async () => {
400407 nb : { token : 'a1b2c3' }
401408 } )
402409 ] ) ,
410+ delegationProofs : [ ] ,
411+ gatewaySigner,
403412 gatewayIdentity
404413 }
405414 )
@@ -444,6 +453,8 @@ describe('withAuthorizedSpace', async () => {
444453 nb : { token : 'a1b2c3' }
445454 } )
446455 ] ) ,
456+ delegationProofs : [ ] ,
457+ gatewaySigner,
447458 gatewayIdentity
448459 }
449460 )
@@ -487,6 +498,8 @@ describe('withAuthorizedSpace', async () => {
487498 nb : { token : 'a1b2c3' }
488499 } )
489500 ] ) ,
501+ delegationProofs : [ ] ,
502+ gatewaySigner,
490503 gatewayIdentity
491504 }
492505 )
@@ -532,7 +545,7 @@ describe('withAuthorizedSpace', async () => {
532545
533546 const ih = sinon . fake ( innerHandler )
534547 const error = await rejection (
535- withAuthorizedSpace ( ih ) ( request , { } , { ...ctx , authToken : 'a1b2c3' } )
548+ withAuthorizedSpace ( ih ) ( request , { } , { ...ctx , authToken : 'a1b2c3' , delegationProofs : [ ] , gatewaySigner } )
536549 )
537550
538551 expect ( ih . notCalled ) . to . be . true
0 commit comments