{"id":28577508,"url":"https://github.com/mastercard/client-encryption-nodejs","last_synced_at":"2025-06-11T00:38:52.182Z","repository":{"id":34456165,"uuid":"171892061","full_name":"Mastercard/client-encryption-nodejs","owner":"Mastercard","description":"Library for Mastercard API compliant payload encryption/decryption.","archived":false,"fork":false,"pushed_at":"2025-03-19T13:24:54.000Z","size":1731,"stargazers_count":40,"open_issues_count":0,"forks_count":26,"subscribers_count":14,"default_branch":"main","last_synced_at":"2025-03-19T13:29:10.415Z","etag":null,"topics":["decryption","encryption","field-level-encryption","fle","javascript","mastercard","nodejs","openapi"],"latest_commit_sha":null,"homepage":"https://developer.mastercard.com/platform/documentation/security-and-authentication/securing-sensitive-data-using-payload-encryption/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Mastercard.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-02-21T15:00:33.000Z","updated_at":"2025-03-19T12:23:51.000Z","dependencies_parsed_at":"2023-11-14T12:31:52.617Z","dependency_job_id":"89083719-e037-4842-9ad7-00ec65ca2692","html_url":"https://github.com/Mastercard/client-encryption-nodejs","commit_stats":{"total_commits":149,"total_committers":17,"mean_commits":8.764705882352942,"dds":0.6644295302013423,"last_synced_commit":"ee860927eb2aac31f642d710bf839c306d131ed7"},"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mastercard%2Fclient-encryption-nodejs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mastercard%2Fclient-encryption-nodejs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mastercard%2Fclient-encryption-nodejs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mastercard%2Fclient-encryption-nodejs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Mastercard","download_url":"https://codeload.github.com/Mastercard/client-encryption-nodejs/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mastercard%2Fclient-encryption-nodejs/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259177332,"owners_count":22817349,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["decryption","encryption","field-level-encryption","fle","javascript","mastercard","nodejs","openapi"],"created_at":"2025-06-11T00:37:59.570Z","updated_at":"2025-06-11T00:38:52.156Z","avatar_url":"https://github.com/Mastercard.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# client-encryption-nodejs\n\n[![](https://developer.mastercard.com/_/_/src/global/assets/svg/mcdev-logo-dark.svg)](https://developer.mastercard.com/)\n\n[![](https://github.com/Mastercard/client-encryption-nodejs/workflows/Build%20\u0026%20Test/badge.svg)](https://github.com/Mastercard/client-encryption-nodejs/actions?query=workflow%3A%22Build+%26+Test%22)\n[![](https://sonarcloud.io/api/project_badges/measure?project=Mastercard_client-encryption-nodejs\u0026metric=alert_status)](https://sonarcloud.io/dashboard?id=Mastercard_client-encryption-nodejs)\n[![](https://sonarcloud.io/api/project_badges/measure?project=Mastercard_client-encryption-nodejs\u0026metric=coverage)](https://sonarcloud.io/dashboard?id=Mastercard_client-encryption-nodejs)\n[![](https://sonarcloud.io/api/project_badges/measure?project=Mastercard_client-encryption-nodejs\u0026metric=vulnerabilities)](https://sonarcloud.io/dashboard?id=Mastercard_client-encryption-nodejs)\n[![](https://github.com/Mastercard/client-encryption-nodejs/workflows/broken%20links%3F/badge.svg)](https://github.com/Mastercard/client-encryption-nodejs/actions?query=workflow%3A%22broken+links%3F%22)\n[![](https://img.shields.io/npm/v/mastercard-client-encryption.svg)](https://www.npmjs.com/package/mastercard-client-encryption)\n[![](https://img.shields.io/badge/license-MIT-yellow.svg)](https://github.com/Mastercard/client-encryption-nodejs/blob/master/LICENSE)\n\n## Table of Contents\n\n- [Overview](#overview)\n  - [Compatibility](#compatibility)\n  - [References](#references)\n  - [Versioning and Deprecation Policy](#versioning)\n- [Usage](#usage)\n  - [Prerequisites](#prerequisites)\n  - [Adding the Library to Your Project](#adding-the-libraries-to-your-project)\n  - [Performing Field Level Encryption and Decryption](#performing-field-level-encryption-and-decryption)\n  - [Performing JWE Encryption and Decryption](#performing-jwe-encryption-and-decryption)\n  - [Integrating with OpenAPI Generator API Client Libraries](#integrating-with-openapi-generator-api-client-libraries)\n\n## Overview \u003ca name=\"overview\"\u003e\u003c/a\u003e\n\nNodeJS library for Mastercard API compliant payload encryption/decryption.\n\n### Compatibility \u003ca name=\"compatibility\"\u003e\u003c/a\u003e\n- NodeJS 16+\n\nThere shouldn't be any Node compatibility issues with this package, but it's a good idea to keep your Node versions up-to-date. It is recommended that you use one of the LTS Node.js releases, or one of the more general recent releases. A Node version manager such as `nvm` (_Mac_ and _Linux_) or `nvm-windows` is a good way to stay on top of this.\n\n### References \u003ca name=\"references\"\u003e\u003c/a\u003e\n\n\u003cimg src=\"https://user-images.githubusercontent.com/3964455/55345820-c520a280-54a8-11e9-8235-407199fa1d97.png\" alt=\"Encryption of sensitive data\" width=\"75%\" height=\"75%\"/\u003e\n\n### Versioning and Deprecation Policy \u003ca name=\"versioning\"\u003e\u003c/a\u003e\n* [Mastercard Versioning and Deprecation Policy](https://github.com/Mastercard/.github/blob/main/CLIENT_LIBRARY_DEPRECATION_POLICY.md)\n\n## Usage \u003ca name=\"usage\"\u003e\u003c/a\u003e\n\n### Prerequisites \u003ca name=\"prerequisites\"\u003e\u003c/a\u003e\n\nBefore using this library, you will need to set up a project in the [Mastercard Developers Portal](https://developer.mastercard.com).\n\nAs part of this set up, you'll receive:\n\n- A public request encryption certificate (aka _Client Encryption Keys_)\n- A private response decryption key (aka _Mastercard Encryption Keys_)\n\n### Installation \u003ca name=\"adding-the-libraries-to-your-project\"\u003e\u003c/a\u003e\n\nIf you want to use **mastercard-client-encryption** with [Node.js](https://nodejs.org/), it is available through `npm`:\n\n- [https://npmjs.org/package/mastercard-client-encryption](https://npmjs.org/package/mastercard-client-encryption)\n\nAdding the library to your project:\n\n```shell\nnpm install mastercard-client-encryption\n```\n\nYou can then use it as a regular module:\n\n```js\nconst clientEncryption = require(\"mastercard-client-encryption\");\n```\n\n### Performing Field Level Encryption and Decryption \u003ca name=\"performing-field-level-encryption-and-decryption\"\u003e\u003c/a\u003e\n\n- [Introduction](#introduction)\n- [Configuring the Field Level Encryption](#configuring-the-field-level-encryption)\n- [Performing Encryption](#performing-encryption)\n- [Performing Decryption](#performing-decryption)\n\n#### Introduction \u003ca name=\"introduction\"\u003e\u003c/a\u003e\n\nThe core methods responsible for payload encryption and decryption are `encryptData` and `decryptData` in the `FieldLevelEncryption` class.\n\n- `encrypt()` usage:\n\n```js\nconst fle = new clientEncryption.FieldLevelEncryption(config);\n// …\nlet encryptedRequestPayload = fle.encrypt(endpoint, header, body);\n```\n\n- `decrypt()` usage:\n\n```js\nconst fle = new clientEncryption.FieldLevelEncryption(config);\n// …\nlet responsePayload = fle.decrypt(encryptedResponsePayload);\n```\n\n#### Configuring the Field Level Encryption \u003ca name=\"configuring-the-field-level-encryption\"\u003e\u003c/a\u003e\n\n`FieldLevelEncryption` needs a config object to instruct how to decrypt/decrypt the payloads. Example:\n\n```js\nconst config = {\n  paths: [\n    {\n      path: \"/resource\",\n      toEncrypt: [\n        {\n          /* path to element to be encrypted in request json body */\n          element: \"path.to.foo\",\n          /* path to object where to store encryption fields in request json body */\n          obj: \"path.to.encryptedFoo\",\n        },\n      ],\n      toDecrypt: [\n        {\n          /* path to element where to store decrypted fields in response object */\n          element: \"path.to.encryptedFoo\",\n          /* path to object with encryption fields */\n          obj: \"path.to.foo\",\n        },\n      ],\n    },\n  ],\n  ivFieldName: \"iv\",\n  encryptedKeyFieldName: \"encryptedKey\",\n  encryptedValueFieldName: \"encryptedData\",\n  dataEncoding: \"hex\",\n  encryptionCertificate: \"./path/to/public.cert\",\n  privateKey: \"./path/to/your/private.key\",\n  oaepPaddingDigestAlgorithm: \"SHA-256\",\n};\n```\n\n#### Performing Encryption \u003ca name=\"performing-encryption\"\u003e\u003c/a\u003e\n\nCall `FieldLevelEncryption.encrypt()` with a JSON request payload, and optional `header` object.\n\nExample using the configuration [above](#configuring-the-field-level-encryption):\n\n```js\nconst payload = {\n  path: {\n    to: {\n      foo: {\n        sensitive: \"this is a secret!\",\n        sensitive2: \"this is a super-secret!\",\n      },\n    },\n  },\n};\nconst fle = new (require(\"mastercard-client-encryption\").FieldLevelEncryption)(\n  config\n);\n// …\nlet responsePayload = fle.encrypt(\"/resource1\", header, payload);\n```\n\nOutput:\n\n```json\n{\n  \"path\": {\n    \"to\": {\n      \"encryptedFoo\": {\n        \"iv\": \"7f1105fb0c684864a189fb3709ce3d28\",\n        \"encryptedKey\": \"67f467d1b653d98411a0c6d3c…ffd4c09dd42f713a51bff2b48f937c8\",\n        \"encryptedData\": \"b73aabd267517fc09ed72455c2…dffb5fa04bf6e6ce9ade1ff514ed6141\",\n        \"publicKeyFingerprint\": \"80810fc13a8319fcf0e2e…82cc3ce671176343cfe8160c2279\",\n        \"oaepHashingAlgorithm\": \"SHA256\"\n      }\n    }\n  }\n}\n```\n\n#### Performing Decryption \u003ca name=\"performing-decryption\"\u003e\u003c/a\u003e\n\nCall `FieldLevelEncryption.decrypt()` with an (encrypted) `response` object with the following fields:\n\n- `body`: json payload\n- `request.url`: requesting url\n- `header`: _optional_, header object\n\nExample using the configuration [above](#configuring-the-field-level-encryption):\n\n```js\nconst response = {};\nresponse.request = { url: \"/resource1\" };\nresponse.body = {\n  path: {\n    to: {\n      encryptedFoo: {\n        iv: \"e5d313c056c411170bf07ac82ede78c9\",\n        encryptedKey:\n          \"e3a56746c0f9109d18b3a2652b76…f16d8afeff36b2479652f5c24ae7bd\",\n        encryptedData:\n          \"809a09d78257af5379df0c454dcdf…353ed59fe72fd4a7735c69da4080e74f\",\n        oaepHashingAlgorithm: \"SHA256\",\n        publicKeyFingerprint: \"80810fc13a8319fcf0e2e…3ce671176343cfe8160c2279\",\n      },\n    },\n  },\n};\nconst fle = new (require(\"mastercard-client-encryption\").FieldLevelEncryption)(\n  config\n);\nlet responsePayload = fle.decrypt(response);\n```\n\nOutput:\n\n```json\n{\n  \"path\": {\n    \"to\": {\n      \"foo\": {\n        \"sensitive\": \"this is a secret\",\n        \"sensitive2\": \"this is a super secret!\"\n      }\n    }\n  }\n}\n```\n\n### Performing JWE Encryption and Decryption \u003ca name=\"performing-jwe-encryption-and-decryption\"\u003e\u003c/a\u003e\n\n#### JWE Encryption and Decryption \u003ca name=\"jwe-encryption-and-decryption\"\u003e\u003c/a\u003e\n\n- [Introduction](#jwe-introduction)\n- [Configuring the JWE Encryption](#configuring-the-jwe-encryption)\n- [Performing JWE Encryption](#performing-jwe-encryption)\n- [Performing JWE Decryption](#performing-jwe-decryption)\n- [Encrypting Entire Payloads](#encrypting-entire-payloads-jwe)\n- [Decrypting Entire Payloads](#decrypting-entire-payloads-jwe)\n- [First Level Field Encryption and Decryption](#encrypting-decrypting-first-level-field-jwe)\n\n##### • Introduction \u003ca name=\"jwe-introduction\"\u003e\u003c/a\u003e\n\nThis library uses [JWE compact serialization](https://datatracker.ietf.org/doc/html/rfc7516#section-7.1) for the encryption of sensitive data.\nThe core methods responsible for payload encryption and decryption are `encryptData` and `decryptData` in the `JweEncryption` class.\n\n- `encryptPayload` usage:\n\n```js\nconst jwe = new clientEncryption.JweEncryption(config);\n// …\nlet encryptedRequestPayload = jwe.encrypt(endpoint, header, body);\n```\n\n- `decryptPayload` usage:\n\n```js\nconst jwe = new clientEncryption.JweEncryption(config);\n// …\nlet responsePayload = jwe.decrypt(encryptedResponsePayload);\n```\n\n##### • Configuring the JWE Encryption \u003ca name=\"configuring-the-jwe-encryption\"\u003e\u003c/a\u003e\n\n`JweEncryption` needs a config object to instruct how to decrypt/decrypt the payloads. Example:\n\n```js\nconst config = {\n  paths: [\n    {\n      path: \"/resource1\",\n      toEncrypt: [\n        {\n          /* path to element to be encrypted in request json body */\n          element: \"path.to.foo\",\n          /* path to object where to store encryption fields in request json body */\n          obj: \"path.to.encryptedFoo\",\n        },\n      ],\n      toDecrypt: [\n        {\n          /* path to element where to store decrypted fields in response object */\n          element: \"path.to.encryptedFoo\",\n          /* path to object with encryption fields */\n          obj: \"path.to.foo\",\n        },\n      ],\n    },\n  ],\n  mode: \"JWE\",\n  encryptedValueFieldName: \"encryptedData\",\n  encryptionCertificate: \"./path/to/public.cert\",\n  privateKey: \"./path/to/your/private.key\",\n};\n```\n\nMode must be set to JWE to use JWE encryption\n\n##### • Performing JWE Encryption \u003ca name=\"performing-jwe-encryption\"\u003e\u003c/a\u003e\n\nCall `JweEncryption.encrypt()` with a JSON request payload, and optional `header` object.\n\nExample using the configuration [above](#configuring-the-field-level-encryption):\n\n```js\nconst payload = {\n  path: {\n    to: {\n      foo: {\n        sensitive: \"this is a secret!\",\n        sensitive2: \"this is a super-secret!\",\n      },\n    },\n  },\n};\nconst jwe = new (require(\"mastercard-client-encryption\").JweEncryption)(config);\n// …\nlet responsePayload = jwe.encrypt(\"/resource1\", header, payload);\n```\n\nOutput:\n\n```json\n{\n  \"path\": {\n    \"to\": {\n      \"encryptedFoo\": {\n        \"encryptedData\": \"eyJraWQiOiI3NjFiMDAzYzFlYWRlM….Y+oPYKZEMTKyYcSIVEgtQw\"\n      }\n    }\n  }\n}\n```\n\n##### • Performing JWE Decryption \u003ca name=\"performing-jwe-decryption\"\u003e\u003c/a\u003e\n\nCall `JweEncryption.decrypt()` with an (encrypted) `response` object with the following fields:\n\nExample using the configuration [above](#configuring-the-jwe-encryption):\n\n```js\nconst response = {};\nresponse.request = { url: \"/resource1\" };\nresponse.body = JSON.parse(\n  \"{\" +\n  '    \"path\": {' +\n  '        \"to\": {' +\n  '            \"encryptedFoo\": {' +\n  '                \"encryptedData\": \"eyJraWQiOiI3NjFiMDAzYzFlYWRlM….Y+oPYKZEMTKyYcSIVEgtQw\"' +\n  \"            }\" +\n  \"        }\" +\n  \"    }\" +\n  \"}\");\nconst jwe = new (require(\"mastercard-client-encryption\").JweEncryption)(config);\nlet responsePayload = jwe.decrypt(response);\n```\n\nOutput:\n\n```json\n{\n  \"path\": {\n    \"to\": {\n      \"foo\": {\n        \"sensitive\": \"this is a secret\",\n        \"sensitive2\": \"this is a super secret!\"\n      }\n    }\n  }\n}\n```\n\n##### • Encrypting Entire Payloads \u003ca name=\"encrypting-entire-payloads-jwe\"\u003e\u003c/a\u003e\n\nEntire payloads can be encrypted using the \"$\" operator as encryption path:\n\n```js\nconst config = {\n  paths: [\n    {\n      path: \"/resource1\",\n      toEncrypt: [\n        {\n          /* path to element to be encrypted in request json body */\n          element: \"$\",\n          /* path to object where to store encryption fields in request json body */\n          obj: \"$\",\n        },\n      ],\n      toDecrypt: [],\n    },\n  ],\n  mode: \"JWE\",\n  encryptedValueFieldName: \"encryptedData\",\n  encryptionCertificate: \"./path/to/public.cert\",\n  privateKey: \"./path/to/your/private.key\",\n};\n```\n\nExample:\n\n```js\nconst payload = JSON.parse(\n  \"{\" +\n  '    \"sensitive\": \"this is a secret\",' +\n  '    \"sensitive2\": \"this is a super secret!\"' +\n  \"}\");\nconst jwe = new (require(\"mastercard-client-encryption\").JweEncryption)(config);\n// …\nlet responsePayload = jwe.encrypt(\"/resource1\", header, payload);\n```\n\nOutput:\n\n```json\n{\n  \"encryptedData\": \"eyJraWQiOiI3NjFiMDAzYzFlYWRlM….Y+oPYKZEMTKyYcSIVEgtQw\"\n}\n```\n\n##### • Decrypting Entire Payloads \u003ca name=\"decrypting-entire-payloads-jwe\"\u003e\u003c/a\u003e\n\nEntire payloads can be decrypted using the \"$\" operator as decryption path:\n\n```js\nconst config = {\n  paths: [\n    {\n      path: \"/resource1\",\n      toEncrypt: [],\n      toDecrypt: [\n        {\n          /* path to element where to store decrypted fields in response object */\n          element: \"$\",\n          /* path to object with encryption fields */\n          obj: \"$\",\n        },\n      ],\n    },\n  ],\n  mode: \"JWE\",\n  encryptedValueFieldName: \"encryptedData\",\n  encryptionCertificate: \"./path/to/public.cert\",\n  privateKey: \"./path/to/your/private.key\",\n};\n```\n\nExample:\n\n```js\nconst encryptedPayload = JSON.parse(\n  \"{\" +\n  '  \"encryptedData\": \"eyJraWQiOiI3NjFiMDAzYzFlYWRlM….Y+oPYKZEMTKyYcSIVEgtQw\"' +\n  \"}\");\nconst jwe = new (require(\"mastercard-client-encryption\").JweEncryption)(config);\nlet responsePayload = jwe.decrypt(encryptedPayload);\n```\n\nOutput:\n\n```json\n{\n  \"sensitive\": \"this is a secret\",\n  \"sensitive2\": \"this is a super secret!\"\n}\n```\n\n##### • First Level Field Encryption and Decryption \u003ca name=\"encrypting-decrypting-first-level-field-jwe\"\u003e\u003c/a\u003e\n\nTo have encrypted results in the first level field or to decrypt the first level field, specify `encryptedValueFieldName` to be the same as `obj` (for encryption) or `element` (for decryption):\n\nExample of configuration:\n\n```js\nconst config = {\n  paths: [\n    {\n      path: \"/resource1\",\n      toEncrypt: [\n        {\n          /* path to element to be encrypted in request json body */\n          element: \"sensitive\",\n          /* path to object where to store encryption fields in request json body */\n          obj: \"encryptedData\",\n        },\n      ],\n      toDecrypt: [\n        {\n          /* path to element where to store decrypted fields in response object */\n          element: \"encryptedData\",\n          /* path to object with encryption fields */\n          obj: \"sensitive\",\n        },\n      ],\n    },\n  ],\n  mode: \"JWE\",\n  encryptedValueFieldName: \"encryptedData\",\n  encryptionCertificate: \"./path/to/public.cert\",\n  privateKey: \"./path/to/your/private.key\",\n};\n```\n\nExample of encryption:\n\n```js\nconst payload = {\n  sensitive: \"this is a secret!\",\n  notSensitive: \"not a secret\",\n};\nconst jwe = new (require(\"mastercard-client-encryption\").JweEncryption)(config);\n// …\nlet responsePayload = jwe.encrypt(\"/resource1\", header, payload);\n```\n\nOutput:\n\n```json\n{\n  \"encryptedData\": \"eyJraWQiOiI3NjFiMDAzYzFlYWRlM….Y+oPYKZEMTKyYcSIVEgtQw\",\n  \"notSensitive\": \"not a secret\"\n}\n```\n\nExample of decryption:\n\n```js\nconst response = {};\nresponse.request = { url: \"/resource1\" };\nresponse.body = JSON.parse(\n  \"{\" +\n  '    \"encryptedData\": \"eyJraWQiOiI3NjFiMDAzYzFlYWRlM….Y+oPYKZEMTKyYcSIVEgtQw\",' +\n  '    \"notSensitive\": \"not a secret\"' +\n  \"}\");\nconst jwe = new (require(\"mastercard-client-encryption\").JweEncryption)(config);\nlet responsePayload = jwe.decrypt(response);\n```\n\nOutput:\n\n```json\n{\n  \"sensitive\": \"this is a secret\",\n  \"notSensitive\": \"not a secret\"\n}\n```\n\n### Integrating with OpenAPI Generator API Client Libraries \u003ca name=\"integrating-with-openapi-generator-api-client-libraries\"\u003e\u003c/a\u003e\n\n[OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) generates API client libraries from [OpenAPI Specs](https://github.com/OAI/OpenAPI-Specification).\nIt provides generators and library templates for supporting multiple languages and frameworks.\n\nThe **client-encryption-nodejs** library provides the `Service` decorator object you can use with the OpenAPI generated client. This class will take care of encrypting request and decrypting response payloads, but also of updating HTTP headers when needed, automatically, without manually calling `encrypt()`/`decrypt()` functions for each API request or response.\n\n##### OpenAPI Generator \u003ca name=\"openapi-generator\"\u003e\u003c/a\u003e\n\nOpenAPI client can be generated, starting from your OpenAPI Spec / Swagger using the following command:\n\n```shell\nopenapi-generator-cli generate -i openapi-spec.yaml -l javascript -o out\n```\n\nClient library will be generated in the `out` folder.\n\nSee also:\n\n- [OpenAPI Generator CLI Installation](https://openapi-generator.tech/docs/installation/)\n\n##### Usage of the `mcapi-service`:\n\nTo use it:\n\n1. Generate the OpenAPI client, as [above](#openapi-generator)\n\n2. Import the **mastercard-client-encryption** library\n\n   ```js\n   const mcapi = require(\"mastercard-client-encryption\");\n   ```\n\n3. Import the OpenAPI Client using the `Service` decorator object:\n\n   ```js\n   const openAPIClient = require(\"./path/to/generated/openapi/client\");\n   const config = {\n     /* service configuration object */\n   };\n\n   const service = new mcapi.Service(openAPIClient, config);\n   ```\n\n4. Use the `service` object as you are using the `openAPIClient` to make API requests.\n\n   Example:\n\n   ```js\n   let api = service.ServiceApi();\n   let merchant =\n     /* … */\n     api.createMerchants(merchant, (error, data, response) =\u003e {\n       // requests and responses will be automatically encrypted and decrypted\n       // accordingly with the configuration used to instantiate the mcapi.Service.\n       /* use response/data object here */\n     });\n   ```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmastercard%2Fclient-encryption-nodejs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmastercard%2Fclient-encryption-nodejs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmastercard%2Fclient-encryption-nodejs/lists"}