@@ -105,7 +105,6 @@ async def test_require_jwk_authentication_expired(aiohttp_client):
105105    pubkey  =  {
106106        "pubkey" : json .loads (key .export_public ()),
107107        "alg" : "ECDSA" ,
108-         "domain" : "localhost" ,
109108        "address" : signer_account .address ,
110109        "expires" : "2023-05-02T10:44:42.754994Z" ,
111110    }
@@ -155,7 +154,7 @@ async def view(request, authenticated_sender):
155154            )
156155        )
157156    }
158-     payload  =  {"time" : "2010-12-25T17:05:55Z" , "method" : "GET" , "path" : "/" }
157+     payload  =  {"time" : "2010-12-25T17:05:55Z" , "method" : "GET" , "path" : "/" ,  "domain" :  "localhost" }
159158    headers ["X-SignedOperation" ] =  json .dumps (
160159        {
161160            "payload" : bytes .hex (json .dumps (payload ).encode ("utf-8" )),
@@ -189,7 +188,6 @@ async def view(request, authenticated_sender):
189188    pubkey  =  {
190189        "pubkey" : json .loads (key .export_public ()),
191190        "alg" : "ECDSA" ,
192-         "domain" : "localhost" ,
193191        "address" : signer_account .address ,
194192        "expires" : "2023-05-02T10:44:42.754994Z" ,
195193    }
@@ -198,26 +196,22 @@ async def view(request, authenticated_sender):
198196    signed_message : SignedMessage  =  signer_account .sign_message (signable_message )
199197    pubkey_signature  =  to_0x_hex (signed_message .signature )
200198
201-     # Modify the payload to render the signature invalid 
202-     pubkey ["domain" ] =  "baddomain" 
203-     invalid_pubkey_payload  =  json .dumps (pubkey ).encode ("utf-8" ).hex ()
204- 
205199    app .router .add_get ("" , view )
206200    client  =  await  aiohttp_client (app )
207201    headers  =  {
208202        "X-SignedPubKey" : (
209203            json .dumps (
210204                {
211-                     "payload" : invalid_pubkey_payload ,
205+                     "payload" : pubkey_payload ,
212206                    "signature" : pubkey_signature ,
213207                }
214208            )
215209        )
216210    }
217-     payload  =  {"time" : "2010-12-25T17:05:55Z" , "method" : "GET" , "path" : "/" }
211+     invalid_operation_payload  =  {"time" : "2010-12-25T17:05:55Z" , "method" : "GET" , "path" : "/"  ,  "domain" :  "baddomain "
218212    headers ["X-SignedOperation" ] =  json .dumps (
219213        {
220-             "payload" : bytes .hex (json .dumps (payload ).encode ("utf-8" )),
214+             "payload" : bytes .hex (json .dumps (invalid_operation_payload ).encode ("utf-8" )),
221215            "signature" : "96ffdbbd1704d5f6bfe4698235a0de0d2f58668deaa4371422bee26664f313f51fd483c78c34c6b317fc209779f9ddd9c45accf558e3bf881b49ad970ebf0ade" ,
222216        }
223217    )
@@ -226,7 +220,7 @@ async def view(request, authenticated_sender):
226220    assert  resp .status  ==  401 , await  resp .text ()
227221
228222    r  =  await  resp .json ()
229-     assert  {"error" : "Invalid signature " } ==  r 
223+     assert  {"error" : "Invalid domain " } ==  r 
230224
231225
232226@pytest .mark .asyncio  
@@ -269,7 +263,6 @@ async def test_require_jwk_authentication_good_key(aiohttp_client, patch_datetim
269263    pubkey  =  {
270264        "pubkey" : json .loads (key .export_public ()),
271265        "alg" : "ECDSA" ,
272-         "domain" : "localhost" ,
273266        "address" : signer_account .address ,
274267        "expires" : (patch_datetime_now .FAKE_TIME  +  datetime .timedelta (days = 1 )).isoformat () +  "Z" ,
275268    }
@@ -292,7 +285,7 @@ async def view(request, authenticated_sender):
292285    app .router .add_get ("" , view )
293286    client  =  await  aiohttp_client (app )
294287
295-     payload  =  {"time" : "2010-12-25T17:05:55Z" , "method" : "GET" , "path" : "/" }
288+     payload  =  {"time" : "2010-12-25T17:05:55Z" , "method" : "GET" , "path" : "/" ,  "domain" :  "localhost" }
296289
297290    payload_as_bytes  =  json .dumps (payload ).encode ("utf-8" )
298291    headers  =  {"X-SignedPubKey" : pubkey_signature_header }
0 commit comments