File tree Expand file tree Collapse file tree 4 files changed +8
-8
lines changed
Expand file tree Collapse file tree 4 files changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -74,4 +74,4 @@ def add_auth_header(
7474 if client_call_details .metadata is None :
7575 client_call_details .metadata = Metadata ()
7676
77- client_call_details .metadata ["x- key" ] = self ._key
77+ client_call_details .metadata ["key" ] = self ._key
Original file line number Diff line number Diff line change @@ -85,7 +85,7 @@ def add_hmac(
8585 )
8686 return
8787
88- key : Any = client_call_details .metadata .get ("x- key" )
88+ key : Any = client_call_details .metadata .get ("key" )
8989 if key is None :
9090 _logger .error ("No key found in metadata, cannot sign the request." )
9191 return
@@ -96,6 +96,6 @@ def add_hmac(
9696
9797 hmac_obj .update (client_call_details .method .encode ())
9898
99- client_call_details .metadata ["x- ts" ] = ts
100- client_call_details .metadata ["x- nonce" ] = nonce
101- client_call_details .metadata ["x-hmac " ] = urlsafe_b64encode (hmac_obj .digest ())
99+ client_call_details .metadata ["ts" ] = ts
100+ client_call_details .metadata ["nonce" ] = nonce
101+ client_call_details .metadata ["sig " ] = urlsafe_b64encode (hmac_obj .digest ())
Original file line number Diff line number Diff line change @@ -25,4 +25,4 @@ async def test_auth_interceptor() -> None:
2525
2626 auth_interceptor .add_auth_header (client_call_details )
2727
28- assert metadata ["x- key" ] == "my_key"
28+ assert metadata ["key" ] == "my_key"
Original file line number Diff line number Diff line change @@ -16,13 +16,13 @@ async def test_sign_interceptor() -> None:
1616 sign : SigningOptions = SigningOptions (secret = "my_secret" )
1717 sign_interceptor : SigningInterceptor = SigningInterceptor (options = sign )
1818
19- metadata : dict [str , str | bytes ] = {"x- key" : "my_key" }
19+ metadata : dict [str , str | bytes ] = {"key" : "my_key" }
2020
2121 client_call_details = mock .MagicMock (method = "my_rpc" )
2222 client_call_details .metadata = metadata
2323
2424 sign_interceptor .add_hmac (client_call_details , b"1634567890" , b"123456789" )
2525
26- assert metadata ["x-hmac " ] == "NJDvrkRZhOPekn5AvPiaJsYTJYCgnLzA-LQFC2D7GNE=" .encode (
26+ assert metadata ["sig " ] == "NJDvrkRZhOPekn5AvPiaJsYTJYCgnLzA-LQFC2D7GNE=" .encode (
2727 "utf-8"
2828 )
You can’t perform that action at this time.
0 commit comments