Socket
Book a DemoInstallSign in
Socket

@pm4ml/connection-manager-api

Package Overview
Dependencies
Maintainers
0
Versions
60
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pm4ml/connection-manager-api

ModusBox Connection Manager API

2.14.1
latest
npmnpm
Version published
Weekly downloads
113
841.67%
Maintainers
0
Weekly downloads
 
Created
Source

Connection Manager API

Release

Connection Manager API is a component of the Mojaloop ecosystem that allows an administrator to manage the network configuration and PKI information for the Hub and a set of DFSPs.

It provides a REST API, described using a Swagger/OpenAPI document.

The current version uses both cfssl and openssl as the PKI engines which issue and process CSRs and Certificates. The specific version of cfssl that MCM depends on is kept in the Dockerfile as the value of the branch argument ( as in --branch=v1.3.4 ) and can also be specified as an environment variable ( see CFSSL_VERSION below ).

The API servers uses OAuth2 to implement security, as defined in the OAuth2 implementation doc

Running the server locally

To run the server with all the defaults and no security, the simplest way is to run:

P12_PASS_PHRASE="choose your own password" npm start

The default config requires a mysql db running on the default port.

Once running, you can access the Swagger UI interface

Running the server + db + web UI locally while developing

The API server requires a mysql db. There's also a Web UI https://github.com/modusbox/connection-manager-ui.

To run them together, you can use the following setup:

  • Clone this repo and the Web UI repo at the same level
  • Use the docker-compose config in this repo to run a mysql DB, the WebUI and the API server
mkdir modusbox
cd modusbox
git clone https://github.com/modusbox/connection-manager-ui
git clone https://github.com/modusbox/connection-manager-api
cd connection-manager-api/docker
docker-compose build
docker-compose up

Once the docker containers are confirmed to be stable and up, you will need to create the initial HUB environment. From a new terminal session, execute the following;

curl -X POST "http://localhost:3001/api/environments" -H "accept: application/json" -H "Content-Type: application/json" -d "{ \"name\": \"DEV\", \"defaultDN\": { \"CN\": \"tes1.centralhub.modusbox.live\", \"O\": \"Modusbox\", \"OU\": \"MCM\" }}"

The UI 'localhost' can now be opened in your local browser.

If you want to start the app with auth enabled:

  • create a local copy of docker-compose-auth.yml as in:

cp docker-compose-auth.yml docker-compose-auth.local.yml

( docker-compose-auth.local.yml is git-ignored )

  • Edit docker-compose-auth.local.yml and enter the security details.

  • Run the bundle with:

docker-compose build && docker-compose -f docker-compose.yml -f docker-compose-auth.local.yml up

Configuration

There's a Constants.js file that pulls the values from the environment or uses defaults if not defined.

Variables:

Environment variableDescriptionDefault Value
MCM API server configuration
PORTmcm API HTTP port3001
Authentication features
AUTH_ENABLEDEnables support for OAuth2. 'TRUE' to enable(disabled)
AUTH_2FA_ENABLEDEnables two-factor authentication 'TRUE' to enable(disabled)
OAuth2 roles
MTA_ROLEDFSP Admin role'Application/MTA'
PTA_ROLEHUB Admin Role'Application/PTA'
EVERYONE_ROLEAuthenticated users role'Internal/everyone'
WSO2 OAuth Service Provider configuration
APP_OAUTH_CLIENT_KEYOAuth2 Client Key. Configured in WSO2 IM Service Provider
APP_OAUTH_CLIENT_SECRETOAuth2 Client Secret. Configured in WSO2 IM Service Provider
CERTIFICATE_FILE_NAMEWSO2 Service Provider Public Certificate filename. If the value starts with / it will be read as an absolute path, otherwise as a relative path to the app dir'resources/wso2carbon-publickey.cert'
EMBEDDED_CERTIFICATEWSO2 Service Provider Public Certificate PEM-encoded string. This one has priority over the previous var
WSO2 OAuth server configuration
OAUTH2_ISSUEROAuth token issuer endpoint. This service will connect to this endpoint to request the JWTshttps://WSO2_IM_SERVER:9443/oauth2/token
OAUTH2_TOKEN_ISSJWTs have an iss property. This property is usually the same as the endpoint (OAUTH2_ISSUER), but it may differ for example if there's an HTTP gateway with a different endpoint in between. You can use OAUTH2_TOKEN_ISS to specify the expected value of the iss property. This service validates that the value of the iss property on the JWT it receives on the API calls either is equal to either OAUTH2_ISSUER or OAUTH2_TOKEN_ISS; if there's no match then authentication will fail with a 401.
Database configuration
DATABASE_HOSTmysql hostlocalhost
DATABASE_PORTmysql port3306
DATABASE_USERmysql usermcm
DATABASE_PASSWORDmysql passwordmcm
DATABASE_SCHEMAmysql schemamcm
DATABASE_SSL_ENABLEDEnable SSL for MySQL connectionfalse
DATABASE_SSL_VERIFYVerify server certificate when using SSLfalse
DATABASE_SSL_CACA certificate string for MySQL SSL''
DB_RETRIESTimes the initial connection to the DB will be retried10,
DB_CONNECTION_RETRY_WAIT_MILLISECONDSPause between retries5000,
RUN_MIGRATIONSIf true, run db schema migration at startup. Can always be true as the schema creation is idempotenttrue,
CURRENCY_CODESPath to file containing all the supported currency codes'./data/currencyCodes.json',
DATA_CONFIGURATION_FILEInitial data configuration path. See specific doc'./data/sampleConfiguration.json'
WSO2 custom services configuration
TOTP_ADMIN_ISSUERURL of TOTP Admin (WSO2)
TOTP_ADMIN_AUTH_USERuser of TOTP Admin
TOTP_ADMIN_AUTH_PASSWORDpass of TOTP Admin
TOTP_LABELa label to be shown with 2FA
TOTP_ISSUERa issuer to be shown with 2FAMCM
WSO2_MANAGER_SERVICE_URLURL of WSO2 Manager Service
WSO2_MANAGER_SERVICE_USERuser of WSO2 Manager Service
WSO2_MANAGER_SERVICE_PASSWORDpass of WSO2 Manager Service
OAUTH_RESET_PASSWORD_ISSUERURL of reset password issuer (WSO2)
OAUTH_RESET_PASSWORD_AUTH_USERuser of WSO2 reset password service (WSO2)
OAUTH_RESET_PASSWORD_AUTH_PASSWORDpassword of WSO2 reset password service (WSO2)
MCM Internal Certificate Authority configuration
P12_PASS_PHRASEPass phrase used to save the internal CA Key in the DB.
Support for self-signed certificates on OAuth Server and other TLS client connections
EXTRA_CERTIFICATE_CHAIN_FILE_NAMEExtra trusted server certificate chain file name ( PEM-encoded, as explained in https://nodejs.org/api/tls.html#tls_tls_createsecurecontext_options )
EXTRA_ROOT_CERT_FILE_NAMEExtra trusted server root certificate file name
CFSSL
CFSSL_VERSIONExpected CFSSL version to use. Should be updated to keep in sync with the cfssl development1.3.4
CFSSL_COMMAND_PATHcfssl command; it should be just cfssl if it's in the PATH or the full pathcfssl
Keycloak Integration
KEYCLOAK_ENABLEDEnable Keycloak integration for DFSP account creationfalse
KEYCLOAK_BASE_URLBase URL of the Keycloak serverhttp://localhost:8080
KEYCLOAK_DISCOVERY_URLOpenID Connect discovery URL for Keycloakhttp://localhost:8080/realms/dfsps/.well-known/openid-configuration
KEYCLOAK_ADMIN_CLIENT_IDClient ID for Keycloak admin operationsconnection-manager-client
KEYCLOAK_ADMIN_CLIENT_SECRETClient secret for Keycloak admin operations
KEYCLOAK_DFSPS_REALMKeycloak realm for DFSP accountsdfsps
KEYCLOAK_AUTO_CREATE_ACCOUNTSAutomatically create Keycloak accounts when DFSPs are createdtrue

Testing

  • Unit testing:
    • run npm run backend:start as a pre-requisite to npm test
    • run npm test. The tests are implemented using jest. If you need some test certificates, see the test resources readme
  • Smoke testing ( zsh script ): run the cmd-line-tester.sh script from a tmp directory
  • swagger: see "running the server" below

Functional Tests

Refer to README.

Style

js-semistandard-style ( + dangling commas on Objects )

Building a docker image

The server includes a Dockerfile.

There's a set of scripts to build the image and tag it for a local minikube or other environments. Take a look at ./docker-build.sh

Keywords

swagger

FAQs

Package last updated on 30 Jul 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.