This is a reference app generated by Affinidi CLI tool with Java and Springboot framework
- 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
- Ensure that your JAVA_HOME environment variable is set to the installation directory
export JAVA_HOME="/usr/local/opt/openjdk"
- Optionally you can add this entry to your respective profile (~/.bashrc or ~/.zshrc)
Setting up the reference app is easy, just follow these steps:
- Install the dependencies
sh mvnw clean
sh mvnw install
- Update application environment variables
Create a .env file for your application to hold environment variables
cp .env.example .env
-
Click here to Set up your environment variables for Affinidi Login configuration
-
Click here to Set up your Personnel Access Token to interact with Affinidi services
-
Click here to Set up your Credential Issuance Configuration
sh mvnw spring-boot:run
Then visit: http://localhost:8080/ to browse the reference app
-
Follow this guide to set up your login configuration with callback URL as
http://localhost:8080/login/oauth2/code/javademo
-
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>"
Follow this guide to set up your Personnel Access Token
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
-
Go to Affinidi Portal.
-
Open
Wallets
menu under theTools
section and click onCreate Wallet
with any name (e.g.MyWallet
) and DID method asdid:key
.
For more information, refer to the Wallets documentation
-
Go to
Credential Issuance Service
underServices
section. -
Click on
Create Configuration
and set the following fields:Issuing Wallet
: Select Wallet Created previous stepLifetime of Credential Offer
as600
-
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