Login with a Credential

Login with a Credential

💡

To see other tutorials and examples about this subject, check out the verifying examples section.

This workflow showcases an example workflow that requests a presentation of an issued employe badge, but only based on their accessLevel. For this we will use the following features:

This example builds on top of the Issue an Employee Badge example workflow, and must be completed before this workflow can be used.

The following actions are used in this example workflow:

Create the credential template and issue the employee badge

Follow the Issue an Employee Badge workflow to create the credential template and issue the employee badge. Make sure to note down the credential definition ID, and the connection ID.

Create the login with employee badge workflow

Create a new workflow in Paradym and save it with the following content. Make sure to replace <YOUR_CREDENTIAL_DEFINITION_ID> with the credential definition ID of your credential template, and publish the workflow afterwards.

YAML
name: Login with employee badge
 
# Workflow is triggered by API Call from your client
trigger:
  type: api
 
# The connection identifier from the user is used to send the presentation request
input:
  type: 'object'
  properties:
    connectionId:
      title: Connection Id
      type: string
  required:
    - connectionId
 
actions:
  # Requests the property 'Access Level' from the issued employee badge
  - id: requestCredential
    name: didcomm/requestPresentation@v1
    attributes:
      connectionId: $.input.connectionId
      anoncreds:
        name: 'Access Level Request'
        version: '1.0.0'
        attributes:
          - names:
              - Access Level
            restrictions:
              - credentialDefinitionId: <YOUR_CREDENTIAL_DEFINITION_ID>
 
  # Verify access level is 3, 4 or 5
  - id: verifyAccessLevel
    name: general/validateJson@v1
    attributes:
      data: $.actions.requestCredential.output.presentationExchange.anoncreds.presentation.attributes[0].value
      schema:
        type: object
        properties:
          Access Level:
            type: string
            enum:
              - '3'
              - '4'
              - '5'
        required:
          - Access Level
        additionalProperties: true

Manually execute the workflow

Next, we'll execute the workflow though the UI

Follow the steps for executing a workflow manually. The connection ID should be provided based on the outputted connectionId from the issue employee badge workflow.

Accept presentation request in the Paradym Wallet

You should now have received a message in your inbox in the Paradym Wallet. Click on the inbox icon in the top right corner, then click on the notification with "Access Level Request", and finally click "Accept" to accept the presentation request.

Done!

The worfklow should have reached a completed state, and you can now be sure that the access level of your employee is correct.

Other Verifying examples