Skip to main content

`resolveChangeCredentialPolicy()`

Cloud has the newest features. Some may not be in a release yet; the newest release is Identity & Access Management 7.3.0.

resolveChangeCredentialPolicy resolves the rules a change-credential form should enforce for a given credential: an explicit override wins outright, otherwise the attribute's own regex from the user type schema (GET /users/me/meta) applies. Returns an empty policy (no rules) when neither is set, since the SDK never layers its own character-class or length rules on top of the organization's policy.

Signature​

resolveChangeCredentialPolicy(
userSchema: Record<string, AttributeSchema> | null | undefined,
attribute: string,
override?: PasswordPolicy,
): PasswordPolicy

Parameters​

ParameterTypeRequiredDescription
userSchemaRecord<string, AttributeSchema> | null | undefined✅The user type schema resolved by the provider, keyed by attribute.
attributestring✅The credential attribute this form manages, e.g. 'password' or 'pin'.
overridePasswordPolicy❌An explicit policy supplied by the caller, which wins outright.

Returns​

PasswordPolicy: the policy to hand to evaluatePasswordPolicy() or evaluateChangePasswordForm().

Usage​

import { evaluatePasswordPolicy, resolveChangeCredentialPolicy } from '@thunderid/browser'

const policy = resolveChangeCredentialPolicy(userSchema, 'pin', undefined)
const results = evaluatePasswordPolicy(candidate, policy)

Was this page helpful?