Skip to content

Commit

Permalink
rename to maxAgeMinutes
Browse files Browse the repository at this point in the history
  • Loading branch information
panteliselef committed Oct 1, 2024
1 parent 15ca65c commit 2ed906e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
4 changes: 2 additions & 2 deletions packages/clerk-js/src/core/resources/Session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,15 +122,15 @@ export class Session extends BaseResource implements SessionResource {

__experimental_startVerification = async ({
level,
maxAge,
maxAgeMinutes,
}: __experimental_SessionVerifyCreateParams): Promise<__experimental_SessionVerificationResource> => {
const json = (
await BaseResource._fetch({
method: 'POST',
path: `/client/sessions/${this.id}/verify`,
body: {
level,
maxAge,
maxAgeMinutes,
} as any,
})
)?.response as unknown as __experimental_SessionVerificationJSON;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const useUserVerificationSession = () => {
{
level: level || 'secondFactor',
// TODO(STEP-UP): Figure out if this needs to be a prop
maxAge: 10,
maxAgeMinutes: 10,
},
{
throttleTime: 300,
Expand Down
7 changes: 3 additions & 4 deletions packages/shared/src/authorization.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import type {
__experimental_ReverificationConfig,
__experimental_SessionVerificationLevel,
__experimental_SessionVerificationMaxAge,
__experimental_SessionVerificationTypes,
CheckAuthorizationWithCustomPermissions,
OrganizationCustomPermissionKey,
Expand Down Expand Up @@ -56,9 +55,9 @@ const ALLOWED_LEVELS = new Set<__experimental_SessionVerificationLevel>(['firstF
const ALLOWED_TYPES = new Set<__experimental_SessionVerificationTypes>(['veryStrict', 'strict', 'moderate', 'lax']);

// Helper functions
const isValidMaxAge = (maxAge: __experimental_SessionVerificationMaxAge) => typeof maxAge === 'number' && maxAge > 0;
const isValidLevel = (level: __experimental_SessionVerificationLevel) => ALLOWED_LEVELS.has(level);
const isValidVerificationType = (type: __experimental_SessionVerificationTypes) => ALLOWED_TYPES.has(type);
const isValidMaxAge = (maxAge: any) => typeof maxAge === 'number' && maxAge > 0;
const isValidLevel = (level: any) => ALLOWED_LEVELS.has(level);
const isValidVerificationType = (type: any) => ALLOWED_TYPES.has(type);

/**
* Checks if a user has the required organization-level authorization.
Expand Down

0 comments on commit 2ed906e

Please sign in to comment.