6 releases
0.7.6 | Sep 24, 2024 |
---|---|
0.7.5 | Sep 24, 2024 |
0.2.1 | Sep 9, 2024 |
#1053 in Authentication
200KB
4.5K
SLoC
Affinidi Messaging - Mediator Service
[[TOC]]
Overview
A DIDComm Messaging v2 mediator & relay service that listens to send &receive messages over https.
Dependencies
To run the mediator, it requires these packages that is also part of the Affinidi Messaging project.
- affinidi-messaging-didcomm - Affinidi Messaging DIDComm implementation, a modified version of didcomm-rust project.
- affinidi-messaging-sdk - a Software Development Kit (SDK) to simplify the implementation of Affinidi Messaging into your application.
Prerequisites
To build and run this project, you need to set up the following:
- Install Rust on your machine if you haven't installed it yet using this guide.
- Install the Docker on your machine if you haven't installed it yet using this guide. We will need this to run Redis instance for the mediator.
Running affinidi-messaging-mediator service
-
Run Redis docker container using the command below:
docker run --name=redis-local --publish=6379:6379 --hostname=redis --restart=on-failure --detach redis:latest
-
Navigate to the
affinidi-messaging-mediator
subfolder and create certificates foraffinidi-messaging-mediator
service:cd affinidi-messaging-mediator cargo run --example create_local_certs
This will generate certificate files in the
affinidi-messaging-mediator/conf/keys
folder. You should useclient.chain
file to override the default SSL certificates inaffinidi-messaging-sdk
, like:let mut config = Config::builder() .with_ssl_certificates(&mut vec![ "../affinidi-messaging-mediator/conf/keys/client.chain".into() ])
-
In the same
affinidi-messaging-mediator
subfolder run the following command to generate DID and the corresponding keys:cargo run --example generate_secrets
This will generate
affinidi-messaging-mediator/conf/secrets.json-generated
file containing a did:peer together with the pair of keys for verification and encryption andjwt_authorization_secret
you shall use forjwt_authorization_secret
value inmediator.toml
. Use the generated did:peer as a value for<MEDIATOR_DID>
placeholder in following commands as well as in affinidi-messaging-sdk - Examples. -
Save the generated
secrets.json-generated
file asaffinidi-messaging-mediator/conf/secrets.json
. -
Start
affinidi-messaging-mediator
service via:cd affinidi-messaging-mediator export MEDIATOR_DID=did://<MEDIATOR_DID> export REDIS_URL=redis://@localhost:6379 cargo run
Examples
Refer to affinidi-messaging-sdk - Examples.
Dependencies
~177MB
~3.5M SLoC