Skip to content

Commit 28a5cd4

Browse files
Draft text to rewrite this API doc to more of a protocol spec (#61)
* Draft text to rewrite this API doc to more of a protocol spec * Added invite section * Added invite section text * Clarified how provider and consumer may know each other * cosmetic change * cosmetic change * cosmetic change * Minor/typo fix * Removed duplication and added reference to the spec --------- Co-authored-by: Giuseppe Lo Presti <[email protected]>
1 parent 78f662e commit 28a5cd4

File tree

1 file changed

+56
-8
lines changed

1 file changed

+56
-8
lines changed

README.md

Lines changed: 56 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,78 @@
1-
# Open Cloud Mesh API Specification
1+
# Open Cloud Mesh Protocol Specification
22

3-
![Open Cloud Mesh API Specification](logo.png)
3+
![Open Cloud Mesh Protocol Specification](logo.png)
44

5-
This repository contains the [OpenAPI](https://github.com/OAI/OpenAPI-Specification) (fka Swagger) specification for the Open Cloud Mesh API. This specification describes the RESTful API endpoints, request and response headers, possible response codes, request and response formats, hypermedia controls, error handling, and other API design best practices which vendors should support to make sharing of resources between different vendors possible.
5+
This repository contains the specification of the Open Cloud Mesh protocol, including
6+
the [OpenAPI](https://github.com/OAI/OpenAPI-Specification) (fka Swagger) specification for its API. This specification describes disovery and use of the RESTful API endpoints, request and response headers, possible response codes, request and response formats, hypermedia controls, error handling, and other API design best practices which vendors should support to make sharing of resources between different vendors possible.
67

78
* [Scope and assumptions](#scope-and-assumptions)
8-
* [API Documentation](#api-documentation)
9+
* [Specification](#specification)
10+
* [Discovery](#discovery)
11+
* [Share Creation](#create)
12+
* [Share Acceptance](#accept)
13+
* [Share Deletion](#unshare)
14+
* [Share Updating](#update)
15+
* [Resharing](#reshare)
16+
* [Invite](#invite)
17+
918
* [Contributing](#contributing)
1019

1120
## Scope and assumptions
1221

13-
* Authentication between services is already established. This means that this specification doesn't cover the way a service authenticates incoming API calls (e.g. through an API Key, VPN connection or IP whitelisting). In this scope we assume that the services are already authenticated.
14-
* Provider knows the consumer (both endpoint and user) when it creates a share with the consumer (also see [#26](https://github.com/cs3org/OCM-API/issues/26)). How this is known is not part of this spec.
22+
* For the core sharing functionality, the provider knows the consumer (both endpoint and user) when it creates a share with the consumer (also see [#26](https://github.com/cs3org/OCM-API/issues/26)). In addition, an optional invitation workflow is available in this specification (see below), which gives the consumer a way to automatically trust a provider (and vice versa). The [ScienceMesh](https://sciencemesh.io) infrastructure provides a managed white list of trusted federated sites.
1523
* Consumer doesn't have to accept a share, the resource will be available to the consumer immediately (#25).
1624
* Dealing with incoming shares is a vendor specific implementation. One vendor might use an 'accept before' process while another vendor might use a 'decline after' approach. This is considered part of the UX and thus not part of the interaction between different vendors. However, the consumer could notify the provider by using the introduced `/notifications` endpoint (also see [#27](https://github.com/cs3org/OCM-API/issues/27)).
1725
* Reverting access to outgoing shares is a vendor specific implementation. One vendor might delete an entire share while another might invalidate an access token. This is considered part of vendor specific internals and thus not part of the interaction between different vendors. However, the provider could notify the consumer by using the introduced `/notifications` endpoint (also see [#27](https://github.com/cs3org/OCM-API/issues/27)).
1826
* The actual file sync isn't a part of this specification. To keep this specification 'future proof', the file sync protocol will be embedded as a separate object in Open Cloud Mesh API calls. This protocol object contains all protocol specific options, e.g. WebDAV specific options.
1927

20-
## API Documentation
28+
29+
## Specification
30+
### Discovery
31+
Authentication between services is already established. This means that this specification doesn't cover the way a service authenticates incoming API calls (e.g. through an API Key, VPN connection or IP whitelisting). In this scope we assume that the services are already authenticated.
32+
33+
If a finite whitelist of receiver servers exists on the sender
34+
side, then this list may already contain all necessary endpoint details.
35+
36+
When a sending server allows sending to any internet-hosted receiving server, then discovery can happen from the sharee address, using the `/ocm-provider` well-known URL that receiving servers MAY provide according to this [specification](https://cs3org.github.io/OCM-API/docs.html?branch=develop&repo=OCM-API&user=cs3org#/paths/~1ocm-provider/get).
37+
38+
### Share Creation
39+
To create a share, the sending server SHOULD make a HTTP POST request to the `/shares` endpoint of the receiving server ([docs](https://cs3org.github.io/OCM-API/docs.html?branch=develop&repo=OCM-API&user=cs3org#/paths/~1shares/post)).
40+
41+
### Share Acceptance
42+
In response to a share creation, the receiving server MAY send back a [notification](https://cs3org.github.io/OCM-API/docs.html?branch=develop&repo=OCM-API&user=cs3org#/paths/~1notifications/post) to the sending server, with `notificationType` set to `"SHARE_ACCEPTED"` or `"SHARE_DECLINED"`. The sending server MAY expose this information to the end user.
43+
44+
### Share Deletion
45+
A `"SHARE_ACCEPTED"` notification followed by a `"SHARE_UNSHARED"` notification is
46+
equivalent to a `"SHARE_DECLINED"` notification.
47+
48+
### Share Updating
49+
TODO: document `"RESHARE_CHANGE_PERMISSION"`
50+
51+
### Resharing
52+
The `"REQUEST_RESHARE"` and `"RESHARE_UNDO"` notification types MAY be used by the
53+
receiving server to persuarde the sending server to share the same resource with another share recipient.
54+
TODO: document how receiver.com can know if sender.com understood and processed the
55+
reshare request.
56+
57+
### Invite
58+
If Alice (`alice at sender.com`) and Bob (`bob at receiver.com`) know each other, yet they may not have a mechanism to trust any received share request, as that may be similar to receiving spam.
59+
60+
In this case, Alice may invite Bob to initiate a mutual trust relationship: on the provider side, the `sender.com` service MAY implement an interface for Alice to generate a single-use token and send it to Bob off-band (e.g. via e-mail). In addition, the `sender.com` service MAY integrate this interface with [ScienceMesh](https://sciencemesh.io), and only allow a curated white list of sites as receivers.
61+
62+
On the receiving end, assuming that Bob wishes to accept the invitation, the receiving server MAY provide an interface for Bob to input the received token, or to interact with the ScienceMesh directory. In any case, the receiving server SHOULD make a HTTP POST request to the [/invite-accepted](https://cs3org.github.io/OCM-API/docs.html?branch=develop&repo=OCM-API&user=cs3org#/paths/~1invite-accepted/post) endpoint of the sending server, sending the token and disclosing Bob's identity details such as `bob at receiver.com`. If the token matches the one created earlier by Alice, the response MUST include Alice's identity details such as `alice at sender.com`.
63+
64+
Following this step, both services at `sender.com` and `receiver.com` MAY display, respectively, `bob` and `alice` as trusted or white-listed contacts, and enable sharing between them. Sites MAY enforce a policy to only accept shares between such trusted contacts, or MAY display a warning to users when a share from an unknown party is received.
65+
66+
For further details on this concept, see also [#54](https://github.com/cs3org/OCM-API/pull/54) and related issues. For a discussion about trust policies, see [sciencemesh#196](https://github.com/sciencemesh/sciencemesh/issues/196).
67+
68+
69+
## Contributing
2170

2271
The specification can be rendered as HTML documentation using [ReDoc](https://github.com/Redocly/redoc):
2372

2473
* [version 1.0](https://cs3org.github.io/OCM-API/docs.html?branch=v1.0.0&repo=OCM-API&user=cs3org#/paths/~1shares/post), current official and supported version
2574
* [develop branch](https://cs3org.github.io/OCM-API/docs.html?branch=develop&repo=OCM-API&user=cs3org), future version supported by ScienceMesh
2675

27-
## Contributing
2876

2977
The Open Cloud Mesh API specification is an open source, community-driven project. If you'd like to contribute, please follow the [Contributing Guidelines](CONTRIBUTING.md).
3078

0 commit comments

Comments
 (0)