{"_id":"@cabin-id/expo","_rev":"4-5b383f31bd0333da7b93088f079fdc32","name":"@cabin-id/expo","dist-tags":{"latest":"0.2.4"},"versions":{"0.2.1":{"name":"@cabin-id/expo","version":"0.2.1","keywords":["react","react-native","expo","auth","authentication","cabinid","session","jwt"],"author":{"name":"CabinID"},"license":"MIT","_id":"@cabin-id/expo@0.2.1","maintainers":[{"name":"admincabinid","email":"admin@cabineat.vn"},{"name":"kienha","email":"minhkien2208@gmail.com"}],"homepage":"https://cabinid.dev/","bugs":{"url":"https://github.com/cabinid/cabin-sdk/issues"},"dist":{"shasum":"44120ea2cbe7da80fa1db100bc9024a7d4cddb75","tarball":"https://registry.npmjs.org/@cabin-id/expo/-/expo-0.2.1.tgz","fileCount":42,"integrity":"sha512-3w/UIg0Btqkr3GR/OVov3vMqa4GI1UEezoiZemEWWAS6wRQRA/h5kvSiXfld9JQEvRa8M8kxf29R0+a2IEIyng==","signatures":[{"sig":"MEUCIQDyysB8ayK3BYuA5J2xmYLDltwk/NmCxT6RNMcy6nzX9AIgGC3VvfDPyEFdN6MMLUYlYsqlHNNYuT0FgxCFcI1mMz8=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":231618},"main":"./dist/index.js","types":"./dist/index.d.ts","module":"./dist/index.mjs","source":"./src/index.ts","engines":{"node":">=18.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"},"./token-cache":{"types":"./dist/token-cache/index.d.ts","import":"./dist/token-cache/index.mjs","require":"./dist/token-cache/index.js"}},"gitHead":"789667404b8bef9c5c9c6e8298fd2452d555479a","scripts":{"dev":"tsup --watch","lint":"eslint src","build":"tsup","clean":"rimraf ./dist","typecheck":"tsc --noEmit"},"_npmUser":{"name":"admincabinid","email":"admin@cabineat.vn"},"repository":{"url":"git+https://github.com/cabinid/cabin-sdk.git","type":"git","directory":"packages/expo"},"_npmVersion":"10.9.0","description":"CabinID React Native/Expo SDK for authentication","directories":{},"_nodeVersion":"22.12.0","dependencies":{"tslib":"^2.6.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.0","react":"^18.2.0","rimraf":"^5.0.0","typescript":"^5.3.0","@types/react":"^18.2.0","react-native":"^0.73.0","expo-secure-store":"^12.8.0"},"peerDependencies":{"expo":">=50","react":">=18","react-native":">=0.73","expo-secure-store":">=12.4.0"},"peerDependenciesMeta":{"expo-secure-store":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/expo_0.2.1_1767688220586_0.6745272052083682","host":"s3://npm-registry-packages-npm-production"}},"0.2.2":{"name":"@cabin-id/expo","version":"0.2.2","keywords":["react","react-native","expo","auth","authentication","cabinid","session","jwt"],"author":{"name":"CabinID"},"license":"MIT","_id":"@cabin-id/expo@0.2.2","maintainers":[{"name":"admincabinid","email":"admin@cabineat.vn"},{"name":"kienha","email":"minhkien2208@gmail.com"}],"homepage":"https://cabinid.dev/","bugs":{"url":"https://github.com/cabinid/cabin-sdk/issues"},"dist":{"shasum":"d5a43e94f38f60f845e1a87ab7e0c2acc66e4b32","tarball":"https://registry.npmjs.org/@cabin-id/expo/-/expo-0.2.2.tgz","fileCount":42,"integrity":"sha512-+kB9mjC/UkrRzsHKxvWGn706R43qA5TDblzi9bfPEWAqGE5IpWY3U2ZIRKEhznLox/Mm77oBKyqloFndP+3vNw==","signatures":[{"sig":"MEUCIQDPLjzeZW0FsUPJb3bVkdyo8Cvcv+EGwChqovZiyVGseAIgS6g6KUnBraGvyJ9m44uHsVeFt140Mu8QzIP5BIu2/jY=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":231618},"main":"./dist/index.js","types":"./dist/index.d.ts","module":"./dist/index.mjs","source":"./src/index.ts","engines":{"node":">=18.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"},"./token-cache":{"types":"./dist/token-cache/index.d.ts","import":"./dist/token-cache/index.mjs","require":"./dist/token-cache/index.js"}},"gitHead":"789667404b8bef9c5c9c6e8298fd2452d555479a","scripts":{"dev":"tsup --watch","lint":"eslint src","build":"tsup","clean":"rimraf ./dist","typecheck":"tsc --noEmit"},"_npmUser":{"name":"admincabinid","email":"admin@cabineat.vn"},"repository":{"url":"git+https://github.com/cabinid/cabin-sdk.git","type":"git","directory":"packages/expo"},"_npmVersion":"10.9.0","description":"CabinID React Native/Expo SDK for authentication","directories":{},"_nodeVersion":"22.12.0","dependencies":{"tslib":"^2.6.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.0","react":"^18.2.0","rimraf":"^5.0.0","typescript":"^5.3.0","@types/react":"^18.2.0","react-native":"^0.73.0","expo-secure-store":"^12.8.0"},"peerDependencies":{"expo":">=50","react":">=18","react-native":">=0.73","expo-secure-store":">=12.4.0"},"peerDependenciesMeta":{"expo-secure-store":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/expo_0.2.2_1767688295157_0.07280904080353645","host":"s3://npm-registry-packages-npm-production"}},"0.2.3":{"name":"@cabin-id/expo","version":"0.2.3","keywords":["react","react-native","expo","auth","authentication","cabinid","session","jwt"],"author":{"name":"CabinID"},"license":"MIT","_id":"@cabin-id/expo@0.2.3","maintainers":[{"name":"admincabinid","email":"admin@cabineat.vn"},{"name":"kienha","email":"minhkien2208@gmail.com"}],"homepage":"https://cabinid.dev/","bugs":{"url":"https://github.com/cabinid/cabin-sdk/issues"},"dist":{"shasum":"7c8fcc510c080e86d9973f640cfba34188bc0a8b","tarball":"https://registry.npmjs.org/@cabin-id/expo/-/expo-0.2.3.tgz","fileCount":42,"integrity":"sha512-aNhH3VD7vGbCG+fShmO8/zEBKwx36KsazKuy5fqYqyhntnGkqwwkKt2voO6HLomlHAJqHbKPu7GgXBRrWBygDg==","signatures":[{"sig":"MEUCIAw0kbRl01eParsiUalGBNfe+TNn4juvUPGkcFd36+ohAiEAz+xduqAyj8FcEiwRsIALo9GCIs/2Q80W4agSc6UJMx0=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":229894},"main":"./dist/index.js","types":"./dist/index.d.ts","module":"./dist/index.mjs","source":"./src/index.ts","engines":{"node":">=18.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"},"./token-cache":{"types":"./dist/token-cache/index.d.ts","import":"./dist/token-cache/index.mjs","require":"./dist/token-cache/index.js"}},"gitHead":"3a767b2f3a4aea6c445a1021fd5870529189631b","scripts":{"dev":"tsup --watch","lint":"eslint src","build":"tsup","clean":"rimraf ./dist","typecheck":"tsc --noEmit"},"_npmUser":{"name":"admincabinid","email":"admin@cabineat.vn"},"repository":{"url":"git+https://github.com/cabinid/cabin-sdk.git","type":"git","directory":"packages/expo"},"_npmVersion":"10.9.0","description":"CabinID React Native/Expo SDK for authentication","directories":{},"_nodeVersion":"22.12.0","dependencies":{"tslib":"^2.6.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.0","react":"^18.2.0","rimraf":"^5.0.0","typescript":"^5.3.0","@types/react":"^18.2.0","react-native":"^0.73.0","expo-secure-store":"^12.8.0"},"peerDependencies":{"expo":">=50","react":">=18","react-native":">=0.73","expo-secure-store":">=12.4.0"},"peerDependenciesMeta":{"expo-secure-store":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/expo_0.2.3_1767951979905_0.12316850734498441","host":"s3://npm-registry-packages-npm-production"}},"0.2.4":{"name":"@cabin-id/expo","version":"0.2.4","description":"CabinID React Native/Expo SDK for authentication","keywords":["react","react-native","expo","auth","authentication","cabinid","session","jwt"],"homepage":"https://cabinid.dev/","repository":{"type":"git","url":"git+https://github.com/cabinid/cabin-sdk.git","directory":"packages/expo"},"license":"MIT","author":{"name":"CabinID"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"},"./token-cache":{"types":"./dist/token-cache/index.d.ts","import":"./dist/token-cache/index.mjs","require":"./dist/token-cache/index.js"}},"main":"./dist/index.js","module":"./dist/index.mjs","types":"./dist/index.d.ts","source":"./src/index.ts","scripts":{"build":"tsup","dev":"tsup --watch","clean":"rimraf ./dist","typecheck":"tsc --noEmit","lint":"eslint src"},"dependencies":{"tslib":"^2.6.0"},"devDependencies":{"@types/react":"^18.2.0","expo-secure-store":"^12.8.0","react":"^18.2.0","react-native":"^0.73.0","rimraf":"^5.0.0","tsup":"^8.0.0","typescript":"^5.3.0"},"peerDependencies":{"expo":">=50","expo-secure-store":">=12.4.0","react":">=18","react-native":">=0.73"},"peerDependenciesMeta":{"expo-secure-store":{"optional":true}},"engines":{"node":">=18.0.0"},"publishConfig":{"access":"public"},"_id":"@cabin-id/expo@0.2.4","gitHead":"1b554a85aae38fb75c820fbf7de0e5ebc7dc2c9a","bugs":{"url":"https://github.com/cabinid/cabin-sdk/issues"},"_nodeVersion":"22.12.0","_npmVersion":"10.9.0","dist":{"integrity":"sha512-wUfQQgJoVUqJ8heTp5PUkiAdE4ZylVZ68Gv4S3aGEEFUGE2vIBWi1TSeiZXE6qh4K6hZ1LfIOieKwZqPHZMo0w==","shasum":"a31db5f1f14c762149e40ac529754010b26a368b","tarball":"https://registry.npmjs.org/@cabin-id/expo/-/expo-0.2.4.tgz","fileCount":39,"unpackedSize":226774,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIHYxVQdWAHv6Sbq5lzNHffnZYOAXLKS1EU5lV/583JRjAiAXuek3O046wxLDPnEroOuqWLLY6BPfwV98kKViilhxzg=="}]},"_npmUser":{"name":"admincabinid","email":"admin@cabineat.vn"},"directories":{},"maintainers":[{"name":"admincabinid","email":"admin@cabineat.vn"},{"name":"kienha","email":"minhkien2208@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/expo_0.2.4_1767958440228_0.9163785099484294"},"_hasShrinkwrap":false}},"time":{"created":"2026-01-06T08:30:20.513Z","modified":"2026-01-09T11:34:00.598Z","0.2.1":"2026-01-06T08:30:20.731Z","0.2.2":"2026-01-06T08:31:35.332Z","0.2.3":"2026-01-09T09:46:20.053Z","0.2.4":"2026-01-09T11:34:00.385Z"},"bugs":{"url":"https://github.com/cabinid/cabin-sdk/issues"},"author":{"name":"CabinID"},"license":"MIT","homepage":"https://cabinid.dev/","keywords":["react","react-native","expo","auth","authentication","cabinid","session","jwt"],"repository":{"type":"git","url":"git+https://github.com/cabinid/cabin-sdk.git","directory":"packages/expo"},"description":"CabinID React Native/Expo SDK for authentication","maintainers":[{"name":"admincabinid","email":"admin@cabineat.vn"},{"name":"kienha","email":"minhkien2208@gmail.com"}],"readme":"# @cabin-id/expo\n\nCabinID SDK for React Native/Expo applications. Provides authentication functionality including sign-in, sign-up, OTP verification, and password reset flows.\n\n## Installation\n\n```bash\nnpm install @cabin-id/expo expo-secure-store\n# or\nyarn add @cabin-id/expo expo-secure-store\n```\n\n## Quick Start\n\n### 1. Setup Provider\n\nWrap your app with `CabinIDProvider`:\n\n```tsx\nimport { CabinIDProvider } from '@cabin-id/expo';\n\nconst config = {\n  apiUrl: 'https://api.cabinid.dev',\n  projectId: 'your-project-id',\n};\n\nexport default function App() {\n  return (\n    <CabinIDProvider config={config}>\n      <YourApp />\n    </CabinIDProvider>\n  );\n}\n```\n\n### 2. Use Authentication Hooks\n\n```tsx\nimport { useAuth, useUser } from '@cabin-id/expo';\n\nfunction ProfileScreen() {\n  const { signOut, isSignedIn } = useAuth();\n  const { user } = useUser();\n\n  if (!isSignedIn) {\n    return <LoginScreen />;\n  }\n\n  return (\n    <View>\n      <Text>Welcome, {user?.firstName}!</Text>\n      <Button title=\"Sign Out\" onPress={signOut} />\n    </View>\n  );\n}\n```\n\n### 3. Sign In\n\n```tsx\nimport { useSignIn } from '@cabin-id/expo';\n\nfunction SignInScreen() {\n  const { signIn, isLoading, error } = useSignIn();\n\n  const handleSignIn = async () => {\n    try {\n      await signIn({\n        phoneNumber: '+84987654321',\n        password: 'yourPassword',\n      });\n      // User is now signed in\n    } catch (err) {\n      // Handle error\n    }\n  };\n\n  return (\n    <View>\n      {error && <Text style={{ color: 'red' }}>{error}</Text>}\n      <Button \n        title={isLoading ? 'Signing in...' : 'Sign In'} \n        onPress={handleSignIn}\n        disabled={isLoading}\n      />\n    </View>\n  );\n}\n```\n\n### 4. Sign Up with OTP\n\n```tsx\nimport { useSignUp, useOTP } from '@cabin-id/expo';\n\nfunction SignUpScreen() {\n  const { signUp, isLoading } = useSignUp();\n  const { sendOTP, verifyOTP, isLoading: otpLoading } = useOTP();\n\n  const handleSendOTP = async (phoneNumber: string) => {\n    await sendOTP({ phoneNumber, type: 'sign_up' });\n  };\n\n  const handleVerifyAndSignUp = async (phoneNumber: string, otp: string, password: string) => {\n    await verifyOTP({ phoneNumber, otp });\n    await signUp({ phoneNumber, password });\n  };\n}\n```\n\n### 5. Password Reset\n\n```tsx\nimport { useResetPassword } from '@cabin-id/expo';\n\nfunction ForgotPasswordScreen() {\n  const { \n    sendResetOTP, \n    verifyResetOTP, \n    resetPassword, \n    step,\n    isLoading, \n    error \n  } = useResetPassword();\n\n  // step: 'phone' | 'otp' | 'password' | 'complete'\n  \n  const handleSendOTP = () => sendResetOTP({ phoneNumber: '+84...' });\n  const handleVerifyOTP = () => verifyResetOTP({ phoneNumber: '+84...', otp: '123456' });\n  const handleResetPassword = () => resetPassword({ otp: '123456', newPassword: 'newPass' });\n}\n```\n\n## Components\n\n### SignedIn / SignedOut\n\nConditional rendering based on auth state:\n\n```tsx\nimport { SignedIn, SignedOut } from '@cabin-id/expo';\n\nfunction App() {\n  return (\n    <>\n      <SignedIn>\n        <HomeScreen />\n      </SignedIn>\n      <SignedOut>\n        <LoginScreen />\n      </SignedOut>\n    </>\n  );\n}\n```\n\n### ProtectedRoute\n\nRoute protection with loading state:\n\n```tsx\nimport { ProtectedRoute } from '@cabin-id/expo';\n\nfunction ProtectedScreen() {\n  return (\n    <ProtectedRoute \n      fallback={<LoginScreen />}\n      loadingComponent={<LoadingSpinner />}\n    >\n      <DashboardScreen />\n    </ProtectedRoute>\n  );\n}\n```\n\n## API Reference\n\n### Hooks\n\n| Hook | Description |\n|------|-------------|\n| `useAuth()` | Main auth hook with signIn, signUp, signOut |\n| `useUser()` | Access current user data |\n| `useSignIn()` | Sign in with loading state |\n| `useSignUp()` | Sign up with loading state |\n| `useOTP()` | Send and verify OTP |\n| `useResetPassword()` | Complete password reset flow |\n\n### Types\n\n```typescript\ninterface CabinIDConfig {\n  apiUrl: string;\n  projectId?: string;\n  apiVersion?: string; // default: 'v2'\n}\n\ninterface User {\n  id: string;\n  phoneNumber: string;\n  firstName?: string;\n  lastName?: string;\n  email?: string;\n}\n```\n\n## Token Storage\n\nThe SDK automatically stores tokens securely using `expo-secure-store` on native platforms and falls back to localStorage on web.\n\n## License\n\nMIT\n","readmeFilename":"README.md"}