Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,14 @@ Returned Object:
- `isCreating`: A boolean indicating whether an identifier is currently being added.
- `isVerifying`: A boolean indicating whether a verification code is currently being processed.

#### `useUpdateIdentifier`

Hook to update the user's primary identifier (email or phone): add and verify a new one, then set it as primary and remove the old one.

Returned Object:

- `createIdentifier`, `verifyCode`, `isCreating`, `isVerifying`, `isUpdating` — see JSDoc.

#### `useOtpVerification`

Hook provides functionality for managing OTP (One Time Password) verification in user authentication workflows, supporting both sign-up and sign-in processes.
Expand All @@ -459,3 +467,11 @@ Returned Object:
- `resetPassword`: A function to reset the user's password by verifying the code and setting a new password.
- `isCodeSending`: A boolean indicating if the verification code is being sent.
- `isResetting`: A boolean indicating if the password is being reset.

#### `useChangePassword`

Hook to update the current user's password (requires current and new password).

Returned Object:

- `updatePassword`, `isPasswordUpdating` — see JSDoc.
2 changes: 0 additions & 2 deletions src/lib/src/features/clerk/hooks/use-reset-password.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@


import { useState } from 'react';
import { OtpMethod, UseResetPasswordReturn } from '../types';
import { useClerkResources } from './use-clerk-resources';
Expand Down
11 changes: 11 additions & 0 deletions src/lib/src/features/clerk/hooks/use-update-password.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@ import { useUser } from '@clerk/clerk-expo';
import { useState } from 'react';
import { UseUpdatePasswordReturn } from '../types';

/**
* Hook that provides functionality to update the current user's password.
*
* Requires the user to supply both the current password (for verification) and
* the new password. On success, the user's password is updated in Clerk; on
* failure, the hook returns an error without throwing.
*
* @returns {UseUpdatePasswordReturn} Object containing:
* - `updatePassword` — Updates the user's password using current and new password
* - `isPasswordUpdating` — Indicates whether a password update is currently in progress
*/
export const useChangePassword = (): UseUpdatePasswordReturn => {
const { user } = useUser();
const [isPasswordUpdating, setIsPasswordUpdating] = useState(false);
Expand Down
Loading