diff --git a/developers/provider/authentication-endpoints.md b/developers/provider/authentication-endpoints.md index cb5ba6dc..6f1c637d 100644 --- a/developers/provider/authentication-endpoints.md +++ b/developers/provider/authentication-endpoints.md @@ -1,9 +1,11 @@ # Authentication Endpoints -Provider offers an alternative to signing each request, by allowing users to generate auth tokens. The generated auth token can be used until its expiration in all supported requests. Simply omit the signature parameter and add the AuthToken request header based on a created token. +Provider offers an alternative to signing each request, by allowing users to generate auth tokens. The generated auth token can be used until its expiration in all supported requests. Simply omit the signature parameter and add the AuthToken request header based on a created token. Please note that if a signature parameter exists, it will take precedence over the AuthToken headers. All routes that support a signature parameter support the replacement, with the exception of auth-related ones (createAuthToken and deleteAuthToken need to be signed). +### Create Auth Token + #### GET /api/services/createAuthToken Allows the user to create an auth token. @@ -35,6 +37,8 @@ Response: {"token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE2NjAwNTMxMjksImFkZHJlc3MiOiIweEE3OGRlYjJGYTc5NDYzOTQ1QzI0Nzk5MTA3NUUyYTBlOThCYTdBMDkifQ.QaRqYeSYxZpnFayzPmUkj8TORHHJ_vRY-GL88ZBFM0o"} ``` +#### Delete Auth Token + #### DELETE /api/services/deleteAuthToken Allows the user to delete an existing auth token before it naturally expires. diff --git a/developers/provider/encryption-decryption.md b/developers/provider/encryption-decryption.md index 79a4b930..f43b692c 100644 --- a/developers/provider/encryption-decryption.md +++ b/developers/provider/encryption-decryption.md @@ -29,61 +29,6 @@ console.log(response) ``` -#### GET /api/services/initialize - -Parameters - -``` - documentId: String object containing document id (e.g. a DID) - serviceId: String, ID of the service the datatoken is attached to - consumerAddress: String object containing consumer's address - environment: String representing a compute environment offered by the provider - validUntil: Integer, date of validity of the service (optional) - fileIndex: Integer, the index of the file from the files list in the dataset. If set, provider will validate the file access. (optional) -``` - -Returns: Json document with a quote for amount of tokens to transfer to the provider account. - -Example: - -``` -GET /api/services/initialize -payload: -{ - "documentId":"0x1111", - "serviceId": 0, - "consumerAddress":"0x990922334", -} -payload (with optional parameters): -{ - "documentId":"0x1111", - "serviceId": 0, - "consumerAddress":"0x990922334", - "validUntil": 1578004800, - "fileIndex": 1 -} -``` - -Response: - -```json -{ - "datatoken": "0x21fa3ea32892091...", - "nonce": 23, - "providerFee": { - "providerFeeAddress": "0xabc123...", - "providerFeeToken": "0xabc123...", - "providerFeeAmount": "200", - "providerData": "0xabc123...", - "v": 27, - "r": "0xabc123...", - "s": "0xabc123...", - "validUntil": 123456, - }, - "computeAddress": "0x8123jdf8sdsa..." -} -``` - ### Decrypt endpoint * **Endpoint**: `POST /api/services/decrypt` diff --git a/developers/provider/general-endpoints.md b/developers/provider/general-endpoints.md index 23a8c6aa..9b71e6c5 100644 --- a/developers/provider/general-endpoints.md +++ b/developers/provider/general-endpoints.md @@ -73,3 +73,37 @@ Example response: * **Purpose**: This endpoint is used to retrieve the attached asset files. It returns a file stream of the requested file. * **Responses**: * **200**: This is a successful HTTP response code. It means the server has successfully processed the request and returned the file stream. + +### Initialize + +* **Endpoint**: `GET /api/services/initialize` +* **Parameters**: The query parameters for this endpoint should contain the following properties: + * `documentId`: A string containing the document id (e.g., a DID). + * `serviceId`: A string representing the ID of the service the data token is attached to. + * `consumerAddress`: A string containing the consumer's Ethereum address. + * `environment`: A string representing a compute environment offered by the provider. + * `validUntil`: An integer representing the date of validity of the service (optional). + * `fileIndex`: An integer representing the index of the file from the files list in the dataset. If set, the provider will validate the file access (optional). +* **Purpose**: This endpoint is used to initialize a service and return a quote for the number of tokens to transfer to the provider's account. +* **Responses**: + * **200**: This is a successful HTTP response code. It returns a JSON object containing information about the quote for tokens to be transferred. + +Example response: + +```json +{ + "datatoken": "0x21fa3ea32892091...", + "nonce": 23, + "providerFee": { + "providerFeeAddress": "0xabc123...", + "providerFeeToken": "0xabc123...", + "providerFeeAmount": "200", + "providerData": "0xabc123...", + "v": 27, + "r": "0xabc123...", + "s": "0xabc123...", + "validUntil": 123456, + }, + "computeAddress": "0x8123jdf8sdsa..." +} +```