{"id":28577492,"url":"https://github.com/mastercard/insomnia-plugin-mastercard","last_synced_at":"2025-07-18T01:41:04.285Z","repository":{"id":37797103,"uuid":"127004734","full_name":"Mastercard/insomnia-plugin-mastercard","owner":"Mastercard","description":"An Insomnia plugin for handling authentication and encryption for consuming Mastercard APIs.","archived":false,"fork":false,"pushed_at":"2025-03-19T13:13:53.000Z","size":445,"stargazers_count":43,"open_issues_count":0,"forks_count":26,"subscribers_count":23,"default_branch":"main","last_synced_at":"2025-05-15T04:48:33.540Z","etag":null,"topics":["encryption","insomnia","insomnia-plugins","jwe","mastercard","oauth1","oauth1a","openapi"],"latest_commit_sha":null,"homepage":"https://developer.mastercard.com/platform/documentation/security-and-authentication/using-oauth-1a-to-access-mastercard-apis/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","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":"2018-03-27T15:06:05.000Z","updated_at":"2025-04-24T16:02:22.000Z","dependencies_parsed_at":"2024-05-15T23:53:03.890Z","dependency_job_id":"caf366ad-0a3d-4b2a-b1c9-9328f03e1e69","html_url":"https://github.com/Mastercard/insomnia-plugin-mastercard","commit_stats":null,"previous_names":["mastercard/insomnia-plugin-mastercard-auth"],"tags_count":28,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mastercard%2Finsomnia-plugin-mastercard","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mastercard%2Finsomnia-plugin-mastercard/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mastercard%2Finsomnia-plugin-mastercard/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mastercard%2Finsomnia-plugin-mastercard/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Mastercard","download_url":"https://codeload.github.com/Mastercard/insomnia-plugin-mastercard/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mastercard%2Finsomnia-plugin-mastercard/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":["encryption","insomnia","insomnia-plugins","jwe","mastercard","oauth1","oauth1a","openapi"],"created_at":"2025-06-11T00:37:56.768Z","updated_at":"2025-06-11T00:38:50.877Z","avatar_url":"https://github.com/Mastercard.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# insomnia-plugin-mastercard \n[![](https://developer.mastercard.com/_/_/src/global/assets/svg/mcdev-logo-dark.svg)](https://developer.mastercard.com/)\n\n[![](https://sonarcloud.io/api/project_badges/measure?project=Mastercard_insomnia-plugin-mastercard\u0026metric=alert_status)](https://sonarcloud.io/dashboard?id=Mastercard_insomnia-plugin-mastercard)\n[![](https://github.com/Mastercard/insomnia-plugin-mastercard/workflows/broken%20links%3F/badge.svg)](https://github.com/Mastercard/insomnia-plugin-mastercard/actions?query=workflow%3A%22broken+links%3F%22)\n[![](https://img.shields.io/npm/v/insomnia-plugin-mastercard.svg)](https://www.npmjs.com/package/insomnia-plugin-mastercard)\n[![](https://img.shields.io/badge/license-Apache%202.0-yellow.svg)](https://github.com/Mastercard/insomnia-plugin-mastercard/blob/master/LICENSE)\n[![](https://img.shields.io/badge/insomnia-install%20workspace-purple.svg?color=6a57d5)](https://insomnia.rest/run/?label=Import%20Mastercard%20Workspace\u0026uri=https://raw.githubusercontent.com/Mastercard/insomnia-plugin-mastercard/master/workspace/mastercard-apis-insomnia-workspace.json)\n\n## Table of Contents\n- [Overview](#overview)\n  * [Compatibility](#compatibility)\n  * [References](#references)\n- [Usage](#usage)\n  * [Prerequisites](#prerequisites)\n  * [Installation](#installation)\n  * [Configuration](#configuration)\n  * [Authenticated Requests](#authenticated-requests)\n  * [Encryption](#encryption)\n- [Further Reading](#further-reading)\n\n## Overview \u003ca name=\"overview\"\u003e\u003c/a\u003e\nA plugin for consuming Mastercard APIs with support for authentication and encryption. \nThis plugin computes and adds an `Authorization` header to requests sent from [Insomnia REST Client](https://insomnia.rest/) \nand it can be configured to automatically encrypt request and/or decrypt response payloads.\n\n### Compatibility \u003ca name=\"compatibility\"\u003e\u003c/a\u003e\nInsomnia v5.15.0+\n\n### References \u003ca name=\"references\"\u003e\u003c/a\u003e\n* [Using OAuth 1.0a to Access Mastercard APIs](https://developer.mastercard.com/platform/documentation/security-and-authentication/using-oauth-1a-to-access-mastercard-apis/)\n* [Securing Sensitive Data Using Payload Encryption](https://developer.mastercard.com/platform/documentation/security-and-authentication/securing-sensitive-data-using-payload-encryption/)\n* [A Mastercard Plugin for Insomnia REST Client](https://developer.mastercard.com/blog/a-mastercard-plugin-for-insomnia-rest-client)\n\n## Usage \u003ca name=\"usage\"\u003e\u003c/a\u003e\n\n### Prerequisites \u003ca name=\"prerequisites\"\u003e\u003c/a\u003e\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 credentials for your app:\n* A consumer key (displayed on the Mastercard Developer Portal)\n* A private request signing key (matching the public certificate displayed on the Mastercard Developer Portal)\n\n### Installation \u003ca name=\"installation\"\u003e\u003c/a\u003e\n\n#### 1. One-Click Installation\n1. Go to https://insomnia.rest/plugins/insomnia-plugin-mastercard\n2. Click the \"Install Plugin\" button\n3. Click \"Open Insomnia\" and \"Install\"\n\n#### 2. Manual Installation\n1. Download \"insomnia-plugin-mastercard-{version}.zip\" from [Releases \u003e Assets](https://github.com/Mastercard/insomnia-plugin-mastercard/releases)\n2. Go to Application \u003e Preferences \u003e Plugins\n3. Click \"Reveal Plugins Folder\"\n4. Extract the ZIP file from step 1 to the \"plugins\" folder\n5. Click \"Reload Plugins\"\n\n![](https://user-images.githubusercontent.com/3964455/67882595-66a0cd00-fb3a-11e9-8909-f2188f9a94da.gif)\n\n### Configuration \u003ca name=\"configuration\"\u003e\u003c/a\u003e\n\n#### One-Click Import\nTo import two ready to be used \"sandbox\" and \"production\" environments:\n1. Depending on your use case, click either of these:\n   - No encryption: \n [![](https://img.shields.io/badge/insomnia-install%20workspace-purple.svg?color=6a57d5)](https://insomnia.rest/run/?label=Import%20Mastercard%20Workspace\u0026uri=https://raw.githubusercontent.com/Mastercard/insomnia-plugin-mastercard/master/workspace/mastercard-apis-insomnia-workspace.json) \n\n   - Mastercard Encryption: \n [![](https://img.shields.io/badge/insomnia-install%20workspace-purple.svg?color=6a57d5)](https://insomnia.rest/run/?label=Import%20Mastercard%20Workspace\u0026uri=https://raw.githubusercontent.com/Mastercard/insomnia-plugin-mastercard/master/workspace/mastercard-apis-with-mastercard-encryption-insomnia-workspace.json)  \n\n   - JWE Encryption: \n [![](https://img.shields.io/badge/insomnia-install%20workspace-purple.svg?color=6a57d5)](https://insomnia.rest/run/?label=Import%20Mastercard%20Workspace\u0026uri=https://raw.githubusercontent.com/Mastercard/insomnia-plugin-mastercard/master/workspace/mastercard-apis-with-jwe-encryption-insomnia-workspace.json)  \n2. Click \"Run Import Mastercard Workspace\"\n\nAlternatively, you can:\n1. Go to Application \u003e Preferences \u003e Data\n2. Click \"Import Data\"\n3. Click \"From URL\"\n4. Input either of these depending on your use case:  \n    - No encryption: https://raw.githubusercontent.com/Mastercard/insomnia-plugin-mastercard/master/workspace/mastercard-apis-insomnia-workspace.json\n    - Mastercard encryption: https://raw.githubusercontent.com/Mastercard/insomnia-plugin-mastercard/master/workspace/mastercard-apis-with-mastercard-encryption-insomnia-workspace.json\n    - JWE encryption: https://raw.githubusercontent.com/Mastercard/insomnia-plugin-mastercard/master/workspace/mastercard-apis-with-jwe-encryption-insomnia-workspace.json\n5. Click \"Fetch and Import\"\n\n![](https://user-images.githubusercontent.com/3964455/68041294-2d966300-fcc8-11e9-887a-cfadf183c4c1.gif)\n\n#### Manual Configuration\nUpdate your [environment](https://support.insomnia.rest/article/18-environment-variables):\n1. Click \"Manage Environments\"\n2. Create a \"mastercard\" environment variable with your credentials:\n\nLinux/macOS\n```json\n{\n  \"mastercard\": {\n    \"consumerKey\": \"000000000000000000000000000000000000000000000000!000000000000000000000000000000000000000000000000\",\n    \"keyAlias\": \"keyalias\",\n    \"keystoreP12Path\": \"/path/to/sandbox-signing-key.p12\",\n    \"keystorePassword\": \"keystorepassword\",\n    \"appliesTo\": [\n      \"mastercard.com\",\n      \"api.ethocaweb.com\"\n    ]\n  }\n}\n```\nWindows\n```json\n{\n  \"mastercard\": {\n    \"consumerKey\": \"000000000000000000000000000000000000000000000000!000000000000000000000000000000000000000000000000\",\n    \"keyAlias\": \"keyalias\",\n    \"keystoreP12Path\": \"C:\\\\path\\\\to\\\\sandbox-signing-key.p12\",\n    \"keystorePassword\": \"keystorepassword\",\n    \"appliesTo\": [\n      \"mastercard.com\",\n      \"api.ethocaweb.com\"\n    ]\n  }\n}\n```\n\n### Authenticated Requests \u003ca name=\"authenticated-requests\"\u003e\u003c/a\u003e\nFrom now on, an `Authorization` header will be automatically added to every request sent to Mastercard:\n\n![](https://user-images.githubusercontent.com/3964455/68042376-a72f5080-fcca-11e9-85d9-d60cdd2da920.gif)\n\n### Encryption \u003ca name=\"encryption\"\u003e\u003c/a\u003e\nThis plugin can take care of encrypting requests and/or decrypting response payloads. To enable encryption support, \nyou need to configure in the environment the `encryptionConfig` property.    \n\nHere's a quick example for Mastercard Encryption:  \n\n```jsonc\n{\n  \"mastercard\": {\n    \n    // ... // \n    \n    \"encryptionConfig\": {\n      \"paths\": [\n        {\n          \"path\": \"/tokenize\",\n          \"toEncrypt\": [\n            {\n              \"element\": \"cardInfo.encryptedData\",\n              \"obj\": \"cardInfo\"\n            },\n            {\n              \"element\": \"fundingAccountInfo.encryptedPayload.encryptedData\",\n              \"obj\": \"fundingAccountInfo.encryptedPayload\"\n            }\n          ],\n          \"toDecrypt\": [\n            {\n              \"element\": \"tokenDetail\",\n              \"obj\": \"tokenDetail.encryptedData\"\n            }\n          ]\n        }\n      ],\n      \"oaepPaddingDigestAlgorithm\": \"SHA-512\",\n      \"ivFieldName\": \"iv\",\n      \"encryptedKeyFieldName\": \"encryptedKey\",\n      \"encryptedValueFieldName\": \"encryptedData\",\n      \"oaepHashingAlgorithmFieldName\": \"oaepHashingAlgorithm\",\n      \"publicKeyFingerprintFieldName\": \"publicKeyFingerprint\",\n      \"publicKeyFingerprintType\": \"certificate\",\n      \"dataEncoding\": \"hex\",\n      \"encryptionCertificate\": \"/path/to/the/encryption/certificate\",\n      \"privateKey\": \"/path/to/private/key\"\n    }\n  }\n}\n```\nAs an alternative to providing the `privateKey` in the `encryptionConfig`, you can configure the keystore along with alias and password as shown below:\n```jsonc\n{\n  \"mastercard\": {\n    \"encryptionConfig\": {\n\n      // ... //\n\n      \"encryptionCertificate\": \"/path/to/the/encryption/certificate\",\n      \"keyStore\": \"/path/to/the/keystore\",\n      \"keyStoreAlias\": \"keystorealias\",\n      \"keyStorePassword\": \"keystorepassword\",\n    }\n  }\n}\n```\n\n[See more examples here](docs/configuration-examples.md).\n\nBoth Mastercard encryption and JWE encryption are supported.   \nFor more details on the encryption configurations, checkout these links:  \n - [Mastercard Encryption](https://github.com/Mastercard/client-encryption-nodejs/blob/main/README.md#configuring-the-field-level-encryption)\n - [JWE Encryption](https://github.com/Mastercard/client-encryption-nodejs/blob/main/README.md#configuring-the-jwe-encryption)\n\n\n## Further Reading \u003ca name=\"further-reading\"\u003e\u003c/a\u003e\n\n* [oauth1-signer-nodejs](https://github.com/Mastercard/oauth1-signer-nodejs) — A zero dependency library for generating a Mastercard API compliant OAuth signature\n* [client-encryption-nodejs](https://github.com/Mastercard/client-encryption-nodejs) — Library for Mastercard API compliant payload encryption/decryption.\n* [Insomnia Plugins](https://support.insomnia.rest/article/26-plugins)\n* [The Insomnia Plugin Hub](https://insomnia.rest/plugins)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmastercard%2Finsomnia-plugin-mastercard","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmastercard%2Finsomnia-plugin-mastercard","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmastercard%2Finsomnia-plugin-mastercard/lists"}