Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[rest] Add create-offer endpoint for credentials #156

Closed
5 tasks
TimoGlastra opened this issue Sep 2, 2022 · 5 comments
Closed
5 tasks

[rest] Add create-offer endpoint for credentials #156

TimoGlastra opened this issue Sep 2, 2022 · 5 comments

Comments

@TimoGlastra
Copy link
Contributor

TimoGlastra commented Sep 2, 2022

Should work with the oob create invitation and oob create legacy invitation endpoints

The current API doesn't provide a create-offer endpoint. The create-offer allows to send a credential without first creating a connection. The flow for creating a credential offer is as follows:

  1. Create credential offer by calling /credentials/create-offer. The API for this should exactly match the send-offer API endpoint, EXCEPT for the connectionId, this can be left out. This method should intenrally call create-offer and return the message + record.
  2. Call /oob/create-invitation and provide the returned message in the messages array.
    2.b (alternative) Call /oob/create-legacy-connectionless-invitation and provide the recordId + message + domain

This invitation / invitation url can then be used by agent to receive a credential without first creating a connection.

Endpoint:

POST /credentials/create-offer

Input: input from send-offer without connectionId

Output:

{
  "message": <json message>,
  "record": <json of record>
}

You can get the json of the message / record by calling toJSON() on them.

Checlist:

  • Create create-offer endpoint
  • Add tests for the create-offer endpoint in credential.test.ts
  • Also add a test by first calling create-offer and then oob/create-invitation
  • Also add a test by first calling create-offer and then oob/create-legacy-connectionless-invitation
  • Make sure the endpoint shows up with the correct input/output documentation in the swagger ui
@jimezesinachi
Copy link
Contributor

For the 3rd item in the checklist, would that be a test for the createOffer and createInvitation endpoints, or the methods (functions)?

@TimoGlastra
Copy link
Contributor Author

The endpoints. The methods have been tested as part of AFJ, so this test is mostly to assure the encoding between json and data classes works correctly when calling these endpoints

@jimezesinachi
Copy link
Contributor

Got it

@jimezesinachi
Copy link
Contributor

jimezesinachi commented Sep 15, 2022

Also if I use the createInvitation method for the create-offer endpoint, there would be no need for the create-legacy-connectionless-invitation test, correct?

@TimoGlastra
Copy link
Contributor Author

Also if I use the createInvitation method for the create-offer endpoint, there would be no need for the create-legacy-connectionless-invitation test, correct?

See my comment on the PR. We don't want to call create invitation from the create offer endpoint. This is two separate steps
For the user

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants