Enable login with Indy Verifiable Credential
Make two new HTTP endpoints to support experimental login flow with Indy Verifiable Credential.
The endpoint will accept presentationId
and will repeatedly poll the OCM for the status of the presentation. If the OCM return that a presentation has been accepted and a connection between OCM and PCM is established, the login service will get the user email from the OCM response and will prepare a signed JWT token which it must give back to the front-end client application.
This is just for experimentation and PoC and is not in any way to be used for login in production systems.
Endpoint to start the login with presentationId:
POST /v1/login-vc
{
"presentationId":"EXAMPLEID"
}
Endpoint to poll for login result:
GET /v1/login-vc?presentationId=EXAMPLEID
Login service polling
The login service is polling the OCM for login result with GET request:
GET https://ssi-dev.vereign.com/ocm/proof/v1/find-by-presentation-id?presentationId=EXAMPLEID
If the PCM has not yet scanned the login proof invitation, the response will be similar to:
{
"statusCode": 200,
"message": "Proof presentation fetch successfully",
"data": {
"state": "request-sent",
"presentations": [
{
"schemaId": "",
"credDefId": "",
"revRegId": "",
"timestamp": "",
"credentialSubject": {}
}
]
}
}
When the PCM scans the QRCode and login is accepted, the result will change to:
{
"statusCode": 200,
"message": "Proof presentation fetch successfully",
"data": {
"state": "done",
"presentations": [
{
"schemaId": "7KuDTpQh:EXAMPLE",
"credDefId": "7KuDTpQh3G:EXAMPLE",
"revRegId": null,
"timestamp": null,
"credentialSubject": {
"email": "EXAMPLE",
}
}
]
}
}
From there the email should be taken and a JWT can be created with it.