Crate sda_server_http [] [src]

SDA REST server library

This create is the server side HTTP binding for SDA. It is a library that exposes the SDA service (provided by the sda_server) crate as a REST interface.

sda_client_http crate provides the reverse feature, reconstructing a SDA service API on top of an HTTP client.

sda_server_cli crate can be used to run a server from the command line without writting the embedding code.

Protocol methods mapping

The HTTP endpoints translate as closely as possible to methods of the sda_protocol::methods. The bodies are encoded in json, using serde Serialization as setup in sda_protocol::resources

(GET)  (/v1/ping) => SdaBaseService::ping
 
(GET)  (/v1/agents/{AgentId}) => SdaAgentService::get_agent
(POST) (/v1/agents/me) => SdaAgentService::create_agent
 
(GET)  (/v1/agents/{AgentId}/profile) => SdaAgentService::get_profile
(POST) (/v1/agents/me/profile) => SdaAgentService::upsert_profile
 
(GET)   (/v1/agents/any/keys/{EncryptionKeyId}) =>
                        SdaAgentService::get_encryption_key
(POST)  (/v1/agents/me/keys) => SdaAgentService::create_encryption_key
 
(POST)  (/v1/aggregations) => SdaRecipientService::create_aggregation
(GET)   (/v1/aggregations) => SdaAggregationService::list_aggregations
(GET)   (/v1/aggregations/{AggregationId}) =>
                        SdaAggregationService::get_aggregation
(DELETE)(/v1/aggregations/{AggregationId}) =>
                        SdaRecipientService::delete_aggregation
 
(GET)   (/v1/aggregations/{AggregationId}/committee/suggestions) =>
                        SdaRecipientService::suggest_committee
(POST)  (/v1/aggregations/implied/committee) =>
                        SdaRecipientService::create_committee
(GET)   (/v1/aggregations/{AggregationId}/committee)
                        SdaAggregationService::get_committee
 
(POST)  (/v1/aggregations/participations) =>
                        SdaParticipationService::create_participation
(GET)   (/v1/aggregations/{AggregationId}/status) =>
                        SdaRecipientService::get_aggregation_status
 
(POST)  (/v1/aggregations/implied/snapshot) =>
                        SdaRecipientService::create_committee
 
(GET)   (/v1/aggregations/any/jobs) => SdaClerkingService::get_clerking_job
(POST)  (/v1/aggregations/implied/jobs/{id}/result) =>
                        SdaClerkingService::create_clerking_result
 
(GET)   (/v1/aggregations/{AggregationId}/snapshots/{SnapshotId}/result) =>
                        SdaRecipientService::get_snapshot_result

Authentication

Authentication relies on the use of then Authenticate header in Basic mode. The username is the caller agent id, the password used at the time of the initial creation is recorded by the server and must then be reused for all subsequent requests.

Functions

handle

Non blocking rouille handler to be used in a loop.

listen

Run the SDA Rest wrapper.