- Accept Base64URL encoded values with and without padding.
- Improved standard message dispatch bypass mechanism.
- Improved interface for MTCs.
- Significantly increased code coverage in unit tests resulting in overall improvement in reliability.
- Export
MessageDeliveryError
from 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 hassender
andrecipient
as properties.sender
andrecipient
are also accessible as properties on MTC.
- Remove
ConditionallyAwaitFutureMessage
construct in favor of simpler and more robustconnection.next
method. - Refactor send method into injectable dependency. Defaults to HTTP.
unpack
will take a dictionary or bytes as input.pack
takesplaintext
as an argument.- Add
next
context 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
Forward
message (PR #26)
- Add support for forwarding for connections utilizing mediators for routing.
- Simplified
StaticConnection
and 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 withrecipients
and 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).
pack
prepares messages for forwarding whenrouting_keys
is 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 argumentdump
that will convert the packed message to bytes when set toTrue
or will leave as a dictionary when set toFalse
. Defaults toTrue
.bytes_to_b58
andb58_to_bytes
- added a small (max size of 16)lru_cache
to 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_message
inside ofsend_and_await_reply
. - Return signer on
verify_signed_message_field
so that the signer of the message can be verified to be the expected signer. - Fix usage of removed
_key_for_type
in dispatcher - Fix tests
- Added more connection information to
StaticConnection
, including:did
as 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_returnroute
example.
- 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
MessageUndeliverable
Exception, 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_handler
method.
- Switch to PyNacl instead of PySodium. PyNacl includes pre-built binary
packages of
libsodium
; this switch means removing the dependency oflibsodium
being installed on the system. Module
and 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.
route
androute_module
no 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
@route
to 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
@route
will create a handler for the message type defined by combining the module'sDOC_URI
,PROTOCOL
,VERSION
and 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
, orVERSION
with@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
InvalidMessage
exception instead ofInvalidMessageType
. Semver
class moved frommodule
toutils
.
- 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