Skip to content

update startCompute action #12

@MBadea17

Description

@MBadea17

Action startCompute is called by /initiateCompute endpoint of Ocean Node to check the access credentials of a specific consumer to a specific service of an asset. Currently, the action startCompute expects in the policyServer object information related to a single service, as shown below:

{
  "action": "startCompute",
  "serviceId": "ff294c2e2c7d01bd5f9701abc117737917bb1f91044ba6b2d0903fc806db0d65",
  "consumerAddress": "0xd727fb9be39fa019d7c02fea19e54d688da3a662",
  "policyServer": {
    "successRedirectUri": "",
    "sessionId": "",
    "errorRedirectUri": "",
    "responseRedirectUri": "",
    "presentationDefinitionUri": ""
  },
  "ddo": {...}
}

However, /initiateCompute will pass in the policyServer object information about all services used in the C2D job. The structure of the policyServer object passed by /initializeCompute will be:

{
    "policyServer": [
        { "documentId": "did1",
          "serviceId": "service1",    
          "successRedirectUri": "",
          "sessionId": "",
          "errorRedirectUri": "",
          "responseRedirectUri": "",
          "presentationDefinitionUri": ""
        },
         { "documentId": "did2",
          "serviceId": "service2",    
          "successRedirectUri": "",
          "sessionId": "",
          "errorRedirectUri": "",
          "responseRedirectUri": "",
          "presentationDefinitionUri": ""
        },
        ...
    ]
}

Therefore, the startCompute action needs to be updated as follows:

  1. read the documentId parameter from the request body. Here's the list of parameters sent by the node for the startCompute action.
    The request body will look like this:
{
  "action": "startCompute",
  "documentId": "did:ope:...."
  "serviceId": "ff294c2e2c7d01bd5f9701abc117737917bb1f91044ba6b2d0903fc806db0d65",
  "consumerAddress": "0xd727fb9be39fa019d7c02fea19e54d688da3a662",
  "policyServer": {
    "successRedirectUri": "",
    "sessionId": "",
    "errorRedirectUri": "",
    "responseRedirectUri": "",
    "presentationDefinitionUri": ""
  },
  "ddo": {...}
}
  1. from the list passed in the policyServer object, find the item corresponding to the documentId and serviceId passed in the request body;
  2. retrieve the data from this item;
  3. perform the existing credentials verification process using the retrieved data.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions