File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -49,6 +49,18 @@ Where 3.x left you reaching into submodules such as `ably.types.message` or
4949the whole public API, and ` ably.pubsub.server.sync ` is its synchronous
5050counterpart. The packages beneath them are internal and free to move.
5151
52+ For example, the encryption helpers move from ` ably.util.crypto ` :
53+
54+ Example 3.x code:
55+ ``` python
56+ from ably.util.crypto import generate_random_key, get_default_params
57+ ```
58+
59+ Example 4.0.0 code:
60+ ``` python
61+ from ably.pubsub.server import generate_random_key, get_default_params
62+ ```
63+
5264### Clients are built by factories
5365
5466` AblyRest ` and ` AblyRealtime ` are internal in 4.0.0 and raise ` TypeError ` if
Original file line number Diff line number Diff line change 3838from ably .pubsub .types .options import Options , VCDiffDecoder
3939from ably .pubsub .types .tokendetails import TokenDetails
4040from ably .pubsub .util .construction import factory_construction
41- from ably .pubsub .util .crypto import CipherParams
41+ from ably .pubsub .util .crypto import CipherParams , generate_random_key , get_default_params
4242from ably .pubsub .util .exceptions import AblyAuthException , AblyException , IncompatibleClientIdException
4343from ably .pubsub .vcdiff .defaultvcdiffdecoder import AblyVCDiffDecoder
4444from ably .pubsub .version import api_version , lib_version
@@ -275,5 +275,7 @@ def create_realtime_client(**kwargs) -> PubSubRealtimeClient:
275275 'api_version' ,
276276 'create_http_client' ,
277277 'create_realtime_client' ,
278+ 'generate_random_key' ,
279+ 'get_default_params' ,
278280 'lib_version' ,
279281]
Original file line number Diff line number Diff line change 2424from ably .pubsub .sync .types .options import Options , VCDiffDecoder
2525from ably .pubsub .sync .types .tokendetails import TokenDetails
2626from ably .pubsub .sync .util .construction import factory_construction
27- from ably .pubsub .sync .util .crypto import CipherParams
27+ from ably .pubsub .sync .util .crypto import CipherParams , generate_random_key , get_default_params
2828from ably .pubsub .sync .util .exceptions import AblyAuthException , AblyException , IncompatibleClientIdException
2929from ably .pubsub .sync .vcdiff .defaultvcdiffdecoder import AblyVCDiffDecoder
3030from ably .pubsub .version import api_version , lib_version
@@ -84,5 +84,7 @@ def create_http_client(**kwargs) -> PubSubHttpClient:
8484 'VCDiffDecoder' ,
8585 'api_version' ,
8686 'create_http_client' ,
87+ 'generate_random_key' ,
88+ 'get_default_params' ,
8789 'lib_version' ,
8890]
Original file line number Diff line number Diff line change 22class InstallPycrypto :
33 def __getattr__ (self , name ):
44 raise ImportError (
5- "This requires to install ably with crypto support: pip install 'ably[crypto]'"
5+ "This requires ably-pubsub-server with crypto support: pip install 'ably-pubsub-server [crypto]'"
66 )
77
88
Original file line number Diff line number Diff line change @@ -161,3 +161,9 @@ class TestPublicTypes:
161161 def test_message_is_exported (self ):
162162 assert 'Message' in server .__all__
163163 assert 'Message' in server_sync .__all__
164+
165+ # RSE2: channel encryption needs a public way to generate a key and build cipher params
166+ @pytest .mark .parametrize ('name' , ['generate_random_key' , 'get_default_params' ])
167+ def test_crypto_helpers_are_exported (self , name ):
168+ assert name in server .__all__
169+ assert name in server_sync .__all__
You can’t perform that action at this time.
0 commit comments