{"_id":"@10duke/web-client-pkce","_rev":"6-d895576e4757753630c3551d55553755","name":"@10duke/web-client-pkce","dist-tags":{"latest":"1.3.0"},"versions":{"1.0.1":{"name":"@10duke/web-client-pkce","version":"1.0.1","keywords":["10Duke","identity","entitlement","licensing","client","oidc","OpenID Connect","PKCE"],"author":{"name":"10Duke"},"license":"MIT","_id":"@10duke/web-client-pkce@1.0.1","maintainers":[{"name":"10duke","email":"opensource@10duke.com"}],"homepage":"https://github.com/10Duke/10duke-web-client-pkce#readme","bugs":{"url":"https://github.com/10Duke/10duke-web-client-pkce/issues"},"dist":{"shasum":"4fa144577db4e71e7e5e4961d8b281dd66437d43","tarball":"https://registry.npmjs.org/@10duke/web-client-pkce/-/web-client-pkce-1.0.1.tgz","fileCount":17,"integrity":"sha512-9BGizb1fuwzVdxQzg8C/YnnGP4jin66ymyT+YAoCk0fjVPIGNQZ7N5A83//CezDcOANGaO9NDwDDIcdEYah8Bg==","signatures":[{"sig":"MEYCIQCoi7EVUhW/scv046+18dReg2Ptv2VSbs9RJrvwSbJR7AIhAKykyCx7oZihpQU40CqZT/hGm+y173yDqa5QcEKeHbVY","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":66629,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfrjt3CRA9TVsSAnZWagAATG0P/1Njf43DCBxyD19gC2vG\nUwhxgZxp+dilnNf504XIxwSQKF2VGFsaJvKW9gkODsoR/GQl/i61pdffTbIo\nX/bzMKJokQpZfHppIO3pM9bnNCxxqtzHeYZ8qPxPoNEdjVwPp47rBArKwN+P\nVHQ+MFahR0TAV9jskpRDr+gB/4wmmvrs2RzcAGfekgj8Z+SKKkjgoH2Wwoy9\nyJ0AMtDRS+RCVVLOwadcPaGUun7EuX3JpPt5Rl7VmAG32cImj++Voou+Qejg\nk/oUNbPZERXaaEEN+Z+rJJrTcVQ0One+Jt6/rZdgTmxtLkuD8LHe96dI6Qn0\nZM3OfPpMdHR7ljlcudWTsJzOMGhLEp46xVXbkijBm+MSLvgFlG1LZGHTfNSI\n/SVF/1y0YqTq6FFaGhc+wFTtK+JwdBg50cxWbAuNlSuUaECZhWsetqFeHdFi\n72Y7jyDTI45LQChcSwcyMvwDFo321BJZURfrKZ57OYIkqU8KmlXgRXi9gata\ng81cb3mEQsLqX7gIdjCqRWqAcIjEEeBPGKO8OfR9tTvHILQP0Sc2AUJwmRgN\ny6kdQ8uRfcsJEDVbTiU837euyScD1Y9OR7RbHy6WIp/p2DtKzdpi8q5HH2Ba\nsFDC8OVCXqTYMPgluMflUFiEpx9tz48mGS5MPGnf452oYr7N8eE35ZEbFSWd\nWApE\r\n=GCgm\r\n-----END PGP SIGNATURE-----\r\n"},"main":"lib/index.js","husky":{"hooks":{"pre-commit":"lint-staged"}},"types":"lib/index.d.ts","gitHead":"997f6fc7921f4ad3cacf76ca88dfa09660b0a657","scripts":{"lint":"eslint src/**/*.ts","build":"tsc","format":"prettier --write \"src/**/*.ts\"","lint:fix":"eslint src/*.ts --fix","clear-eslint-cache":"rm -rf node_modules/.cache/eslint-loader"},"_npmUser":{"name":"10duke","email":"opensource@10duke.com"},"repository":{"url":"git+ssh://git@github.com/10Duke/10duke-web-client-pkce.git","type":"git"},"_npmVersion":"6.14.4","description":"10Duke Identity and Entitlement client library for browser-based applications","directories":{},"lint-staged":{"*.ts":["eslint --cache --fix","prettier --write"]},"_nodeVersion":"12.18.0","dependencies":{"debug":"^4.2.0","@types/debug":"^4.1.5","jose-jwe-jws":"^0.2.2","oidc-token-hash":"^5.0.0"},"_hasShrinkwrap":false,"devDependencies":{"husky":"^4.3.0","eslint":"^7.13.0","prettier":"^2.1.2","typescript":"^3.7.5","lint-staged":"^10.5.1","eslint-plugin-react":"^7.21.5","eslint-config-airbnb":"^18.2.1","eslint-plugin-import":"^2.22.1","eslint-config-prettier":"^6.15.0","eslint-plugin-jsx-a11y":"^6.4.1","@typescript-eslint/parser":"^4.6.1","eslint-plugin-react-hooks":"^4.2.0","@typescript-eslint/eslint-plugin":"^4.6.1"},"_npmOperationalInternal":{"tmp":"tmp/web-client-pkce_1.0.1_1605254007439_0.2623185520464755","host":"s3://npm-registry-packages"}},"1.1.0":{"name":"@10duke/web-client-pkce","version":"1.1.0","keywords":["10Duke","identity","entitlement","licensing","client","oidc","OpenID Connect","PKCE"],"author":{"name":"10Duke"},"license":"MIT","_id":"@10duke/web-client-pkce@1.1.0","maintainers":[{"name":"10duke","email":"opensource@10duke.com"}],"homepage":"https://github.com/10Duke/10duke-web-client-pkce#readme","bugs":{"url":"https://github.com/10Duke/10duke-web-client-pkce/issues"},"dist":{"shasum":"3ddc4399b3065dc9eddc04007165a61432cfd794","tarball":"https://registry.npmjs.org/@10duke/web-client-pkce/-/web-client-pkce-1.1.0.tgz","fileCount":19,"integrity":"sha512-J4eshMaXgshVJfjZ8N37qwQVNgCSsQP/UAsZX7Ly+7OWm6LiAl0AFiJw902kjzze2pCDAazLZuk50nFqXUr9Tg==","signatures":[{"sig":"MEYCIQC/STPe6vOXnjAgp64EGOhWXJKZd0VAw0ATZRoqZ7Q1owIhAPLYrlLGkiJD6LqSm43zJ+DRGf64xepiLHmGK6i1I5Mx","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":76511,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJft6q5CRA9TVsSAnZWagAA8TkP/1Y/QwDSER1xBr//TAgD\nLclZPJr52QuxICisOzaYpumM6PAixMDR1EHB4hA299+G7aJTOyW5CCeZptw0\nmqjZ2rRWqWP+CMc14MZka5WOam9a2X+nP5SvoZbW0w6XcvPGJrIeko6sDYG0\nDsZp3zWAhv7kDC40MfoSu071O7BImiJN3pssqYIZpgviDQP/VgXwnUHXD1Rz\n44K4QegpWT6ZpvmLSsxjihIdn+hHd/s+0nA9komy2npolkiQgYIikXOetd/D\nNIg7mpVc+HJvCLLvR1gNLpgMDl8mrgMoGjw3W/25BpLK9xbQPKCETCyPyQNP\n7M17F6E+U0Sxih6vq2/7vanXlz17F8jjtutwEXmH2Ls8m2o0JXJTKjhIe2cV\n+hXpZYjzIjrgpWDhmZffw5TW2ArRCvyWa5ENNXuIK3ejPcsdCN7UuzUrNbad\nrX+7UelvtbX/U7HKFNJOxI3q6Gjtl2ZAs1H5YgPl5lMEIvGjgSzA2ZgThZ6N\nGRR631weRAZbUWvYa85vFXd3KUF+VEVB5crrYRdatsog3tugM5tMT30i/Xdl\nTI9JEGOuUDyzGEFmJbpZnlfS56aQ628haI77gFzoTIf7M0DnZDc1zI6d1f9f\nzjU/wPKHRyswbNVwzaZWRYjZd7DyIgPVlFirrT5qD17FfaOV03uggOlhsK0T\ncPNw\r\n=VyvP\r\n-----END PGP SIGNATURE-----\r\n"},"main":"lib/index.js","husky":{"hooks":{"pre-commit":"lint-staged"}},"types":"lib/index.d.ts","gitHead":"1e1bef3e6e823ce9081e42250a16d3c25229ed15","scripts":{"lint":"eslint src/**/*.ts","build":"tsc","format":"prettier --write \"src/**/*.ts\"","lint:fix":"eslint src/*.ts --fix","clear-eslint-cache":"rm -rf node_modules/.cache/eslint-loader"},"_npmUser":{"name":"10duke","email":"opensource@10duke.com"},"repository":{"url":"git+ssh://git@github.com/10Duke/10duke-web-client-pkce.git","type":"git"},"_npmVersion":"6.14.4","description":"10Duke Identity and Entitlement client library for browser-based applications","directories":{},"lint-staged":{"*.ts":["eslint --cache --fix","prettier --write"]},"_nodeVersion":"12.18.0","dependencies":{"debug":"^4.2.0","@types/debug":"^4.1.5","jose-jwe-jws":"^0.2.2"},"_hasShrinkwrap":false,"devDependencies":{"husky":"^4.3.0","eslint":"^7.13.0","prettier":"^2.1.2","typescript":"^3.7.5","lint-staged":"^10.5.1","eslint-plugin-react":"^7.21.5","eslint-config-airbnb":"^18.2.1","eslint-plugin-import":"^2.22.1","eslint-config-prettier":"^6.15.0","eslint-plugin-jsx-a11y":"^6.4.1","@typescript-eslint/parser":"^4.6.1","eslint-plugin-react-hooks":"^4.2.0","@typescript-eslint/eslint-plugin":"^4.6.1"},"_npmOperationalInternal":{"tmp":"tmp/web-client-pkce_1.1.0_1605872313221_0.47800508361528604","host":"s3://npm-registry-packages"}},"1.2.0":{"name":"@10duke/web-client-pkce","version":"1.2.0","keywords":["10Duke","identity","entitlement","licensing","client","oidc","OpenID Connect","PKCE"],"author":{"name":"10Duke"},"license":"MIT","_id":"@10duke/web-client-pkce@1.2.0","maintainers":[{"name":"10duke","email":"opensource@10duke.com"}],"homepage":"https://github.com/10Duke/10duke-web-client-pkce#readme","bugs":{"url":"https://github.com/10Duke/10duke-web-client-pkce/issues"},"dist":{"shasum":"40c8e302c4f2c45be5228ace109d683452d27c27","tarball":"https://registry.npmjs.org/@10duke/web-client-pkce/-/web-client-pkce-1.2.0.tgz","fileCount":19,"integrity":"sha512-LkwJrkeeQxWi8Pw6NZkuPtZkVBCJ6ShD31c0DfScsaWOM140HIQqs2uybTUsEOMJDp+ynPejIaCzOkP7q6xs7g==","signatures":[{"sig":"MEUCIBqWmeVOBe++lNZA/KbRh954zWrPuGhPFF5GD/FirJZyAiEAjqKNnUTntkbRTh4pmnTWTgvn6bVwjze5pC/OEokmlU0=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":75727,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjVmTCACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpIRw//RIjquIfrhgmlPOkFjMiM5dqeYCzsoesZL8U1AQI2i3Vk7cNJ\r\nBn/PL6X6faw23gw9vhbHYpyP23N93ZlSaVmFIiuB/aEPhhy7mhw1Ytf8BTDS\r\nI78a94/AXwQVsMjwmoI7F+ei++KmbqiMRwSVamnMwf4R8FsEVpDYZ3eeUOax\r\ngfERjNC3PVwpJRMnvYDje28c+IW6ikpGPmxb86ZhnbD+LgdZBPSY+ZnFS+3u\r\nqLbWkzPJdQyDLaYCmPaq2z6joAav3tSXONLicTRyDCIkdLKOdLLI6Zj7QI95\r\nqglTRao7uETWBewJlYuBt4LAk+VHVS8CQ5JKqYQIqUZFKkqO9pR4Epw148YU\r\nUiOKu84dbGScFuxsHb0Hv9D9OvvCVzFNkrKGyIroA1z3wYnDwoMmfUgGTsds\r\ncfDRAz4Y/JrHU2UNN9oR+OG7Yg0KLNSNbcuSawSBrS3XqAznoM28eRk2HNek\r\nEnqjuubXrYoHVxmHqVM1tc0UTMi6+AERVKZ/Y6M82yML1226W1/7kJ1g110u\r\nzEQhqlB7Huolo9xq+bsAcQENueG+qOmsLJbcnmqZHQMpgD3mRdA2kz5TxVVy\r\nQVfSX0luXWaH3zix+24S90qaHL+La8szUPC6gljkcxWmwjtb9i0XvySSTOOG\r\nAYpBUvXDhvPRoyr+9o3rFgazTrxYUrIPkKE=\r\n=idjw\r\n-----END PGP SIGNATURE-----\r\n"},"main":"lib/index.js","husky":{"hooks":{"pre-commit":"lint-staged"}},"types":"lib/index.d.ts","gitHead":"60702ec706cf0c48e3ec48046cce7ece8b8cb720","scripts":{"lint":"eslint src/**/*.ts","build":"tsc","format":"prettier --write \"src/**/*.ts\"","lint:fix":"eslint src/*.ts --fix","clear-eslint-cache":"rm -rf node_modules/.cache/eslint-loader"},"_npmUser":{"name":"10duke","email":"opensource@10duke.com"},"repository":{"url":"git+ssh://git@github.com/10Duke/10duke-web-client-pkce.git","type":"git"},"_npmVersion":"8.19.2","description":"10Duke Identity and Entitlement client library for browser-based applications","directories":{},"lint-staged":{"*.ts":["eslint --cache --fix","prettier --write"]},"_nodeVersion":"16.18.0","dependencies":{"debug":"^4.3.4","@types/debug":"^4.1.7","jose-jwe-jws":"^0.2.2"},"_hasShrinkwrap":false,"devDependencies":{"husky":"^4.3.0","eslint":"^7.13.0","prettier":"^2.1.2","typescript":"^3.7.5","lint-staged":"^10.5.1","eslint-plugin-react":"^7.21.5","eslint-config-airbnb":"^18.2.1","eslint-plugin-import":"^2.22.1","eslint-config-prettier":"^6.15.0","eslint-plugin-jsx-a11y":"^6.4.1","@typescript-eslint/parser":"^4.6.1","eslint-plugin-react-hooks":"^4.2.0","@typescript-eslint/eslint-plugin":"^4.6.1"},"_npmOperationalInternal":{"tmp":"tmp/web-client-pkce_1.2.0_1666606273922_0.6462962716465079","host":"s3://npm-registry-packages"}},"1.3.0":{"name":"@10duke/web-client-pkce","version":"1.3.0","description":"10Duke Identity and Entitlement client library for browser-based applications","scripts":{"build":"tsc","lint:fix":"eslint src/*.ts --fix","lint":"eslint src/**/*.ts","format":"prettier --write \"src/**/*.ts\"","clear-eslint-cache":"rm -rf node_modules/.cache/eslint-loader"},"repository":{"type":"git","url":"git+ssh://git@github.com/10Duke/10duke-web-client-pkce.git"},"main":"lib/index.js","types":"lib/index.d.ts","keywords":["10Duke","identity","entitlement","licensing","client","oidc","OpenID Connect","PKCE"],"author":{"name":"10Duke"},"license":"MIT","dependencies":{"@types/debug":"^4.1.7","debug":"^4.3.4","jose-jwe-jws":"^0.2.2"},"devDependencies":{"@typescript-eslint/eslint-plugin":"^4.6.1","@typescript-eslint/parser":"^4.6.1","eslint":"^7.13.0","eslint-config-airbnb":"^18.2.1","eslint-config-prettier":"^6.15.0","eslint-plugin-import":"^2.22.1","eslint-plugin-jsx-a11y":"^6.4.1","eslint-plugin-react":"^7.21.5","eslint-plugin-react-hooks":"^4.2.0","husky":"^4.3.0","lint-staged":"^10.5.1","prettier":"^2.1.2","typescript":"^3.7.5"},"husky":{"hooks":{"pre-commit":"lint-staged"}},"lint-staged":{"*.ts":["eslint --cache --fix","prettier --write"]},"_id":"@10duke/web-client-pkce@1.3.0","gitHead":"b526c5c19df1c564b5ef65d03f80b72467a7cec5","bugs":{"url":"https://github.com/10Duke/10duke-web-client-pkce/issues"},"homepage":"https://github.com/10Duke/10duke-web-client-pkce#readme","_nodeVersion":"20.11.1","_npmVersion":"10.2.4","dist":{"integrity":"sha512-YWEBvoGp5xNJRZb6lBIIJ9hA1ZG3/tDaD35wUUEhmLdBtezaxQxNysr1ZO3415HL2EzwtxSDMR35IuS/RC7Mdw==","shasum":"90ad974a2185bda1952a47b5a35a8efa277c0921","tarball":"https://registry.npmjs.org/@10duke/web-client-pkce/-/web-client-pkce-1.3.0.tgz","fileCount":19,"unpackedSize":76187,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIChNSFTcm86Cqi9WqD+PeRoZwNK6XaIWsxs9ieU1kNNgAiEA+MLhQgzJmDDMt/cOsXsOz+d56qMqwoZOMwuHOwcurVo="}]},"_npmUser":{"name":"10duke","email":"opensource@10duke.com"},"directories":{},"maintainers":[{"name":"10duke","email":"opensource@10duke.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/web-client-pkce_1.3.0_1723207472956_0.4196812116656201"},"_hasShrinkwrap":false}},"time":{"created":"2020-11-13T07:40:50.871Z","modified":"2024-08-09T12:44:33.325Z","1.0.0":"2020-11-13T07:40:51.071Z","1.0.1":"2020-11-13T07:53:27.672Z","1.1.0":"2020-11-20T11:38:33.421Z","1.2.0":"2022-10-24T10:11:14.124Z","1.3.0":"2024-08-09T12:44:33.153Z"},"bugs":{"url":"https://github.com/10Duke/10duke-web-client-pkce/issues"},"author":{"name":"10Duke"},"license":"MIT","homepage":"https://github.com/10Duke/10duke-web-client-pkce#readme","keywords":["10Duke","identity","entitlement","licensing","client","oidc","OpenID Connect","PKCE"],"repository":{"type":"git","url":"git+ssh://git@github.com/10Duke/10duke-web-client-pkce.git"},"description":"10Duke Identity and Entitlement client library for browser-based applications","maintainers":[{"name":"10duke","email":"opensource@10duke.com"}],"readme":"# 10Duke Identity and Entitlement client library for browser-based applications\n\nMain features of this library are:\n\n- Authentication / Single Sign-On using [OpenID Connect Authorization Code Flow](https://openid.net/specs/openid-connect-core-1_0.html#CodeFlowAuth) with [Proof Key for Code Exchange (PKCE)](https://tools.ietf.org/html/rfc7636)\n- Single Sign-Out\n- License consumption\n- License release\n\nThe client library currently covers basic use cases for license consumption and release.\n\nThe library uses the [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) for HTTP requests, and [SubtleCrypto of Web Crypto API](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto) for computing PKCE hashes.\n\n> :warning: **SubtleCrypto requires using secure context (HTTPS)**\n>\n> localhost is considered a secure context, but with other hosts HTTPS is required\n\n## Installation\n\n```\nnpm i @10duke/web-client-pkce\n```\n\n## Example\n\nThis library is used by [10Duke Identity and Entitlement React sample client](https://github.com/10Duke/react-sample).\n\n## Basic usage, authentication\n\nThe example linked above gives a real-world example of how to use this client library. Examples of library usage for authentication are given below:\n\n```ts\nimport { Authenticator } from \"@10duke/web-client-pkce\";\nimport { Authentication } from \"@10duke/web-client-pkce\";\n\n// Create authenticator for OpenID Connect authentication and OAuth authorization\n// against the 10Duke server\nconst authenticator = new Authenticator(\n  new URL(\"https://10duke-account.example.com/user/oauth20/authz\"),\n  new URL(\"https://10duke-account.example.com/user/oauth20/token\"),\n  new URL(\"https://10duke-account.example.com/user/oauth20/signout\"),\n  new URL(\"https://10duke-account.example.com/.well-known/jwks.json\"),\n  \"my-client-id\",\n  new URL(\"https://my-client.example.com/logincb\"),\n  \"openid profile email https://apis.10duke.com/auth/openidconnect/organization\"\n);\n\n/**\n * Start login against 10Duke. Browser is directed to 10Duke for login. When login\n * is complete, 10Duke returns the browser back to the client redirect_uri\n * (\"https://my-client.example.com/logincb\" in this example). As dictated by the\n * OpenID Connect spec, client is required to store some state for later use.\n */\nasync function startLogin(state?: string): Promise<void> {\n  const startLoginState = await authenticator.startLogin(\"MyState\");\n  localStorage.setItem(\"startLoginState\", JSON.stringify(startLoginState));\n  window.location.href = startLoginState.url.toString();\n}\n\n/**\n * ...eventually browser is directed back to the client, and client needs to handle\n * OpenID Connect response from 10Duke. An example response URL:\n * https://my-client.example.com/logincb?code=abc123&state=MyState\n *\n * In real life, this response handling would probably not be in the same\n * context / component / code file as starting the login.\n * See the sample projects for a real-life example.\n *\n * @param code Authorization code received as \"code\" query parameter in\n *     the OpenID Connect response from the server\n * @param state State received as \"state\" query parameter in the OpenID Connect\n *     response from the server (optional, only included in the response if client\n *     specified state when starting login)\n */\nasync function completeLogin(\n  code: string,\n  state: string\n): Promise<Authentication> {\n  // Read the state stored when starting login\n  const storedLoginState = localStorage.getItem(\"startLoginState\");\n  const startLoginState = JSON.parse(storedLoginState) as StartLoginResponse;\n  localStorage.removeItem(\"startLoginState\");\n\n  // Complete authentication by exchanging the code to an access token and ID token\n  return await authenticator.completeAuthentication(\n    startLoginState,\n    code,\n    state\n  );\n}\n\n// completeLogin must be called with actual values read from the response URL.\n// Here \"abc123\" and \"MyState\" represent values of \"code\" and \"state\" query parameters,\n// respectively.\nconst authn = await completeLogin(\"abc123\", \"MyState\");\n// The Authentication object can now be used for accessing user details and\n// OAuth access token, for example:\nconst email = authn.getUserEmail();\nconst accessToken = authn.getAccessToken();\n```\n\n## Basic usage, licensing\n\nThe example linked above gives a real-world example of how to use this client library. Examples of library usage for licensing are given below:\n\n```ts\nimport { LicenseChecker } from \"@10duke/web-client-pkce\";\nimport { LicenseCheckResult } from \"@10duke/web-client-pkce\";\nimport { LicenseReleaseResult } from \"@10duke/web-client-pkce\";\n\n// Create license checker for checking, consuming and releasing licenses\nconst licenseChecker = new LicenseChecker(\n  // accessToken received from the server (see the authentication / authorization example)\n  accessToken,\n  new URL(\"https://10duke-account.example.com/authz\"),\n  new URL(\"https://10duke-account.example.com/.well-known/jwks.json\"),\n  // Optional hw parameter for identifying the client hardware, for example hash derived\n  // from baseboard serial number. Can be omitted for browser applications.\n  \"MyHardwareId\"\n);\n\n/**\n * Consumes license for the given licensed item.\n *\n * @param licensedItem Name of licensed item to consume. Typically this is name of\n *    the client application or a licensed feature of the client application.\n */\nasync function consumeLicense(\n  licensedItem: string\n): Promise<LicenseCheckResult> {\n  return licenseChecker.consumeLicense(licensedItem);\n}\n\n// Here \"MyCoolApp\" represents name of the license to check\nconst licenseCheckResult = await consumeLicense(\"MyCoolApp\");\nconst licenseGranted = licenseCheckResult.hasLicense(\"MyCoolApp\");\nconst leaseId = licenseCheckResult.jti;\n\n/**\n * Releases an earlier consumed license.\n *\n * @param leaseId Lease id received when consuming the license\n */\nasync function releaseLicense(leaseId: string): Promise<LicenseReleaseResult> {\n  return licenseChecker.releaseLicense(leaseId);\n}\n\n// Use the earlier received leaseId to release license\nconst licenseReleaseResult = await releaseLicense(leaseId);\nconst licenseReleased = licenseReleaseResult(leaseId);\n```\n","readmeFilename":"README.md"}