{"_id":"@cardbrother/expo-jwt","_rev":"2-698d8a74d2453b7d6f8ef7756068df3b","name":"@cardbrother/expo-jwt","dist-tags":{"latest":"1.8.0-beta-2"},"versions":{"1.8.0-beta":{"name":"@cardbrother/expo-jwt","version":"1.8.0-beta","keywords":["expo","jwt","react-native"],"author":{"name":"ZiChun Guo","email":"guotingchaopr@gmail.com"},"license":"MIT","_id":"@cardbrother/expo-jwt@1.8.0-beta","maintainers":[{"name":"guozichun","email":"guotingchaopr@gmail.com"}],"homepage":"https://github.com/guotingchao/expo-jwt","bugs":{"url":"https://github.com/guotingchao/expo-jwt/issues"},"dist":{"shasum":"81f3ce5e3bdfb77ef4ccba972bf121f8c3d5fc30","tarball":"https://registry.npmjs.org/@cardbrother/expo-jwt/-/expo-jwt-1.8.0-beta.tgz","fileCount":23,"integrity":"sha512-lCNtG32yTixHZNtRPSVNRT0QO0f569z/hoOoex5TjIXDqIYp2F+gbsrorfeEUVsg48qYcpx4ftNi0qJrzfdRJg==","signatures":[{"sig":"MEUCIEuMDWIfbba9eZjHQvI22fmhabetHeDCmJEFzyfwqBUjAiEA9L/NTiAhNW3wNbkd1tQ2i0UQ4FfcO2zfQ+EmLEpYUyA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":29545},"main":"dist/lib/index.js","types":"dist/lib/index.d.ts","gitHead":"bf22ba05fbd917c19cf8af52ec2664ac02ecb2b7","scripts":{"test":"npx jest","build":"rm -rf dist && npm run compile","sanity":"npm run compile && npm test","compile":"npx tsc","prepublish":"npm run sanity && npm run build","test:watch":"npx jest --watchAll","test:coverage":"npx jest --coverage"},"_npmUser":{"name":"guozichun","email":"guotingchaopr@gmail.com"},"repository":{"url":"git+https://github.com/guotingchao/expo-jwt.git","type":"git"},"_npmVersion":"10.7.0","description":"Generate and decode JWT inside of an React Native Expo app","directories":{},"_nodeVersion":"18.20.4","dependencies":{"crypto-js":"^4.2.0"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","ts-jest":"^29.1.4","typescript":"^4.0.3","@types/jest":"^26.0.15","@types/crypto-js":"^4.0.1"},"_npmOperationalInternal":{"tmp":"tmp/expo-jwt_1.8.0-beta_1731688410867_0.1530235537430613","host":"s3://npm-registry-packages"}},"1.8.0-beta-1":{"name":"@cardbrother/expo-jwt","version":"1.8.0-beta-1","keywords":["expo","jwt","react-native"],"author":{"name":"ZiChun Guo","email":"guotingchaopr@gmail.com"},"license":"MIT","_id":"@cardbrother/expo-jwt@1.8.0-beta-1","maintainers":[{"name":"guozichun","email":"guotingchaopr@gmail.com"}],"homepage":"https://github.com/guotingchao/expo-jwt","bugs":{"url":"https://github.com/guotingchao/expo-jwt/issues"},"dist":{"shasum":"7dd9e9490627922d6984d080564085d01279f8fb","tarball":"https://registry.npmjs.org/@cardbrother/expo-jwt/-/expo-jwt-1.8.0-beta-1.tgz","fileCount":23,"integrity":"sha512-CR8nZqUt7yAqq7tLwwC4b2VJ6IggwO5gOQfBnQxn4CrQta1JQLSmRGewjDNjpwPNNCJ5TPJp7KNnCwNHV3yOrg==","signatures":[{"sig":"MEUCIAwWxlSwcayxqlUpSC2E9gGR81ml3C5oYjVDgFCmzbOmAiEAvx2NL3jAvxajMlKwbM+xNaGVXC+LO3zlWXpzII+ORY0=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":29593},"main":"dist/lib/index.js","_from":"file:cardbrother-expo-jwt-1.8.0-beta-1.tgz","types":"dist/lib/index.d.ts","scripts":{"test":"npx jest","build":"rm -rf dist && npm run compile","sanity":"npm run compile && npm test","compile":"npx tsc","prepublish":"npm run sanity && npm run build","test:watch":"npx jest --watchAll","test:coverage":"npx jest --coverage"},"_npmUser":{"name":"guozichun","email":"guotingchaopr@gmail.com"},"_resolved":"/private/var/folders/16/wt7hv8z56vd7w5h8ylkllkgm0000gn/T/a232452514abf6c4a0d3b5dc8f9c7e4a/cardbrother-expo-jwt-1.8.0-beta-1.tgz","_integrity":"sha512-CR8nZqUt7yAqq7tLwwC4b2VJ6IggwO5gOQfBnQxn4CrQta1JQLSmRGewjDNjpwPNNCJ5TPJp7KNnCwNHV3yOrg==","repository":{"url":"git+https://github.com/guotingchao/expo-jwt.git","type":"git"},"_npmVersion":"10.9.0","description":"Generate and decode JWT inside of an React Native Expo app","directories":{},"_nodeVersion":"20.18.0","dependencies":{"crypto-js":"^4.2.0","@changesets/cli":"^2.27.9"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","ts-jest":"^29.1.4","typescript":"^4.0.3","@types/jest":"^26.0.15","@types/crypto-js":"^4.0.1"},"_npmOperationalInternal":{"tmp":"tmp/expo-jwt_1.8.0-beta-1_1731689377551_0.9489234477064368","host":"s3://npm-registry-packages"}},"1.8.0-beta-2":{"name":"@cardbrother/expo-jwt","version":"1.8.0-beta-2","description":"Generate and decode JWT inside of an React Native Expo app","main":"dist/lib/index.js","types":"dist/lib/index.d.ts","author":{"name":"ZiChun Guo","email":"guotingchaopr@gmail.com"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/guotingchao/expo-jwt.git"},"homepage":"https://github.com/guotingchao/expo-jwt","bugs":{"url":"https://github.com/guotingchao/expo-jwt/issues"},"keywords":["expo","jwt","react-native"],"dependencies":{"@changesets/cli":"^2.27.9","crypto-js":"^4.2.0"},"devDependencies":{"@types/crypto-js":"^4.0.1","@types/jest":"^26.0.15","jest":"^29.7.0","ts-jest":"^29.1.4","typescript":"^4.0.3"},"scripts":{"compile":"npx tsc","build":"rm -rf dist && npm run compile","prepublish":"npm run sanity && npm run build","sanity":"npm run compile && npm test","test":"npx jest","test:watch":"npx jest --watchAll","test:coverage":"npx jest --coverage"},"_id":"@cardbrother/expo-jwt@1.8.0-beta-2","_integrity":"sha512-DC/YKIxGh0kqNWpGvpal1AwbS7eV1rNto7WyEc9WEcJ+A80kVzYdksV8G6BxgJMr/Sik41vKMxPEcegniKt1Ng==","_resolved":"/private/var/folders/16/wt7hv8z56vd7w5h8ylkllkgm0000gn/T/4315f6683af4cac131399521afdeae20/cardbrother-expo-jwt-1.8.0-beta-2.tgz","_from":"file:cardbrother-expo-jwt-1.8.0-beta-2.tgz","_nodeVersion":"20.18.0","_npmVersion":"10.9.0","dist":{"integrity":"sha512-DC/YKIxGh0kqNWpGvpal1AwbS7eV1rNto7WyEc9WEcJ+A80kVzYdksV8G6BxgJMr/Sik41vKMxPEcegniKt1Ng==","shasum":"db11b70eb823c11857a9ffeed470a84ce41311d3","tarball":"https://registry.npmjs.org/@cardbrother/expo-jwt/-/expo-jwt-1.8.0-beta-2.tgz","fileCount":23,"unpackedSize":30481,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBNawyebiDqY+WoXU1rbvXywwLDNIWx1Z1k0JS7jvN0gAiAnaJ6Soz+dxHVhXZ0eI1DlhY+hlJHCeBexY6zR9pAPTg=="}]},"_npmUser":{"name":"guozichun","email":"guotingchaopr@gmail.com"},"directories":{},"maintainers":[{"name":"guozichun","email":"guotingchaopr@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/expo-jwt_1.8.0-beta-2_1732786001000_0.9190710518874519"},"_hasShrinkwrap":false}},"time":{"created":"2024-11-15T16:33:30.747Z","modified":"2024-11-28T09:26:41.453Z","1.8.0-beta":"2024-11-15T16:33:31.091Z","1.8.0-beta-1":"2024-11-15T16:49:37.811Z","1.8.0-beta-2":"2024-11-28T09:26:41.253Z"},"bugs":{"url":"https://github.com/guotingchao/expo-jwt/issues"},"author":{"name":"ZiChun Guo","email":"guotingchaopr@gmail.com"},"license":"MIT","homepage":"https://github.com/guotingchao/expo-jwt","keywords":["expo","jwt","react-native"],"repository":{"type":"git","url":"git+https://github.com/guotingchao/expo-jwt.git"},"description":"Generate and decode JWT inside of an React Native Expo app","maintainers":[{"name":"guozichun","email":"guotingchaopr@gmail.com"}],"readme":"## Why fork?\n\n### :warning: Note\n\nThis is an issue I encountered during a project while collaborating with my colleagues on encryption and decryption with the server.\n\nWhen our JWT contains a complex URL object, I encountered an error during decoding: enc_base64_1.default.parse(encodedString).toString(enc_utf8_1.default).\n\nAfter debugging the code, I discovered that the error occurred during the parse stage.\n\n**For example:**\n\n> `https://xxx.com/a-b-cdef-gg/12-32s-ggg/ABCE-111.png?AXSD/50x50`\n\n**becomes:**\n\n> `https://xxx.com/a-b-cdef-gg/12-32s-ggg/ABCE-111.pngAXSD/50x50.`\n\n**This issue arises from the following code:**\n\n```ts\nencodedString.replace(/[\\x00-\\x1F\\x7F]/g, \"\");\n```\n\n_Additionally, if I remove control characters, the ? in the URL parameter is also removed._\n\n_I resolved this problem by adding a safeUrlBase64To64 method. After testing, everything works fine._\n\n---\n\n# expo-jwt [![Build Status](https://app.travis-ci.com/blake-simpson/expo-jwt.svg?branch=master)](https://app.travis-ci.com/blake-simpson/expo-jwt)\n\nA library for encoding or decoding JSON Web Tokens (JWT) in an Expo based React\nNative project.\n\nIn an Expo project the JavaScript environment is not node.js so specific objects\nsuch as `Stream` are not available, rendering many of the popular node-based JWT\nlibraries on NPM unusable with Expo.\n\nAdditionally unless the Expo project is \"ejected\" there is no access to the\niOS/Android native code as other React Native specific JWT libraries have done.\n\nThis library implements HMAC-SHA signing for JWT by using Crypto.JS in pure\nJavaScript so it can be used inside of an Expo project.\n\n## Supported Algorithms\n\n| HS256 | HS384 | HS512 | RS256 | RS384 | RS512 | ES256 | ES384 | ES512 |\n| ----- | ----- | ----- | ----- | ----- | ----- | ----- | ----- | ----- |\n| Yes   | Yes   | Yes   | No    | No    | No    | No    | No    | No    |\n\n## Supported Claims\n\n| exp | nbf | iat | sub | iss | aud | jti |\n| --- | --- | --- | --- | --- | --- | --- |\n| Yes | Yes | Yes | Yes | Yes | Yes | No  |\n\n## Installation\n\n```bash\nnpm install --save @cardbrother/expo-jwt\n```\n\n## Usage\n\n### Encode\n\n```js\nimport JWT, { SupportedAlgorithms } from \"expo-jwt\";\n\nconst key = \"shh\";\n\nJWT.encode({ foo: \"bar\" }, key);\n// => eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJmb28iOiJiYXIifQ.YVoZ0LkWCMCnwEf7Nju2SJt_9mseJP1Q3RvCz4frGwM\n\nJWT.encode({ foo: \"bar\" }, key, { algorithm: SupportedAlgorithms.HS512 });\n// => eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJmb28iOiJiYXIifQ.Kyojwz8Z5SckLbMU-EImuzHEjjg_1apSOLz_tsZQj1025OH--qaORzkHUkScScd8-RZnWUdCu0epiaofQZNkBA\n\nJWT.encode({ foo: \"bar\" }, key, { algorithm: SupportedAlgorithms.NONE });\n// => eyJhbGciOiJub25lIiwidHlwIjoiSldUIn0.eyJmb28iOiJiYXIifQ.\n```\n\n### Decode\n\n```js\nimport JWT from \"expo-jwt\";\n\nconst key = \"shh\";\nconst token =\n  \"eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJmb28iOiJiYXIifQ.Kyojwz8Z5SckLbMU-EImuzHEjjg_1apSOLz_tsZQj1025OH--qaORzkHUkScScd8-RZnWUdCu0epiaofQZNkBA\";\n\nJWT.decode(token, key);\n// => { foo: 'bar' }\n```\n\n## TypeScript\n\nIf you would like to take advantage of a typed `decode` object body, you may pass a generic:\n\n```ts\nconst foo = JWT.decode(token, key);\n// foo.body === any\n\ntype MyType = Record<string, number>;\nconst bar = JWT.decode<MyType>(token, key);\n// bar.body === MyType\n```\n\n## JWT Claims\n\nThe claims `exp`, `nbf`, and `iat` will automatically be verified if the decoded\npayload of the JWT contains any of them.\n\nThe `iss`, `sub`, and `aud` claims can be verified by passing in the expected\nvalue to the `decode` options.\n\n```js\n// Issuer - iss\nJWT.decode(token, key, { iss: \"expected-issuer\" });\n\n// Subject - sub\nJWT.decode(token, key, { sub: \"expected-subject\" });\n\n// Audience - aud\nJWT.decode(token, key, { aud: \"expected-audience\" });\n```\n\n### Time Skew\n\nAs mentioned in [issue 7](https://github.com/kartenmacherei/expo-jwt/issues/7)\ncertain device clocks may be slightly off, causing time based claims to fail. If\nyou are experiencing this issue you can pass the option `timeSkew` to\n`JWT.decode` which will take this into account.\n\nThe value of this parameter is the number of seconds that the claim can be\nskewed by. Example:\n\n```js\n// Allow verification of tokens that include \"exp\", \"nbf\", or \"iat\" claims\n// within an additional 30 seconds of the system time.\nJWT.decode(token, key, { timeSkew: 30 });\n```\n","readmeFilename":"README.md"}