This project is an example of a single-page application (SPA) developed with Angular. Its primary purpose is to demonstrate two independent flows related to the issuance and exchange of verifiable credentials using standards such as OpenID4VCI and SIOPv2. The application displays two configurable QR codes that initiate these flows and can be scanned using the KayWallet application.
The frontend consists of two main components:
-
Melon University (
melon-university):
This component generates a QR code that initiates the flow for issuing a verifiable credential using OpenID4VCI. The QR code uses the value configured in theenvironmentfile under the keymelon_openid4vci_deeplink. -
Mango Corp (
mango-corp):
This component generates a QR code that initiates the flow for exchanging verifiable credentials using SIOPv2. The QR code uses the value configured in theenvironmentfile under the keyopenid_url. This value can contain the placeholder<current_uri>, which will be dynamically replaced with the current frontend URL when running in the browser.
Both components use a shared subcomponent called SectionQrComponent, which is responsible for generating and displaying the QR codes.
The QR codes generated by this application are designed to be scanned using KayWallet, an application that enables the management of self-sovereign digital identities and verifiable credentials. You can download KayWallet and learn more at https://kaytrust.id.
This project has a complementary backend repository called demo-acme-frutas-back, which implements the APIs necessary to support the issuance and exchange flows of verifiable credentials. You can find the backend repository at demo-acme-frutas-back.
- Purpose: Initiates the flow for issuing verifiable credentials.
- Configuration:
In theenvironment.tsorenvironment.development.tsfile, configure the keymelon_openid4vci_deeplinkwith the deeplink pointing to the credential offer endpoint.
Example:melon_openid4vci_deeplink: 'openid-credential-offer://?credential_offer_uri=https://example.com/issuer/credential-offer',
- Purpose: Initiates the flow for exchanging verifiable credentials.
- Configuration:
In theenvironment.tsorenvironment.development.tsfile, configure the keyopenid_urlwith the deeplink pointing to the credential exchange endpoint. This value can include<current_uri>, which will be replaced by the current frontend URL.
Example:openid_url: 'openid://?state=12345&redirect_uri=<current_uri>%2Foauth2%2Fcb%2FvpToken&response_mode=query&response_type=vp_token&client_id=<current_uri>%2Foauth&scope=openid',
- Node.js (version 16 or higher).
- Yarn as the package manager.
-
Clone this repository:
git clone https://github.com/KayTrust/demo-acme-frutas-front.git cd demo-acme-frutas-front -
Install the dependencies:
yarn install
-
Open the file
src/environments/environment.tsorsrc/environments/environment.development.tsand configure the values formelon_openid4vci_deeplinkandopenid_urlaccording to your needs. -
If you are running the project in a local environment, ensure that
environment.development.tshas the base URL of the local backend configured. For example:api_host: 'http://localhost:3000',
To start the development server, run:
yarn startThis will start the server at http://localhost:4200/. The application will automatically reload when changes are made to the source files.
To generate an optimized production build, run:
yarn buildThe generated files will be in the dist/demo-acme-frutas directory.
- Access the main page of the application (
http://localhost:4200/or the URL where it is deployed). - You will see two main sections:
- Melon University: Contains a QR code that initiates the flow for issuing verifiable credentials.
- Mango Corp: Contains a QR code that initiates the flow for exchanging verifiable credentials.
- Scan the corresponding QR code with the KayWallet application to start the flow.
src/app/pages/melon-university: Contains theMelonUniversityComponentthat generates the QR code for the issuance flow.src/app/pages/mango-corp: Contains theMangoCorpComponentthat generates the QR code for the exchange flow.src/app/components/section-qr: Reusable subcomponent that generates and displays the QR codes.src/environments: Contains the environment configuration files.
- Styles: Global styles are located in
src/styles.css. This project uses TailwindCSS and DaisyUI for styling. - Themes: You can customize themes in the
tailwind.config.jsfile.
- Framework: Angular 18.2.0
- State Management: Angular Signals.
- Styles: TailwindCSS and DaisyUI.
- QR Code Generation:
qrcodelibrary.
This project is open source. If you want to contribute, follow these steps:
- Fork the repository.
- Create a branch for your feature or bug fix:
git checkout -b feature/new-feature
- Make your changes and commit them:
git commit -m "Add new feature" - Push your changes to your fork:
git push origin feature/new-feature
- Create a Pull Request in the main repository.
This project is licensed under the MIT License. See the LICENSE file for more details.