Skip to content

Affinidi-Grajesh/java-springboot-iota

 
 

Repository files navigation

Introduction

This is a reference app generated by Affinidi CLI tool with Java and Springboot framework

Prerequisite

  1. Make sure you have JAVA 21 installed on your machine. Run the following command in a terminal session to check the java version
   java --version 

You should get an output as below. If not, please reinstall java21 using the link above

openjdk 21.0.2 2024-01-16
  1. Ensure that your JAVA_HOME environment variable is set to the installation directory
export JAVA_HOME="/usr/local/opt/openjdk"
  1. Optionally you can add this entry to your respective profile (~/.bashrc or ~/.zshrc)

Getting Started

Setting up the reference app is easy, just follow these steps:

  1. Install the dependencies
sh mvnw clean
sh mvnw install
  1. Update application environment variables

Create a .env file for your application to hold environment variables

cp .env.example .env
  1. Click here to Set up your environment variables for Affinidi Login configuration

  2. Click here to Set up your Personnel Access Token to interact with Affinidi services

  3. Click here to Set up your Credential Issuance Configuration

Build and run the project:

sh mvnw spring-boot:run

Then visit: http://localhost:8080/ to browse the reference app

Set up your Affinidi Login configuration

  1. Follow this guide to set up your login configuration with callback URL as http://localhost:8080/login/oauth2/code/javademo

  2. Copy your Client ID, Client Secret and Issuer from your login configuration and paste them into your .env file:

PROVIDER_CLIENT_ID="<CLIENT_ID>"
PROVIDER_CLIENT_SECRET="<CLIENT_SECRET>"
PROVIDER_ISSUER="<ISSUER>"

Setup Personal Access Token

Follow this guide to set up your Personnel Access Token

Setup Credential Issuance Configuration

To issue a Verifiable Credential, it is required to setup the Issuance Configuration on your project, where you select the issuing wallet and supported schemas to create a credential offer that the application issue

You can easily do this using the Affinidi Portal

  1. Go to Affinidi Portal.

  2. Open Wallets menu under the Tools section and click on Create Wallet with any name (e.g. MyWallet) and DID method as did:key. alt text

For more information, refer to the Wallets documentation

  1. Go to Credential Issuance Service under Services section.

  2. Click on Create Configuration and set the following fields:

    Issuing Wallet: Select Wallet Created previous step Lifetime of Credential Offer as 600

  3. Add schemas by clicking on "Add new item" under Supported Schemas

Schema 1 :

  • Schema as Manual Input,
  • Credential Type ID as InsuranceRegistration
  • JSON Schema URL as https://schema.affinidi.io/TtestschemaIsusdfsfsfdV1R0.json
  • JSDON-LD Context URL = https://schema.affinidi.io/TtestschemaIsusdfsfsfdV1R0.jsonld

Sample Configuration alt text

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • HTML 53.7%
  • Java 46.3%