{"_id":"xumm-js-pkce","_rev":"1-264a30739d92ca262a33491da114ad8d","name":"xumm-js-pkce","dist-tags":{"latest":"1.0.2"},"versions":{"1.0.0":{"name":"xumm-js-pkce","version":"1.0.0","description":"A package that makes using the OAuth2 PKCE (+Implicit support) flow easier","main":"dist/PKCE.js","types":"dist/PKCE.d.ts","repository":{"type":"git","url":"git+https://github.com/XRPL-Labs/xumm-js-pkce.git"},"scripts":{"build":"tsc","coverage":"jest --coverage","format":"prettier --write \"src/**/*.ts\"","lint":"tslint -p tsconfig.json","test":"jest ./tests","prepare":"npm run build && npm run browserify","prepublishOnly":"npm test && npm run lint","preversion":"npm run lint","version":"npm run format && git add -A src","postversion":"git push && git push --tags","browserify":"npm run build; browserify --standalone PKCE -r ./dist/PKCE.js:PKCE |sed 's/\\(exports.default = PKCE;\\)/\\1 module.exports = PKCE;/g' > dist/browser.js && npm run minify","minify":"cat dist/browser.js | terser --compress --mangle > dist/browser.min.js"},"keywords":["oauth","oauth2","pkce"],"author":{"name":"Bryan Pedroza, extended by Wietse Wind","email":"w@xrpl-labs.com"},"license":"MIT","devDependencies":{"@types/crypto-js":"^3.1.47","@types/jest":"^25.2.3","browserify":"^17.0.0","jest":"^26.4.2","jest-fetch-mock":"^3.0.3","jest-localstorage-mock":"^2.4.3","prettier":"^2.1.2","terser":"^5.15.1","ts-jest":"^26.3.0","tslint":"^6.1.3","tslint-config-prettier":"^1.18.0","typescript":"^4.2.0"},"dependencies":{"crypto-js":"^4.0.0"},"bugs":{"url":"https://github.com/XRPL-Labs/xumm-js-pkce/issues"},"homepage":"https://github.com/XRPL-Labs/xumm-js-pkce/#readme","gitHead":"f283e8248144bbe37b6d8ae8655ab7b485d582ea","_id":"xumm-js-pkce@1.0.0","_nodeVersion":"16.13.0","_npmVersion":"8.6.0","dist":{"integrity":"sha512-qLBbNgQzMUu5sv61xckFe0qqWwq1wyQkTa0in+8T7TUN+O1NB0ii3ewOuAV3o4nvHqLz4tjbP63LuU7o916cpg==","shasum":"0ca5a26a35a12c5a9a09d5f8a4df6f1b2130dfbf","tarball":"https://registry.npmjs.org/xumm-js-pkce/-/xumm-js-pkce-1.0.0.tgz","fileCount":15,"unpackedSize":71389,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDrjLPxHmEkY70peuCocHNbG2NHkZc2ZgqYKXkOz9DsdAiAUCBU9lL+gB0YDimrduKioeUgy7sWmPN7oS5I9iiCl2A=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJje5GmACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmpm9A/+LkX8qO7mYi6DRkNfI4RzjMyIhGc7yRZbctCazcn8kfTRaGrT\r\nhOWdCkAcfhvvnR/3wCwq+/8Nr+uDkQA3L7VO+u78TWZL/EmzXfwDdNgIeCJc\r\ndqxN0kT7YV5j8hfWNziwUhvgKj7FcPcFY/WLrsAa75bnBSurcRcg4rFuHzQP\r\nvEqQSv24alLSGlIvo0YexoGo43NjrGxBmjP12zdX5EaCrAClWyEbxoK1F3fa\r\n99Mbf7RnwXKNAzoO2l7uLgpQo4EV5OKfGvaxt7zTwC6Im2qv5nX/cOyeMFL2\r\n24zMdQ9orqdsiZNw74lPH5ariuZuji41mDYGA8qfT3Lt6ZiJF+ewPJI0v2E9\r\n+RjutrjwIu4B3vzctjkmrGMndmY73Z8s+16fA/j1HUb1d8+E1f4jWQY1wJO+\r\nzSVRBYOuoRlOTlkiX7d+J1C7yyQC0Xh1UoMkKKAf2OAl4+mROxbg+1KO9DAz\r\nWWrdoUY5ZYt70piTolquAuosI87wJh5pXEI3QsEdZ0zSDfN3YlMbnPS3W1gu\r\nEs7fTAQ0Ltzev5DATmdU+1o4uf/zmQkRZiMbi2+KnOlLShUBUnnxDLUA4Gr+\r\nrttUzsioMmU7iDWX8iuPbNKp8dOSCGxXKzIXgfFV6Wi8rFJrTvr0nxMb/ksm\r\nDXUyWaPg9HN8bGEzxYl3clyIkJhHEmJWrHM=\r\n=ZKw+\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"wietsewind","email":"mail@wietse.com"},"directories":{},"maintainers":[{"name":"wietsewind","email":"mail@wietse.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/xumm-js-pkce_1.0.0_1669042598672_0.8569938016364271"},"_hasShrinkwrap":false},"1.0.2":{"name":"xumm-js-pkce","version":"1.0.2","description":"A package that makes using the OAuth2 PKCE (+Implicit support) flow easier","main":"dist/PKCE.js","types":"dist/PKCE.d.ts","repository":{"type":"git","url":"git+https://github.com/XRPL-Labs/xumm-js-pkce.git"},"scripts":{"build":"tsc","coverage":"jest --coverage","format":"prettier --write \"src/**/*.ts\"","lint":"tslint -p tsconfig.json","test":"jest ./tests","prepare":"npm run build && npm run browserify","prepublishOnly":"npm test && npm run lint","preversion":"npm run lint","version":"npm run format && git add -A src","postversion":"git push && git push --tags","browserify":"npm run build; browserify --standalone PKCE -r ./dist/PKCE.js:PKCE |sed 's/\\(exports.default = PKCE;\\)/\\1 module.exports = PKCE;/g' > dist/browser.js && npm run minify","minify":"cat dist/browser.js | terser --compress --mangle > dist/browser.min.js"},"keywords":["oauth","oauth2","pkce"],"author":{"name":"Bryan Pedroza, extended by Wietse Wind","email":"w@xrpl-labs.com"},"license":"MIT","devDependencies":{"@types/crypto-js":"^3.1.47","@types/jest":"^25.2.3","browserify":"^17.0.0","jest":"^26.4.2","jest-fetch-mock":"^3.0.3","jest-localstorage-mock":"^2.4.3","prettier":"^2.1.2","terser":"^5.15.1","ts-jest":"^26.3.0","tslint":"^6.1.3","tslint-config-prettier":"^1.18.0","typescript":"^4.2.0"},"dependencies":{"crypto-js":"^4.0.0"},"bugs":{"url":"https://github.com/XRPL-Labs/xumm-js-pkce/issues"},"homepage":"https://github.com/XRPL-Labs/xumm-js-pkce/#readme","gitHead":"2b64a3ff1d9cd4d2be329a95475c70a30b8903f9","_id":"xumm-js-pkce@1.0.2","_nodeVersion":"18.17.1","_npmVersion":"9.6.7","dist":{"integrity":"sha512-hcadf2mHYBd6vCaKtQhcLJJjoG+1XIIbh2mq+QthheoRHAf3k/gqQNDnVqJnANTK7NBKo7GJWnY2yCkYj/AQzQ==","shasum":"1980407128b5fa105b96d2f048c63592790f9426","tarball":"https://registry.npmjs.org/xumm-js-pkce/-/xumm-js-pkce-1.0.2.tgz","fileCount":15,"unpackedSize":71389,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCP2SriqwtCEaCAE/jqnIFQbhQf71ohnvP051vODqVyQgIhALdTP1dEI9dJ61GT8ePbkTkYWCZ7VRM5X8ZSndahGJi8"}]},"_npmUser":{"name":"wietsewind","email":"mail@wietse.com"},"directories":{},"maintainers":[{"name":"wietsewind","email":"mail@wietse.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/xumm-js-pkce_1.0.2_1699874125172_0.9176925667861531"},"_hasShrinkwrap":false}},"time":{"created":"2022-11-21T14:56:38.670Z","1.0.0":"2022-11-21T14:56:38.809Z","modified":"2023-11-13T11:15:25.551Z","1.0.2":"2023-11-13T11:15:25.355Z"},"maintainers":[{"name":"wietsewind","email":"mail@wietse.com"}],"description":"A package that makes using the OAuth2 PKCE (+Implicit support) flow easier","homepage":"https://github.com/XRPL-Labs/xumm-js-pkce/#readme","keywords":["oauth","oauth2","pkce"],"repository":{"type":"git","url":"git+https://github.com/XRPL-Labs/xumm-js-pkce.git"},"author":{"name":"Bryan Pedroza, extended by Wietse Wind","email":"w@xrpl-labs.com"},"bugs":{"url":"https://github.com/XRPL-Labs/xumm-js-pkce/issues"},"license":"MIT","readme":"# js-pkce\nA package that makes using the OAuth2 PKCE flow easier\n\n## Installation\n`npm i js-pkce`\n\n## Create a new instance\nCreate a new instance of js-pkce with all of the details needed.\n\n```javascript\nimport PKCE from 'js-pkce';\nconst pkce = new PKCE({\n  client_id: 'myclientid',\n  redirect_uri: 'http://localhost:8080/auth',\n  authorization_endpoint: 'https://authserver.com/oauth/authorize',\n  token_endpoint: 'https://authserver.com/oauth/token',\n  requested_scopes: '*',\n});\n```\n\n## Start the authorization process\nTypically you just need to go to the authorization url to start the process.\nThis example is something that might work in a SPA.\n\n```javascript\nwindow.location.replace(pkce.authorizeUrl());\n```\n\nYou may add additional query parameters to the authorize url by using an optional second parameter:\n\n```javascript\nconst additionalParams = {test_param: 'testing'};\nwindow.location.replace(pkce.authorizeUrl(additionalParams));\n```\n\n## Trade the code for a token\nAfter logging in with the authorization server, you will be redirected to the value in\nthe `redirect_uri` parameter you set when creating the instance.\nAgain, this is an example that might work for a SPA.\n\nWhen you get back here, you need to exchange the code for a token.\n\n```javascript\nconst url = window.location.href;\npkce.exchangeForAccessToken(url).then((resp) => {\n  const token = resp.access_token;\n  // Do stuff with the access token.\n});\n```\n\nAs with the authorizeUrl method, an optional second parameter may be passed to\nthe `exchangeForAccessToken` method to send additional parameters to the request:\n\n```javascript\nconst url = window.location.href;\nconst additionalParams = {test_param: 'testing'};\n\npkce.exchangeForAccessToken(url, additionalParams).then((resp) => {\n  const token = resp.access_token;\n  // Do stuff with the access token.\n});\n```\n\n## A note on Storage\nBy default, this package will use `sessionStorage` to persist the `pkce_state`. On (mostly) mobile\ndevices there's a higher chance users are returning in a different browser tab. E.g. they kick off\nin a WebView & get redirected to a new tab. The `sessionStorage` will be empty there.\n\nIn this case it you can opt in to use `localStorage` instead of `sessionStorage`:\n\n```javascript\nimport PKCE from 'js-pkce';\nconst pkce = new PKCE({\n  // ...\n  storage: localStorage, // any Storage object, sessionStorage (default) or localStorage \n});\n```\n","readmeFilename":"README.md"}