diff --git a/README.md b/README.md index 857f798..1d29115 100644 --- a/README.md +++ b/README.md @@ -322,156 +322,3 @@ export default function RootScreen(): ReactElement { ); } ``` - -### Features - -#### 1. Clerk - -> **_NOTE:_** Required dependencies: `@clerk/clerk-expo`, `expo-web-browser`, `expo-auth-session` - -Hooks and helpers to create user authentication with [Clerk Expo SDK](https://clerk.com/docs/references/expo/overview). - -#### `useClerkResources` - -Hook, that provides access to essential Clerk methods and objects. - -Returned Object: - -- `signUp` - provides access to [SignUp](https://clerk.com/docs/references/javascript/sign-up) object. -- `signIn` - provides access to [SignIn](https://clerk.com/docs/references/javascript/sign-in) object. -- `setActive` - A function that sets the active session. -- `signOut` - A function that signs out the current user. - -#### `useAuthWithIdentifier` - -Hook, that provides functionality to handle user sign-up and sign-in processes using an identifier such as an email, phone number, or username. It supports both OTP (One Time Password) and password-based authentication methods. - -Parameters: - -- `method`: Specifies the type of identifier used for authentication (e.g., 'emailAddress', 'phoneNumber', 'username'). -- `verifyBy`: Specifies the verification method ('otp' for one-time passwords or 'password'). - -Returned Object: - -- `startSignUp`: Initiates a new user registration using the specified identifier and verification method. -- `startSignIn`: Initiates authentication of an existing user using the specified identifier and verification method. -- `startAuthorization`: Determines whether to initiate a sign-up or sign-in based on whether the user has been registered previously. -- `verifyCode`: Verifies an OTP code if the verification method is 'otp'. -- `isLoading`: Indicates whether an authentication request is in progress. -- `isVerifying`: Indicates whether an OTP verification is in progress. - -**Example:** - -```ts -import React, { useState } from 'react'; -import { View, TextInput, Button } from 'react-native'; -import { useAuthWithIdentifier } from '@ronas-it/react-native-common-modules/clerk'; - -export const AuthWithIdentifierComponent = () => { - const [identifier, setIdentifier] = useState(''); - const [verificationCode, setVerificationCode] = useState(''); - const { startSignUp, verifyCode, isLoading, isVerifying } = useAuthWithIdentifier('emailAddress', 'otp'); - - const handleSignUp = async () => { - await startSignUp({ identifier }); - }; - - const handleVerifyCode = async () => { - const result = await verifyCode({ code: verificationCode }); - console.log(result.sessionToken) - }; - - return ( - - - -