- Improved standard message dispatch bypass mechanism.
- Improved interface for MTCs.
- Significantly increased code coverage in unit tests resulting in overall improvement in reliability.
- Export
MessageDeliveryErrorfrom package root. - Fixes for forwarding and processing forwarded messages.
- Fix Message equality checks.
- Add MTC helper functions for checking and setting typical message characteristics.
- Refactor
Additional Data; now a class instead of a dictionary. Currently only hassenderandrecipientas properties.senderandrecipientare also accessible as properties on MTC.
- Remove
ConditionallyAwaitFutureMessageconstruct in favor of simpler and more robustconnection.nextmethod. - Refactor send method into injectable dependency. Defaults to HTTP.
unpackwill take a dictionary or bytes as input.packtakesplaintextas an argument.- Add
nextcontext manager method, yielding a future to the next message matching the given type or condition. This mechanism is now also utilized inawait_message.
- Move HTTP sending code to method under
utils.
- Fixed preparation of
Forwardmessage (PR #26)
- Add support for forwarding for connections utilizing mediators for routing.
- Simplified
StaticConnectionand added mechanism for updating "their" info, resulting in differences in the method signature of its constructor.
__init__- changed to accept tuple of keys (public, private) with optional named arguments:endpoint,their_vk,recipients, androuting_keys.endpoint- sets the endpoint to which messages are sent.their_vk- mutually exclusive withrecipientsand results in a recipients list of size one containingtheir_vk.recipients- mutually exclusive withtheir_vk, setting the contents of the recipients list for this connection.routing_keys- list of mediator keys that will forward the message on to the recipient(s).
packprepares messages for forwarding whenrouting_keysis set on the connection.- Renamed convenience accessors for keys:
my_vk -> verkey,my_sk -> sigkey. - Added
update- Updates "their" connection information for this static connection. Arguments are named arguments; processing is similar to__init__with the exclusion of "my" keys. A change in my information should be viewed as creating a new connection and therefore updating those values is not supported.
pack_message- added named optional argumentdumpthat will convert the packed message to bytes when set toTrueor will leave as a dictionary when set toFalse. Defaults toTrue.bytes_to_b58andb58_to_bytes- added a small (max size of 16)lru_cacheto make frequent conversions of keys in the pack, unpack, and message handling process more efficient.
- Added
ensure_key_bytes- ensures that the given key is formatted as a byte string rather than a Base58 encoded string. - Added
ensure_key_b58- ensures that the given key is formatted as a Base58 encoded string rather than as bytes. - Added
forward_msg- creates a new forward message.
- Updated to reflect new method signatures.
- Fix condition not passed to
await_messageinside ofsend_and_await_reply. - Return signer on
verify_signed_message_fieldso that the signer of the message can be verified to be the expected signer. - Fix usage of removed
_key_for_typein dispatcher - Fix tests
- Added more connection information to
StaticConnection, including:didas Base58 encoding of first sixteen bytes ofmy_vk,my_vk_b58,their_vk_b58.
- Add return route support.
- Add mechanism for directly awaiting a message, bypassing regular dispatch. This makes it possible to treat messages more like a return-response model and significantly simplifies some flows.
- Favor named arguments over keyword arguments where possible.
- Added a return route server example, intended to be run with the corresponding client, to demonstrate return route support.
- Added a return route client example, intended to be run with the corresponding server, to demonstrate return route support.
- Removed original
cron_returnrouteexample.
- Add construct for conditionally awaiting a message on the connection,
bypassing regular dispatch. As a result, two new methods are defined on
StaticConnection:await_message, andsend_and_await_reply. See return route client example - Add Reply construct to support return routing while keeping transport decoupled from the library. See return route server example.
- Add
MessageUndeliverableException, raised when no endpoint or return route is currently available for the connection or other errors with the connection are encountered. - Add support for unpacking plaintext messages.
- Better error handling in
send.
- Add
remove_handlermethod.
- Switch to PyNacl instead of PySodium. PyNacl includes pre-built binary
packages of
libsodium; this switch means removing the dependency oflibsodiumbeing installed on the system. Moduleand route definition rewrite. The Module system has been significantly improved, allowing for cleaner and more flexible module definitions.
- Rename to
StaticConnection. - Reorder parameter into slightly more natural order. (Breaking change)
- Split out pack and unpack functionality into separate functions for a little added flexibility and simpler testing.
routeandroute_moduleno longer simply wrap a dispatcher method. These methods are now responsible for creating Handlers corresponding to the route or routes defined by a module. See below for more on Dispatcher and Handler changes/additions.
- Switch to PyNacl instead of PySodium.
- Add field signing and verification helpers.
Overhauled route definitions (breaking changes):
- Use
@routeto define a route (instead of@route_def). - No implicit routes. If a method of a module does not have a @route decorator, it will never be routed to.
- A bare
@routewill create a handler for the message type defined by combining the module'sDOC_URI,PROTOCOL,VERSIONand the method's name. Use@route(name='...')to specify a name that differs from the method name. - Route a message that normally doesn't match the module's
DOC_URI,PROTOCOL, orVERSIONwith@route(doc_uri='...', protocol='...', version='...'). If any of these keyword arguments are not specified, the module's defaults are used. You can also include name, as in the previous example, to specify a name that differs from the method name. @route('<raw_type_string>')will also work.
- Altered Dispatcher to operate on "Handlers" rather than simple type routes and modules. This improves handler selection and provides an overall cleaner interface.
- Relatively simple container used to help map a Type to a handler function.
- Object used for representing the @type string.
- Allows for comparing types, better version information.
- Reduced code duplication across Message, Module, and Dispatcher.
- Cleaned up all examples.
- Added example for using a Module and web server.
This update includes many backported updates from the Aries Protocol Test Suite "agent core" which was originally derived from this library.
- Messages with malformed message types will raise an
InvalidMessageexception instead ofInvalidMessageType. Semverclass moved frommoduletoutils.
- Added
route_module()toStaticAgentConnection. - Added
clear_routes()andclear_modules()toStaticAgentConnection. StaticAgentConnection.__init__()can now take the raw bytes of keys as well as base58 strings.- Message Trust Contexts;
StaticAgentConnection.handle()will add contexts as appropriate. See the tests for examples of querying or adding to these contexts. - More tests