# eSignet Client Creation

This document provides instructions on eSignet client creation.

## Prerequisites

* Keycloak Client is created for eSignet. The `esignet_admin_access` client scope is assigned as a default scope. [More info>>](https://github.com/OpenG2P/openg2p-deployment/tree/main/kubernetes/esignet#post-installation)

## Procedure

1. Create a private key public key JWK pair. (<https://mkjwk.org> can be used).
2. Create an eSignet OIDC client using the following API. (Replace parameters with appropriate values in the below API)

   ```bash
   token=$(curl -s https://<keycloak hostname>/realms/master/protocol/openid-connect/token -d "client_id=<esignet keycloak client id>" -d "client_secret=<esignet keycloak client secret>" -d "grant_type=client_credentials" | jq -r '.access_token');
   curl -v -s -H "Authorization: Bearer ${token}" -H "content-type: application/json" https://<esignet hostname>/v1/esignet/client-mgmt/oauth-client -d '{
     "requestTime": "'$(date -u "+%Y-%m-%dT%T.%3NZ")'",
     "request": {
       "clientId": "<OIDC Client ID>",
       "clientName": "<OIDC Client Name>",
       "publicKey": <Public Key JWK>,
       "relyingPartyId": "<relying party id. (For OpenG2P related clients, give openg2p-auth-partner)>",
       "userClaims": [
         "birthdate","address","gender","name","phone_number","picture","email", "individual_id"
       ],
       "authContextRefs": [
         "mosip:idp:acr:biometrics","mosip:idp:acr:generated-code","mosip:idp:acr:linked-wallet"
       ],
       "logoUri": "<logo URL to be displayed on UI>",
       "redirectUris": [
         "<redirect URI List>"
       ],
       "grantTypes": [
         "authorization_code"
       ],
       "clientAuthMethods": [
         "private_key_jwt"
       ],
       "clientNameLangMap": {
         "eng": "<OIDC Client Name>"
       }
     }
   }'
   ```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.openg2p.org/1.3/social-registry/features/id-integration/id-authentication/user-guides/esignet-client-creation.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
