Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[INJICERT-642] add dev & integrator docs #145

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

vharsh
Copy link
Member

@vharsh vharsh commented Dec 6, 2024

Topics:

  • add plugin docs
  • add local development & setup guide
  • add docs for hosting a DID document

Topics:
* add plugin docs
* add local development & setup guide
* add docs for hosting a DID document

Signed-off-by: Harsh Vardhan <[email protected]>
Copy link
Member

@vishwa-vyom vishwa-vyom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall the documents in the PR has come out well.
Good job @vharsh

multibase-script/multibase.py Show resolved Hide resolved
@@ -0,0 +1,101 @@
import os
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to move these 3 files under this folder inside the below document as code sections and ask user to create these as files and then run ?

Hosting-DID-Document.md

I know it will make it a little difficult for user, but currently we don't have a utils folder and we are introducing one with a python script (deviation from the current stack used in the repo) for this usecase. Which will become unnecessary in the next release of Inji certify, since we will be serving the DID document directly from Inji certify service.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hitesh and I had plans to dump some sample files and other scripts, schema-context.json examples, etc here. Should I move this to docs/multibase-script as this directory is supposed to just contain docs.

a little difficult for user,

I've added relative path links to this script, it'll be easy to find but slightly harder to maintain(if we remove the script later on).


## How to choose to implement either one?

- An integrator can choose to implement VCIssuancePlugin interface if they want to implement the VC Signing by themselves. This gives more power to the VC Plugin authors in choosing to support their own formats, signing algorithms which may or may not be supported by Certify.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has to come out little differently, we have to say if the implementor already has a VC generation system in place and wishes to use that and use the certify only for delivering the VC in OpenID4VCI way to the holder

Copy link
Member Author

@vharsh vharsh Dec 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changing it to...

  • An integrator can choose to implement VCIssuancePlugin interface if they want to implement the VC Signing by themselves or already have a working/existing VC Generation System. This gives more power to the VC Plugin authors in choosing to support their own formats, signing algorithms which may or may not be supported by Certify and only using the Certify for delivering the VC in an OpenID4VCI compatible way to open up to a wider ecosystem of clients which are also compatible with the standard.
  • There may be a case, where an integrator might want Certify to deal with fewer aspects of VCIssuance, in this case the implementors can choose to implement DataProviderPlugin interface and only implement the business logic required to fetch the data based on the claims object.
  • Both plugins can leave some aspects of the configuration to the Certify's configuration provider which can be a bunch of static config files or something such as Spring Config Server.

docs/VCIssuance-vs-DataProvider.md Show resolved Hide resolved
| VC Signing | managed by the plugin itself | done by Inji Certify itself |
| Credential Creation | done by the plugin itself | done by plugin itself |
| Signing key management | can be done by plugin or delegated to keymanager lib | done by Inji Certify end-to-end via keymanager |
| VC Issuance | done by the plugin completely | data is given by the plugin, VC issuance is done by Inji Certify |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this table to be little more simplified. what is the VC signing vs credential creation ?
Also, is it not implicitly understood that whoever is doing the VC signing will maintain the signing keys ?

- Docker and Docker Compose installed on your system
- Git (to clone the repository)
- Basic understanding of Docker and container operations
- Relevant Postman collections are [here](../../docs/postman-collections/), please add the `mock` ones and install the [pmlib library](https://joolfe.github.io/postman-util-lib/) as per the rules given under the heading `Postman Collection`.

### Building inji-web-proxy
Before running the docker-compose, you need to build the inji-web-proxy image:

```bash
# Clone the repository
git clone https://github.com/mosip/inji-web.git -b release-0.11.x
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check the status on this with Inji web team, since they may move away from using the proxy project to nginx config and this step might not work
https://mosip.atlassian.net/browse/INJIWEB-1213

@@ -0,0 +1,131 @@
# Creating a DID Document
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see link in the docker compose readme file to this document

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added a link to this file from the docker compose README.md

# Build the Docker image
docker build -t inji-web-proxy:local .
```

## Directory Structure Setup

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Ensure all configuration files are properly updated in the config directory" - this is very level for someone to just try out a usecase using docker componse.
Can we give specific configuration they have to change ?
Like the mosip.certify.issuer.uri and mosip.certify.issuer.pub.key for example, since this needs to be changed once the did document setup is done.

# Build the Docker image
docker build -t inji-web-proxy:local .
```

## Directory Structure Setup

Create the following directory structure before proceeding:

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change the below property file, since we don't want to point default to hitesh github file for csv changes.
mosip.certify.plugin.csv.file.uri=/home/mosip/config/farmer_identity_data.csv

Copy link
Member

@vishwa-vyom vishwa-vyom Dec 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Below changes in docker compose are required for this.
volumes:
- ./config/certify-default.properties:/home/mosip/config/certify-default.properties
- ./config/certify-mock-identity.properties:/home/mosip/config/certify-mock-identity.properties
- ./config/farmer_identity_data.csv:/home/mosip/config/farmer_identity_data.csv
- ./data/CERTIFY_PKCS12:/home/mosip/CERTIFY_PKCS12
- ./loader_path/certify/:/home/mosip/additional_jars/

# Build the Docker image
docker build -t inji-web-proxy:local .
```

## Directory Structure Setup

Create the following directory structure before proceeding:

```
Copy link
Member

@vishwa-vyom vishwa-vyom Dec 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have a CSV file along with photo, so the VC is created with photo
This means the context file, template all should have the photo also.
The default context file and did keys use the mosip-config github pages onces

### Building inji-web-proxy
Before running the docker-compose, you need to build the inji-web-proxy image:

```bash
# Clone the repository
git clone https://github.com/mosip/inji-web.git -b release-0.11.x
cd inji-web/inji-web-proxy
```
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

password config update step is missing for using the oidckeystore.p12 file of collab.
mosip.oidc.p12.password=


```bash
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nginx port uses 80, which is generally tough to be allowed in developer machines. please change to 8081 in the docker compose file.

container_name: nginx
image: nginx:alpine
ports:
- '8081:80'


```bash
# Build the Docker image
docker build -t inji-web-proxy:local .
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use case in the docker compose is Farmer, but the mimoto config file below calls out as Mock which need to be changed correctly.
docker-compose/docker-compose-injistack/config/mimoto-issuers-config.json

Copy link
Member

@vishwa-vyom vishwa-vyom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Above latest comments added based on my experience of using the current docker compose for country delegation demo preparation.

@bernard42
Copy link

Running Certify in IntelliJ produces the error below

{"@timestamp":"2024-12-16T08:44:16.493+02:00","@Version":"1","message":"Fetching config from server at : http://localhost:8888","logger_name":"org.springframework.cloud.config.client.ConfigServicePropertySourceLocator","thread_name":"main","level":"INFO","level_value":20000,"appName":"certify,certify-plugin"}
{"@timestamp":"2024-12-16T08:44:16.610+02:00","@Version":"1","message":"Exception on Url - http://localhost:8888:org.springframework.web.client.ResourceAccessException: I/O error on GET request for "http://localhost:8888/certify,certify-plugin/local\": Connection refused: getsockopt. Will be trying the next url if available","logger_name":"org.springframework.cloud.config.client.ConfigServicePropertySourceLocator","thread_name":"main","level":"INFO","level_value":20000,"appName":"certify,certify-plugin"}
{"@timestamp":"2024-12-16T08:44:16.610+02:00","@Version":"1","message":"Could not locate PropertySource: I/O error on GET request for "http://localhost:8888/certify,certify-plugin/local\": Connection refused: getsockopt","logger_name":"org.springframework.cloud.config.client.ConfigServicePropertySourceLocator","thread_name":"main","level":"WARN","level_value":30000,"appName":"certify,certify-plugin"}
{"@timestamp":"2024-12-16T08:44:16.621+02:00","@Version":"1","message":"The following 1 profile is active: "local"","logger_name":"io.mosip.certify.CertifyServiceApplication","thread_name":"main","level":"INFO","level_value":20000,"appName":"certify,certify-plugin"}
{"@timestamp":"2024-12-16T08:44:16.857+02:00","@Version":"1","message":"Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanDefinitionStoreException: Failed to parse configuration class [io.mosip.certify.CertifyServiceApplication]","logger_name":"org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext","thread_name":"main","level":"WARN","level_value":30000,"appName":"certify,certify-plugin"}
{"@timestamp":"2024-12-16T08:44:16.857+02:00","@Version":"1","message":"\r\n\r\nError starting ApplicationContext. To display the condition evaluation report re-run your application with 'debug' enabled.","logger_name":"org.springframework.boot.autoconfigure.logging.ConditionEvaluationReportLogger","thread_name":"main","level":"INFO","level_value":20000,"appName":"certify,certify-plugin"}
{"@timestamp":"2024-12-16T08:44:16.893+02:00","@Version":"1","message":"Application run failed","logger_name":"org.springframework.boot.SpringApplication","thread_name":"main","level":"ERROR","level_value":40000,"stack_trace":"org.springframework.beans.factory.BeanDefinitionStoreException: Failed to parse configuration class [io.mosip.certify.CertifyServiceApplication]\r\n\tat org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:179)\r\n\tat org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:416)\r\n\tat org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:289)\r\n\tat org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:349)\r\n\tat org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:118)\r\n\tat org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:788)\r\n\tat org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:606)\r\n\tat org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146)\r\n\tat org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754)\r\n\tat org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:456)\r\n\tat org.springframework.boot.SpringApplication.run(SpringApplication.java:334)\r\n\tat org.springframework.boot.SpringApplication.run(SpringApplication.java:1354)\r\n\tat org.springframework.boot.SpringApplication.run(SpringApplication.java:1343)\r\n\tat io.mosip.certify.CertifyServiceApplication.main(CertifyServiceApplication.java:37)\r\nCaused by: org.springframework.context.annotation.ConflictingBeanDefinitionException: Annotation-specified bean name 'loggerAuditService' for bean class [io.mosip.certify.plugin.impl.LoggerAuditService] conflicts with existing, non-compatible bean definition of same name and class [io.mosip.certify.impl.LoggerAuditService]\r\n\tat org.springframework.context.annotation.ClassPathBeanDefinitionScanner.checkCandidate(ClassPathBeanDefinitionScanner.java:361)\r\n\tat org.springframework.context.annotation.ClassPathBeanDefinitionScanner.doScan(ClassPathBeanDefinitionScanner.java:288)\r\n\tat org.springframework.context.annotation.ComponentScanAnnotationParser.parse(ComponentScanAnnotationParser.java:128)\r\n\tat org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:306)\r\n\tat org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:246)\r\n\tat org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:197)\r\n\tat org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:165)\r\n\t... 13 common frames omitted\r\n","appName":"certify,certify-plugin"}

Process finished with exit code 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants