ida-client-demo
v1.0.2
Published
Demo application for IDA Client Service
Readme
IDA Client Demo Application
This is a demo Express.js application that demonstrates how to use the IDA Client Service library.
Setup
Install dependencies:
npm installCreate a
.envfile: Copy the example below and create a.envfile in thedemodirectory with your configuration:# IDA Client Service Configuration # Application Settings SPRING_APPLICATION_NAME=ida SERVER_PORT=8088 DEBUG=false IDA_ENCODING_URLSAFE=true # Fayda Partner Configuration FAYDA_PARTNER_ID=mpartner-tech5-lora FAYDA_BASE_URL=https://api-internal.oracle1.fayda.et FAYDA_ENV=Staging # Authentication Credentials CLIENT_ID=mosip-regproc-client SECRET_KEY=hY98OcJIkskFb2yD APP_ID=regproc IDA_REFERENCE_ID=PARTNER MISP_LICENSE_KEY=jq8Ta9gRaETEpbBiaOipDDylI0rA5JfhAfirZxFANw2Wj4cQ6n PARTNER_ID=mpartner-tech5-lora PARTNER_API_KEY=630756 # Certificate and Key Paths # Note: Use forward slashes or escaped backslashes for Windows paths PARTNER_P12_CERTIFICATE=C:\\Users\\amanu\\Documents\\nidp\\ida-client-service\\keys\\mpartner-tech5-lora-partner.p12 PARTNER_P12_CERTIFICATE_KEY_ALIAS=keyAlias PARTNER_P12_CERTIFICATE_KEY_PASSWORD=qwerty@123 PARTNER_PUBLIC_KEY_CERTIFICATE=C:\\Users\\amanu\\Documents\\nidp\\ida-client-service\\keys\\mpartner-tech5-lora-partner.cer # P12 Configuration P12_PASSWORD=qwerty@123 P12_PATH=C:\\Users\\amanu\\Documents\\nidp\\ida-client-service\\keys # API URLs (with placeholders that will be resolved automatically) IDA_OTP_URL=${FAYDA_BASE_URL}/idauthentication/v1/otp/${MISP_LICENSE_KEY}/${PARTNER_ID}/${PARTNER_API_KEY} IDA_AUTH_URL=${FAYDA_BASE_URL}/idauthentication/v1/auth/${MISP_LICENSE_KEY}/${PARTNER_ID}/${PARTNER_API_KEY} IDA_EKYC_URL=${FAYDA_BASE_URL}/idauthentication/v1/kyc/${MISP_LICENSE_KEY}/${PARTNER_ID}/${PARTNER_API_KEY} IDA_CERTIFICATE_URL=${FAYDA_BASE_URL}/idauthentication/v1/internal/getCertificate IDA_AUTHMANAGER_URL=${FAYDA_BASE_URL}/v1/authmanager/authenticate/clientidsecretkey IDA_INTERNAL_JWT_SIGN_URL=${FAYDA_BASE_URL}/idauthentication/v1/internal/jwtSign # SSL Configuration IDA_SSL_VERIFY=falseNote: The configuration loader supports both formats:
- Uppercase with underscores:
FAYDA_BASE_URL - Original format:
fayda.base.url - Placeholders in URLs (e.g.,
${FAYDA_BASE_URL}) are automatically resolved
- Uppercase with underscores:
Build the project:
npm run buildStart the server:
npm startThe server will start on port 8088 (or the port specified in your
.envfile).
API Endpoints
Request OTP
POST http://localhost:8088/otp/:individualIdExample:
curl -X POST http://localhost:8088/otp/1234567890Note: The demo uses FAN as the ID type, which is automatically converted to VID by the SDK.
Authenticate
POST http://localhost:8088/auth/:individualId/:otpExample:
curl -X POST http://localhost:8088/auth/1234567890/111111Note: The demo uses FAN as the ID type, which is automatically converted to VID by the SDK.
eKYC
POST http://localhost:8088/ekyc/:individualId/:otpExample:
curl -X POST http://localhost:8088/ekyc/1234567890/111111Note: The demo uses FIN as the ID type, which is automatically converted to UIN by the SDK.
ID Type Mapping
The SDK automatically maps client-friendly ID types:
- FAN → VID (Virtual ID)
- FIN → UIN (Unique Identification Number)
- VID and UIN are passed through as-is
This mapping is case-insensitive and happens automatically.
Configuration
The demo application loads configuration from a .env file using the dotenv package. All configuration values are loaded as environment variables and then mapped to the IDA Client configuration format.
Environment Variable Format
You can use either format in your .env file:
Uppercase with underscores (recommended):
FAYDA_BASE_URL=https://api-internal.oracle1.fayda.et CLIENT_ID=mosip-regproc-clientOriginal property format:
fayda.base.url=https://api-internal.oracle1.fayda.et clientId=mosip-regproc-client
Placeholder Resolution
URLs can use placeholders that reference other environment variables:
FAYDA_BASE_URL=https://api-internal.oracle1.fayda.et
IDA_OTP_URL=${FAYDA_BASE_URL}/idauthentication/v1/otp/${MISP_LICENSE_KEY}/${PARTNER_ID}/${PARTNER_API_KEY}The placeholders will be automatically resolved when the configuration is loaded.
Development
To run in development mode with auto-reload:
npm run devNote: This requires ts-node to be installed.
