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
9 changes: 9 additions & 0 deletions .changeset/afraid-cheetahs-smash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
'@clerk/nextjs': minor
---

Introduce the `useReverification()` hook that handles the session reverification flow:
- Replaces `__experimental_useReverification` with `useReverification`
Also replaces the following APIs:
- `____experimental_reverificationError` -> `__reverificationError`
- `__experimental_reverificationErrorResponse` -> `reverificationErrorResponse`
6 changes: 6 additions & 0 deletions .changeset/curly-terms-confess.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@clerk/chrome-extension': patch
---

Introduce the `useReverification()` hook that handles the session reverification flow:
- Replaces `__experimental_useReverification` with `useReverification`
10 changes: 10 additions & 0 deletions .changeset/forty-countries-retire.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
'@clerk/shared': minor
---

Introduce the `useReverification()` hook that handles the session reverification flow:
- `__experimental_useReverification` -> `useReverification`
Also replaces the following APIs:
- `__experimental_reverificationError` -> `reverificationError`
- `__experimental_reverificationErrorResponse` -> `reverificationErrorResponse`
- `__experimental_isReverificationHint` -> `isReverificationHint`
33 changes: 33 additions & 0 deletions .changeset/friendly-chairs-tie.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
'@clerk/types': minor
---

Drop experimental tag related to reverification.

Properties of Clerk class:
- `__experimental_openUserVerification` -> `__internal_openUserVerification`
- `__experimental_closeUserVerification` -> `__internal_closeUserVerification`
- `__experimental_UserVerificationProps` -> `__internal_UserVerificationProps`
- `__experimental_UserVerificationModalProps` -> `__internal_UserVerificationModalProps`

Properties of `Session`:
- `__experimental_factorVerificationAge` -> `factorVerificationAge`
- `__experimental_startVerification` -> `startVerification`
- `__experimental_prepareFirstFactorVerification` -> `prepareFirstFactorVerification`
- `__experimental_attemptFirstFactorVerification` -> `attemptFirstFactorVerification`
- `__experimental_prepareSecondFactorVerification` -> `prepareSecondFactorVerification`
- `__experimental_attemptSecondFactorVerification` -> `attemptSecondFactorVerification`

Renaming
- `__experimental_SessionVerificationResource` -> `SessionVerificationResource`
- `__experimental_SessionVerificationStatus` -> `SessionVerificationStatus`
- `__experimental_SessionVerificationLevel` -> `SessionVerificationLevel`
- `__experimental_ReverificationConfig` -> `ReverificationConfig`

`CheckAuthorizationParamsWithCustomPermissions` and `CheckAuthorizationParams` now include `reverification?: ReverificationConfig;`

Properties of `IntialState`:
- `__experimental_factorVerificationAge` -> `factorVerificationAge`

Localization types:
All properties of `__experimental_userVerification` are moved to `userVerification`
6 changes: 6 additions & 0 deletions .changeset/happy-balloons-jog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@clerk/clerk-react': minor
---

Introduce the `useReverification()` hook that handles the session reverification flow:
- Replaces `__experimental_useReverification` with `useReverification`
19 changes: 19 additions & 0 deletions .changeset/hungry-beds-prove.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
'@clerk/clerk-js': minor
---

Drop experimental tag related to reverification.

Properties of Clerk class:
- `__experimental_openUserVerification` -> `__internal_openUserVerification`
- `__experimental_closeUserVerification` -> `__internal_closeUserVerification`
- `__experimental_UserVerificationProps` -> `__internal_UserVerificationProps`
- `__experimental_UserVerificationModalProps` -> `__internal_UserVerificationModalProps`

Properties of `Session`:
- `__experimental_factorVerificationAge` -> `factorVerificationAge`
- `__experimental_startVerification` -> `startVerification`
- `__experimental_prepareFirstFactorVerification` -> `prepareFirstFactorVerification`
- `__experimental_attemptFirstFactorVerification` -> `attemptFirstFactorVerification`
- `__experimental_prepareSecondFactorVerification` -> `prepareSecondFactorVerification`
- `__experimental_attemptSecondFactorVerification` -> `attemptSecondFactorVerification`
5 changes: 5 additions & 0 deletions .changeset/small-suits-knock.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@clerk/localizations': minor
---

Moves all properties under `__experimental_userVerification` to `userVerification`. This affects all languages.
8 changes: 8 additions & 0 deletions .changeset/smart-cooks-drop.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
'@clerk/backend': minor
---

Update AuthObject property from `__experimental_factorVerificationAge` to `factorVerificationAge`.
Also replaces the following APIs:
- `__experimental_reverificationError` -> `__reverificationError`
- `__experimental_reverificationErrorResponse` -> `reverificationErrorResponse`
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use client';
import { useState, useTransition } from 'react';
import { __experimental_useReverification as useReverification } from '@clerk/nextjs';
import { useReverification } from '@clerk/nextjs';
import { logUserIdActionReverification } from '@/app/(reverification)/actions';

function Page() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
'use server';

import { auth } from '@clerk/nextjs/server';
import { __experimental_reverificationError as reverificationError } from '@clerk/shared/authorization-errors';
import { __experimental_ReverificationConfig } from '@clerk/types';

import { auth, reverificationError } from '@clerk/nextjs/server';
import { ReverificationConfig } from '@clerk/types';
const logUserIdActionReverification = async () => {
const { userId, has } = await auth.protect();

const config = {
level: 'second_factor',
afterMinutes: 1,
} satisfies __experimental_ReverificationConfig;
} satisfies ReverificationConfig;

const userNeedsReverification = !has({
__experimental_reverification: config,
reverification: config,
});

if (userNeedsReverification) {
Expand Down
4 changes: 2 additions & 2 deletions packages/backend/src/__tests__/exports.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@ describe('subpath /internal exports', () => {
expect(Object.keys(internalExports).sort()).toMatchInlineSnapshot(`
[
"AuthStatus",
"__experimental_reverificationError",
"__experimental_reverificationErrorResponse",
"constants",
"createAuthenticateRequest",
"createClerkRequest",
"createRedirect",
"debugRequestState",
"decorateObjectWithResources",
"makeAuthObjectSerializable",
"reverificationError",
"reverificationErrorResponse",
"signedInAuthObject",
"signedOutAuthObject",
"stripPrivateDataFromObject",
Expand Down
5 changes: 1 addition & 4 deletions packages/backend/src/internal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,4 @@ export { decorateObjectWithResources, stripPrivateDataFromObject } from './util/
export { createClerkRequest } from './tokens/clerkRequest';
export type { ClerkRequest } from './tokens/clerkRequest';

export {
__experimental_reverificationError,
__experimental_reverificationErrorResponse,
} from '@clerk/shared/authorization-errors';
export { reverificationError, reverificationErrorResponse } from '@clerk/shared/authorization-errors';
14 changes: 6 additions & 8 deletions packages/backend/src/tokens/authObjects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,8 @@ export type SignedInAuthObject = {
* Factor Verification Age
* Each item represents the minutes that have passed since the last time a first or second factor were verified.
* [fistFactorAge, secondFactorAge]
* @experimental This API is experimental and may change at any moment.
*/
__experimental_factorVerificationAge: [number, number] | null;
factorVerificationAge: [number, number] | null;
getToken: ServerGetToken;
has: CheckAuthorizationWithCustomPermissions;
debug: AuthObjectDebug;
Expand All @@ -63,9 +62,8 @@ export type SignedOutAuthObject = {
* Factor Verification Age
* Each item represents the minutes that have passed since the last time a first or second factor were verified.
* [fistFactorAge, secondFactorAge]
* @experimental This API is experimental and may change at any moment.
*/
__experimental_factorVerificationAge: null;
factorVerificationAge: null;
getToken: ServerGetToken;
has: CheckAuthorizationWithCustomPermissions;
debug: AuthObjectDebug;
Expand Down Expand Up @@ -111,7 +109,7 @@ export function signedInAuthObject(
});

// fva can be undefined for instances that have not opt-in
const __experimental_factorVerificationAge = fva ?? null;
const factorVerificationAge = fva ?? null;

return {
actor,
Expand All @@ -122,9 +120,9 @@ export function signedInAuthObject(
orgRole,
orgSlug,
orgPermissions,
__experimental_factorVerificationAge,
factorVerificationAge,
getToken,
has: createCheckAuthorization({ orgId, orgRole, orgPermissions, userId, __experimental_factorVerificationAge }),
has: createCheckAuthorization({ orgId, orgRole, orgPermissions, userId, factorVerificationAge }),
debug: createDebug({ ...authenticateContext, sessionToken }),
};
}
Expand All @@ -142,7 +140,7 @@ export function signedOutAuthObject(debugData?: AuthObjectDebugData): SignedOutA
orgRole: null,
orgSlug: null,
orgPermissions: null,
__experimental_factorVerificationAge: null,
factorVerificationAge: null,
getToken: () => Promise.resolve(null),
has: () => false,
debug: createDebug(debugData),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ exports[`public exports should not include a breaking change 1`] = `
"UserButton",
"UserProfile",
"Waitlist",
"__experimental_useReverification",
"useAuth",
"useClerk",
"useEmailLink",
"useOrganization",
"useOrganizationList",
"useReverification",
"useSession",
"useSessionList",
"useSignIn",
Expand Down
14 changes: 7 additions & 7 deletions packages/clerk-js/src/core/clerk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { eventPrebuiltComponentMounted, TelemetryCollector } from '@clerk/shared
import { addClerkPrefix, stripScheme } from '@clerk/shared/url';
import { handleValueOrFn, noop } from '@clerk/shared/utils';
import type {
__experimental_UserVerificationModalProps,
__internal_UserVerificationModalProps,
ActiveSessionResource,
AuthenticateWithCoinbaseWalletParams,
AuthenticateWithGoogleOneTapParams,
Expand Down Expand Up @@ -420,7 +420,7 @@ export class Clerk implements ClerkInterface {
void this.#componentControls.ensureMounted().then(controls => controls.closeModal('signIn'));
};

public __experimental_openUserVerification = (props?: __experimental_UserVerificationModalProps): void => {
public __internal_openUserVerification = (props?: __internal_UserVerificationModalProps): void => {
this.assertComponentsReady(this.#componentControls);
if (noUserExists(this)) {
if (this.#instanceType === 'development') {
Expand All @@ -435,6 +435,11 @@ export class Clerk implements ClerkInterface {
.then(controls => controls.openModal('userVerification', props || {}));
};

public __internal_closeUserVerification = (): void => {
this.assertComponentsReady(this.#componentControls);
void this.#componentControls.ensureMounted().then(controls => controls.closeModal('userVerification'));
};

public __internal_openBlankCaptchaModal = (): Promise<unknown> => {
this.assertComponentsReady(this.#componentControls);
return this.#componentControls
Expand All @@ -449,11 +454,6 @@ export class Clerk implements ClerkInterface {
.then(controls => controls.closeModal('blankCaptcha'));
};

public __experimental_closeUserVerification = (): void => {
this.assertComponentsReady(this.#componentControls);
void this.#componentControls.ensureMounted().then(controls => controls.closeModal('userVerification'));
};

public openSignUp = (props?: SignUpProps): void => {
this.assertComponentsReady(this.#componentControls);
if (sessionExistsAndSingleSessionModeEnabled(this, this.environment)) {
Expand Down
Loading
Loading