@nauth-toolkit/client 0.7.1 → 0.7.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +23 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +61 -21
- package/dist/index.d.ts +61 -21
- package/dist/index.mjs +23 -11
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -2027,6 +2027,40 @@ interface GetRiskAssessmentHistoryRequest {
|
|
|
2027
2027
|
/** Maximum number of assessments to return */
|
|
2028
2028
|
limit?: number;
|
|
2029
2029
|
}
|
|
2030
|
+
/**
|
|
2031
|
+
* Options for an admin-set password.
|
|
2032
|
+
*
|
|
2033
|
+
* Both flags default to `true` on the server, so omitting them issues a temporary
|
|
2034
|
+
* password and signs the user out everywhere. Pass `false` to opt out.
|
|
2035
|
+
*/
|
|
2036
|
+
interface AdminSetPasswordOptions {
|
|
2037
|
+
/** Require the user to choose a new password at next login. Server default: `true` */
|
|
2038
|
+
mustChangePassword?: boolean;
|
|
2039
|
+
/** Revoke the user's active sessions. Server default: `true` */
|
|
2040
|
+
revokeSessions?: boolean;
|
|
2041
|
+
}
|
|
2042
|
+
/**
|
|
2043
|
+
* Response for an admin-set password.
|
|
2044
|
+
*/
|
|
2045
|
+
interface AdminSetPasswordResponse {
|
|
2046
|
+
/** Success indicator */
|
|
2047
|
+
success: boolean;
|
|
2048
|
+
/** Whether the user must change the password at next login */
|
|
2049
|
+
mustChangePassword: boolean;
|
|
2050
|
+
/** Number of sessions revoked */
|
|
2051
|
+
sessionsRevoked: number;
|
|
2052
|
+
}
|
|
2053
|
+
/**
|
|
2054
|
+
* Response for a change to a user's MFA exemption.
|
|
2055
|
+
*/
|
|
2056
|
+
interface SetMfaExemptionResponse {
|
|
2057
|
+
/** Whether the user is now exempt from MFA */
|
|
2058
|
+
mfaExempt: boolean;
|
|
2059
|
+
/** Recorded reason for the exemption, or null when not exempt */
|
|
2060
|
+
mfaExemptReason: string | null;
|
|
2061
|
+
/** When the exemption was granted, or null when not exempt */
|
|
2062
|
+
mfaExemptGrantedAt: Date | null;
|
|
2063
|
+
}
|
|
2030
2064
|
|
|
2031
2065
|
/**
|
|
2032
2066
|
* API Key types for the NAuth client SDK.
|
|
@@ -2785,15 +2819,15 @@ declare class AdminOperations {
|
|
|
2785
2819
|
* Get user by sub (UUID)
|
|
2786
2820
|
*
|
|
2787
2821
|
* @param sub - User UUID
|
|
2788
|
-
* @returns
|
|
2789
|
-
* @throws {NAuthClientError} If
|
|
2822
|
+
* @returns The user, or null when no account has that sub
|
|
2823
|
+
* @throws {NAuthClientError} If the request fails
|
|
2790
2824
|
*
|
|
2791
2825
|
* @example
|
|
2792
2826
|
* ```typescript
|
|
2793
2827
|
* const user = await client.admin.getUser('a21b654c-2746-4168-acee-c175083a65cd');
|
|
2794
2828
|
* ```
|
|
2795
2829
|
*/
|
|
2796
|
-
getUser(sub: string): Promise<AuthUser>;
|
|
2830
|
+
getUser(sub: string): Promise<AuthUser | null>;
|
|
2797
2831
|
/**
|
|
2798
2832
|
* Delete user with cascade cleanup
|
|
2799
2833
|
*
|
|
@@ -2856,21 +2890,31 @@ declare class AdminOperations {
|
|
|
2856
2890
|
success: boolean;
|
|
2857
2891
|
}>;
|
|
2858
2892
|
/**
|
|
2859
|
-
* Set password
|
|
2893
|
+
* Set a user's password outright, without their involvement.
|
|
2860
2894
|
*
|
|
2861
|
-
*
|
|
2895
|
+
* Both options default to `true` server-side, so the plain two-argument call issues a
|
|
2896
|
+
* temporary password and signs the user out everywhere. Pass `false` to keep the
|
|
2897
|
+
* password permanent or to leave existing sessions alive.
|
|
2898
|
+
*
|
|
2899
|
+
* @param sub - Target user's external identifier (UUID v4)
|
|
2862
2900
|
* @param newPassword - New password
|
|
2863
|
-
* @
|
|
2901
|
+
* @param options - Whether to force a change at next login, and whether to revoke sessions
|
|
2902
|
+
* @returns Success, the resulting must-change flag, and the number of sessions revoked
|
|
2864
2903
|
* @throws {NAuthClientError} If operation fails
|
|
2865
2904
|
*
|
|
2866
2905
|
* @example
|
|
2867
2906
|
* ```typescript
|
|
2868
|
-
*
|
|
2907
|
+
* // Temporary password, all sessions revoked
|
|
2908
|
+
* await client.admin.setPassword('a21b654c-2746-4168-acee-c175083a65cd', 'NewSecurePass123!');
|
|
2909
|
+
*
|
|
2910
|
+
* // Permanent password, sessions left alone
|
|
2911
|
+
* await client.admin.setPassword('a21b654c-2746-4168-acee-c175083a65cd', 'NewSecurePass123!', {
|
|
2912
|
+
* mustChangePassword: false,
|
|
2913
|
+
* revokeSessions: false,
|
|
2914
|
+
* });
|
|
2869
2915
|
* ```
|
|
2870
2916
|
*/
|
|
2871
|
-
setPassword(
|
|
2872
|
-
success: boolean;
|
|
2873
|
-
}>;
|
|
2917
|
+
setPassword(sub: string, newPassword: string, options?: AdminSetPasswordOptions): Promise<AdminSetPasswordResponse>;
|
|
2874
2918
|
/**
|
|
2875
2919
|
* Initiate password reset workflow (sends code/link to user)
|
|
2876
2920
|
*
|
|
@@ -2988,7 +3032,7 @@ declare class AdminOperations {
|
|
|
2988
3032
|
* @param sub - User UUID
|
|
2989
3033
|
* @param exempt - True to exempt from MFA, false to require
|
|
2990
3034
|
* @param reason - Optional reason for exemption
|
|
2991
|
-
* @returns
|
|
3035
|
+
* @returns The user's resulting exemption state
|
|
2992
3036
|
* @throws {NAuthClientError} If operation fails
|
|
2993
3037
|
*
|
|
2994
3038
|
* @example
|
|
@@ -2996,9 +3040,7 @@ declare class AdminOperations {
|
|
|
2996
3040
|
* await client.admin.setMfaExemption('user-uuid', true, 'Service account');
|
|
2997
3041
|
* ```
|
|
2998
3042
|
*/
|
|
2999
|
-
setMfaExemption(sub: string, exempt: boolean, reason?: string): Promise<
|
|
3000
|
-
message: string;
|
|
3001
|
-
}>;
|
|
3043
|
+
setMfaExemption(sub: string, exempt: boolean, reason?: string): Promise<SetMfaExemptionResponse>;
|
|
3002
3044
|
/**
|
|
3003
3045
|
* Get audit history for a user
|
|
3004
3046
|
*
|
|
@@ -3025,9 +3067,9 @@ declare class AdminOperations {
|
|
|
3025
3067
|
* `sub` wherever the caller already holds one.
|
|
3026
3068
|
*
|
|
3027
3069
|
* @param params - Email to look up, and whether to require a verified address
|
|
3028
|
-
* @returns The matching user
|
|
3070
|
+
* @returns The matching user, or null when no account matches
|
|
3029
3071
|
*/
|
|
3030
|
-
getUserByEmail(params: GetUserByEmailRequest): Promise<AuthUser>;
|
|
3072
|
+
getUserByEmail(params: GetUserByEmailRequest): Promise<AuthUser | null>;
|
|
3031
3073
|
/**
|
|
3032
3074
|
* Update a user's profile attributes.
|
|
3033
3075
|
*
|
|
@@ -3056,11 +3098,9 @@ declare class AdminOperations {
|
|
|
3056
3098
|
*
|
|
3057
3099
|
* @param sub - Target user's external identifier
|
|
3058
3100
|
* @param sessionId - Session to revoke
|
|
3059
|
-
* @returns Whether the session was revoked
|
|
3101
|
+
* @returns Whether the session was revoked, and whether it was the caller's own
|
|
3060
3102
|
*/
|
|
3061
|
-
revokeUserSession(sub: string, sessionId: string): Promise<
|
|
3062
|
-
success: boolean;
|
|
3063
|
-
}>;
|
|
3103
|
+
revokeUserSession(sub: string, sessionId: string): Promise<LogoutSessionResponse>;
|
|
3064
3104
|
/**
|
|
3065
3105
|
* List a user's trusted devices.
|
|
3066
3106
|
*
|
|
@@ -4453,4 +4493,4 @@ declare class FetchAdapter implements HttpAdapter {
|
|
|
4453
4493
|
request<T>(config: HttpRequest): Promise<HttpResponse<T>>;
|
|
4454
4494
|
}
|
|
4455
4495
|
|
|
4456
|
-
export { type AdminAuditHistoryRequest, type AdminCreateApiKeyRequest, AdminOperations, type AdminResetPasswordRequest, type AdminResetPasswordResponse, type AdminSignupRequest, type AdminSignupResponse, type AdminSignupSocialRequest, type AdminSignupSocialResponse, type ApiKeyInfo, ApiKeyOperations, type AuditHistoryResponse, type AuthAuditEvent, type AuthAuditEventStatus, AuthAuditEventType, AuthChallenge, type AuthChallengeEvent, type AuthErrorEvent, type AuthEvent, type AuthEventListener, type AuthEventType, type AuthLoginEvent, type AuthLogoutEvent, type AuthRefreshEvent, type AuthResponse, type AuthResponseContext, type AuthSessionExpiredEvent, type AuthSignupEvent, type AuthSuccessEvent, type AuthUser, type AuthUserSummary, type AvailableMfaMethodsResponse, type BackupCodesResponse, type BaseChallengeResponse, BrowserStorage, type CanSetPasswordResponse, type ChallengeResponse, ChallengeRouter, type ChangePasswordRequest, type ConfirmForgotPasswordRequest, type ConfirmForgotPasswordResponse, type CreateApiKeyRequest, type CreateApiKeyResult, DEFAULT_INTERACTION_ROUTE, type DateFilter, type DeleteApiKeyResponse, type DeleteUserResponse, type DisableUserResponse, type EnableUserResponse, EventEmitter, FetchAdapter, type ForceChangePasswordResponse, type ForgotPasswordRequest, type ForgotPasswordResponse, type GetChallengeDataRequest, type GetChallengeDataResponse, type GetEventsByTypeRequest, type GetMFADevicesResponse, type GetRiskAssessmentHistoryRequest, type GetSetupDataRequest, type GetSetupDataResponse, type GetSuspiciousActivityRequest, type GetUserByEmailRequest, type GetUserSessionsResponse, type GetUsersRequest, type GetUsersResponse, type HttpAdapter, type HttpRequest, type HttpResponse, InMemoryStorage, type LinkedAccountsResponse, type ListApiKeysResponse, type ListTrustedDevicesResponse, type LoginRequest, type LogoutAllRequest, type LogoutRequest, type LogoutSessionResponse, type MFAChallengeMethod, type MFACodeResponse, type MFADevice, type MFADeviceMethod, type MFAMethod, type MFAPasskeyResponse, type MFASetupData, type MFASetupResponse, type MFAStatus, type MfaGracePeriod, type MfaRoutesConfig, type NAuthAdminEndpoints, NAuthClient, type NAuthClientConfig, NAuthClientError, type NAuthEndpoints, type NAuthError, NAuthErrorCode, type NAuthRedirectsConfig, type NAuthStorageAdapter, type OAuthCallbackEvent, type OAuthCompletedEvent, type OAuthErrorEvent, type OAuthStartedEvent, type OIDCConsentDecision, type OIDCGateStatus, type OIDCInteractionClient, type OIDCInteractionRedirect, type OIDCInteractionState, OIDCOperations, PENDING_INTERACTION_KEY, type RecaptchaConfig, type RecaptchaVersion, type RemoveMFADeviceResponse, type ResendCodeRequest, type ResetPasswordWithCodeRequest, type ResetPasswordWithCodeResponse, type ResolvedNAuthClientConfig, type RevokeAllTrustedDevicesResponse, type RevokeApiKeyResponse, type RevokeTrustedDeviceResponse, type SetPasswordResponse, type SignupRequest, type SocialLoginOptions, type SocialProvider, type SocialVerifyRequest, type TokenDeliveryMode, type TokenResponse, type TrustedDeviceInfo, type UpdateApiKeyRequest, type UpdateProfileRequest, type UpdateVerifiedStatusRequest, type UserSessionInfo, type VerifyEmailResponse, type VerifyPhoneCodeResponse, type VerifyPhoneCollectResponse, apiKeyHeader, defaultAdminEndpoints, defaultEndpoints, getChallengeInstructions, getMFAMethod, getMaskedDestination, isOTPChallenge, requiresPhoneCollection, resolveConfig };
|
|
4496
|
+
export { type AdminAuditHistoryRequest, type AdminCreateApiKeyRequest, AdminOperations, type AdminResetPasswordRequest, type AdminResetPasswordResponse, type AdminSetPasswordOptions, type AdminSetPasswordResponse, type AdminSignupRequest, type AdminSignupResponse, type AdminSignupSocialRequest, type AdminSignupSocialResponse, type ApiKeyInfo, ApiKeyOperations, type AuditHistoryResponse, type AuthAuditEvent, type AuthAuditEventStatus, AuthAuditEventType, AuthChallenge, type AuthChallengeEvent, type AuthErrorEvent, type AuthEvent, type AuthEventListener, type AuthEventType, type AuthLoginEvent, type AuthLogoutEvent, type AuthRefreshEvent, type AuthResponse, type AuthResponseContext, type AuthSessionExpiredEvent, type AuthSignupEvent, type AuthSuccessEvent, type AuthUser, type AuthUserSummary, type AvailableMfaMethodsResponse, type BackupCodesResponse, type BaseChallengeResponse, BrowserStorage, type CanSetPasswordResponse, type ChallengeResponse, ChallengeRouter, type ChangePasswordRequest, type ConfirmForgotPasswordRequest, type ConfirmForgotPasswordResponse, type CreateApiKeyRequest, type CreateApiKeyResult, DEFAULT_INTERACTION_ROUTE, type DateFilter, type DeleteApiKeyResponse, type DeleteUserResponse, type DisableUserResponse, type EnableUserResponse, EventEmitter, FetchAdapter, type ForceChangePasswordResponse, type ForgotPasswordRequest, type ForgotPasswordResponse, type GetChallengeDataRequest, type GetChallengeDataResponse, type GetEventsByTypeRequest, type GetMFADevicesResponse, type GetRiskAssessmentHistoryRequest, type GetSetupDataRequest, type GetSetupDataResponse, type GetSuspiciousActivityRequest, type GetUserByEmailRequest, type GetUserSessionsResponse, type GetUsersRequest, type GetUsersResponse, type HttpAdapter, type HttpRequest, type HttpResponse, InMemoryStorage, type LinkedAccountsResponse, type ListApiKeysResponse, type ListTrustedDevicesResponse, type LoginRequest, type LogoutAllRequest, type LogoutRequest, type LogoutSessionResponse, type MFAChallengeMethod, type MFACodeResponse, type MFADevice, type MFADeviceMethod, type MFAMethod, type MFAPasskeyResponse, type MFASetupData, type MFASetupResponse, type MFAStatus, type MfaGracePeriod, type MfaRoutesConfig, type NAuthAdminEndpoints, NAuthClient, type NAuthClientConfig, NAuthClientError, type NAuthEndpoints, type NAuthError, NAuthErrorCode, type NAuthRedirectsConfig, type NAuthStorageAdapter, type OAuthCallbackEvent, type OAuthCompletedEvent, type OAuthErrorEvent, type OAuthStartedEvent, type OIDCConsentDecision, type OIDCGateStatus, type OIDCInteractionClient, type OIDCInteractionRedirect, type OIDCInteractionState, OIDCOperations, PENDING_INTERACTION_KEY, type RecaptchaConfig, type RecaptchaVersion, type RemoveMFADeviceResponse, type ResendCodeRequest, type ResetPasswordWithCodeRequest, type ResetPasswordWithCodeResponse, type ResolvedNAuthClientConfig, type RevokeAllTrustedDevicesResponse, type RevokeApiKeyResponse, type RevokeTrustedDeviceResponse, type SetMfaExemptionResponse, type SetPasswordResponse, type SignupRequest, type SocialLoginOptions, type SocialProvider, type SocialVerifyRequest, type TokenDeliveryMode, type TokenResponse, type TrustedDeviceInfo, type UpdateApiKeyRequest, type UpdateProfileRequest, type UpdateVerifiedStatusRequest, type UserSessionInfo, type VerifyEmailResponse, type VerifyPhoneCodeResponse, type VerifyPhoneCollectResponse, apiKeyHeader, defaultAdminEndpoints, defaultEndpoints, getChallengeInstructions, getMFAMethod, getMaskedDestination, isOTPChallenge, requiresPhoneCollection, resolveConfig };
|
package/dist/index.d.ts
CHANGED
|
@@ -2027,6 +2027,40 @@ interface GetRiskAssessmentHistoryRequest {
|
|
|
2027
2027
|
/** Maximum number of assessments to return */
|
|
2028
2028
|
limit?: number;
|
|
2029
2029
|
}
|
|
2030
|
+
/**
|
|
2031
|
+
* Options for an admin-set password.
|
|
2032
|
+
*
|
|
2033
|
+
* Both flags default to `true` on the server, so omitting them issues a temporary
|
|
2034
|
+
* password and signs the user out everywhere. Pass `false` to opt out.
|
|
2035
|
+
*/
|
|
2036
|
+
interface AdminSetPasswordOptions {
|
|
2037
|
+
/** Require the user to choose a new password at next login. Server default: `true` */
|
|
2038
|
+
mustChangePassword?: boolean;
|
|
2039
|
+
/** Revoke the user's active sessions. Server default: `true` */
|
|
2040
|
+
revokeSessions?: boolean;
|
|
2041
|
+
}
|
|
2042
|
+
/**
|
|
2043
|
+
* Response for an admin-set password.
|
|
2044
|
+
*/
|
|
2045
|
+
interface AdminSetPasswordResponse {
|
|
2046
|
+
/** Success indicator */
|
|
2047
|
+
success: boolean;
|
|
2048
|
+
/** Whether the user must change the password at next login */
|
|
2049
|
+
mustChangePassword: boolean;
|
|
2050
|
+
/** Number of sessions revoked */
|
|
2051
|
+
sessionsRevoked: number;
|
|
2052
|
+
}
|
|
2053
|
+
/**
|
|
2054
|
+
* Response for a change to a user's MFA exemption.
|
|
2055
|
+
*/
|
|
2056
|
+
interface SetMfaExemptionResponse {
|
|
2057
|
+
/** Whether the user is now exempt from MFA */
|
|
2058
|
+
mfaExempt: boolean;
|
|
2059
|
+
/** Recorded reason for the exemption, or null when not exempt */
|
|
2060
|
+
mfaExemptReason: string | null;
|
|
2061
|
+
/** When the exemption was granted, or null when not exempt */
|
|
2062
|
+
mfaExemptGrantedAt: Date | null;
|
|
2063
|
+
}
|
|
2030
2064
|
|
|
2031
2065
|
/**
|
|
2032
2066
|
* API Key types for the NAuth client SDK.
|
|
@@ -2785,15 +2819,15 @@ declare class AdminOperations {
|
|
|
2785
2819
|
* Get user by sub (UUID)
|
|
2786
2820
|
*
|
|
2787
2821
|
* @param sub - User UUID
|
|
2788
|
-
* @returns
|
|
2789
|
-
* @throws {NAuthClientError} If
|
|
2822
|
+
* @returns The user, or null when no account has that sub
|
|
2823
|
+
* @throws {NAuthClientError} If the request fails
|
|
2790
2824
|
*
|
|
2791
2825
|
* @example
|
|
2792
2826
|
* ```typescript
|
|
2793
2827
|
* const user = await client.admin.getUser('a21b654c-2746-4168-acee-c175083a65cd');
|
|
2794
2828
|
* ```
|
|
2795
2829
|
*/
|
|
2796
|
-
getUser(sub: string): Promise<AuthUser>;
|
|
2830
|
+
getUser(sub: string): Promise<AuthUser | null>;
|
|
2797
2831
|
/**
|
|
2798
2832
|
* Delete user with cascade cleanup
|
|
2799
2833
|
*
|
|
@@ -2856,21 +2890,31 @@ declare class AdminOperations {
|
|
|
2856
2890
|
success: boolean;
|
|
2857
2891
|
}>;
|
|
2858
2892
|
/**
|
|
2859
|
-
* Set password
|
|
2893
|
+
* Set a user's password outright, without their involvement.
|
|
2860
2894
|
*
|
|
2861
|
-
*
|
|
2895
|
+
* Both options default to `true` server-side, so the plain two-argument call issues a
|
|
2896
|
+
* temporary password and signs the user out everywhere. Pass `false` to keep the
|
|
2897
|
+
* password permanent or to leave existing sessions alive.
|
|
2898
|
+
*
|
|
2899
|
+
* @param sub - Target user's external identifier (UUID v4)
|
|
2862
2900
|
* @param newPassword - New password
|
|
2863
|
-
* @
|
|
2901
|
+
* @param options - Whether to force a change at next login, and whether to revoke sessions
|
|
2902
|
+
* @returns Success, the resulting must-change flag, and the number of sessions revoked
|
|
2864
2903
|
* @throws {NAuthClientError} If operation fails
|
|
2865
2904
|
*
|
|
2866
2905
|
* @example
|
|
2867
2906
|
* ```typescript
|
|
2868
|
-
*
|
|
2907
|
+
* // Temporary password, all sessions revoked
|
|
2908
|
+
* await client.admin.setPassword('a21b654c-2746-4168-acee-c175083a65cd', 'NewSecurePass123!');
|
|
2909
|
+
*
|
|
2910
|
+
* // Permanent password, sessions left alone
|
|
2911
|
+
* await client.admin.setPassword('a21b654c-2746-4168-acee-c175083a65cd', 'NewSecurePass123!', {
|
|
2912
|
+
* mustChangePassword: false,
|
|
2913
|
+
* revokeSessions: false,
|
|
2914
|
+
* });
|
|
2869
2915
|
* ```
|
|
2870
2916
|
*/
|
|
2871
|
-
setPassword(
|
|
2872
|
-
success: boolean;
|
|
2873
|
-
}>;
|
|
2917
|
+
setPassword(sub: string, newPassword: string, options?: AdminSetPasswordOptions): Promise<AdminSetPasswordResponse>;
|
|
2874
2918
|
/**
|
|
2875
2919
|
* Initiate password reset workflow (sends code/link to user)
|
|
2876
2920
|
*
|
|
@@ -2988,7 +3032,7 @@ declare class AdminOperations {
|
|
|
2988
3032
|
* @param sub - User UUID
|
|
2989
3033
|
* @param exempt - True to exempt from MFA, false to require
|
|
2990
3034
|
* @param reason - Optional reason for exemption
|
|
2991
|
-
* @returns
|
|
3035
|
+
* @returns The user's resulting exemption state
|
|
2992
3036
|
* @throws {NAuthClientError} If operation fails
|
|
2993
3037
|
*
|
|
2994
3038
|
* @example
|
|
@@ -2996,9 +3040,7 @@ declare class AdminOperations {
|
|
|
2996
3040
|
* await client.admin.setMfaExemption('user-uuid', true, 'Service account');
|
|
2997
3041
|
* ```
|
|
2998
3042
|
*/
|
|
2999
|
-
setMfaExemption(sub: string, exempt: boolean, reason?: string): Promise<
|
|
3000
|
-
message: string;
|
|
3001
|
-
}>;
|
|
3043
|
+
setMfaExemption(sub: string, exempt: boolean, reason?: string): Promise<SetMfaExemptionResponse>;
|
|
3002
3044
|
/**
|
|
3003
3045
|
* Get audit history for a user
|
|
3004
3046
|
*
|
|
@@ -3025,9 +3067,9 @@ declare class AdminOperations {
|
|
|
3025
3067
|
* `sub` wherever the caller already holds one.
|
|
3026
3068
|
*
|
|
3027
3069
|
* @param params - Email to look up, and whether to require a verified address
|
|
3028
|
-
* @returns The matching user
|
|
3070
|
+
* @returns The matching user, or null when no account matches
|
|
3029
3071
|
*/
|
|
3030
|
-
getUserByEmail(params: GetUserByEmailRequest): Promise<AuthUser>;
|
|
3072
|
+
getUserByEmail(params: GetUserByEmailRequest): Promise<AuthUser | null>;
|
|
3031
3073
|
/**
|
|
3032
3074
|
* Update a user's profile attributes.
|
|
3033
3075
|
*
|
|
@@ -3056,11 +3098,9 @@ declare class AdminOperations {
|
|
|
3056
3098
|
*
|
|
3057
3099
|
* @param sub - Target user's external identifier
|
|
3058
3100
|
* @param sessionId - Session to revoke
|
|
3059
|
-
* @returns Whether the session was revoked
|
|
3101
|
+
* @returns Whether the session was revoked, and whether it was the caller's own
|
|
3060
3102
|
*/
|
|
3061
|
-
revokeUserSession(sub: string, sessionId: string): Promise<
|
|
3062
|
-
success: boolean;
|
|
3063
|
-
}>;
|
|
3103
|
+
revokeUserSession(sub: string, sessionId: string): Promise<LogoutSessionResponse>;
|
|
3064
3104
|
/**
|
|
3065
3105
|
* List a user's trusted devices.
|
|
3066
3106
|
*
|
|
@@ -4453,4 +4493,4 @@ declare class FetchAdapter implements HttpAdapter {
|
|
|
4453
4493
|
request<T>(config: HttpRequest): Promise<HttpResponse<T>>;
|
|
4454
4494
|
}
|
|
4455
4495
|
|
|
4456
|
-
export { type AdminAuditHistoryRequest, type AdminCreateApiKeyRequest, AdminOperations, type AdminResetPasswordRequest, type AdminResetPasswordResponse, type AdminSignupRequest, type AdminSignupResponse, type AdminSignupSocialRequest, type AdminSignupSocialResponse, type ApiKeyInfo, ApiKeyOperations, type AuditHistoryResponse, type AuthAuditEvent, type AuthAuditEventStatus, AuthAuditEventType, AuthChallenge, type AuthChallengeEvent, type AuthErrorEvent, type AuthEvent, type AuthEventListener, type AuthEventType, type AuthLoginEvent, type AuthLogoutEvent, type AuthRefreshEvent, type AuthResponse, type AuthResponseContext, type AuthSessionExpiredEvent, type AuthSignupEvent, type AuthSuccessEvent, type AuthUser, type AuthUserSummary, type AvailableMfaMethodsResponse, type BackupCodesResponse, type BaseChallengeResponse, BrowserStorage, type CanSetPasswordResponse, type ChallengeResponse, ChallengeRouter, type ChangePasswordRequest, type ConfirmForgotPasswordRequest, type ConfirmForgotPasswordResponse, type CreateApiKeyRequest, type CreateApiKeyResult, DEFAULT_INTERACTION_ROUTE, type DateFilter, type DeleteApiKeyResponse, type DeleteUserResponse, type DisableUserResponse, type EnableUserResponse, EventEmitter, FetchAdapter, type ForceChangePasswordResponse, type ForgotPasswordRequest, type ForgotPasswordResponse, type GetChallengeDataRequest, type GetChallengeDataResponse, type GetEventsByTypeRequest, type GetMFADevicesResponse, type GetRiskAssessmentHistoryRequest, type GetSetupDataRequest, type GetSetupDataResponse, type GetSuspiciousActivityRequest, type GetUserByEmailRequest, type GetUserSessionsResponse, type GetUsersRequest, type GetUsersResponse, type HttpAdapter, type HttpRequest, type HttpResponse, InMemoryStorage, type LinkedAccountsResponse, type ListApiKeysResponse, type ListTrustedDevicesResponse, type LoginRequest, type LogoutAllRequest, type LogoutRequest, type LogoutSessionResponse, type MFAChallengeMethod, type MFACodeResponse, type MFADevice, type MFADeviceMethod, type MFAMethod, type MFAPasskeyResponse, type MFASetupData, type MFASetupResponse, type MFAStatus, type MfaGracePeriod, type MfaRoutesConfig, type NAuthAdminEndpoints, NAuthClient, type NAuthClientConfig, NAuthClientError, type NAuthEndpoints, type NAuthError, NAuthErrorCode, type NAuthRedirectsConfig, type NAuthStorageAdapter, type OAuthCallbackEvent, type OAuthCompletedEvent, type OAuthErrorEvent, type OAuthStartedEvent, type OIDCConsentDecision, type OIDCGateStatus, type OIDCInteractionClient, type OIDCInteractionRedirect, type OIDCInteractionState, OIDCOperations, PENDING_INTERACTION_KEY, type RecaptchaConfig, type RecaptchaVersion, type RemoveMFADeviceResponse, type ResendCodeRequest, type ResetPasswordWithCodeRequest, type ResetPasswordWithCodeResponse, type ResolvedNAuthClientConfig, type RevokeAllTrustedDevicesResponse, type RevokeApiKeyResponse, type RevokeTrustedDeviceResponse, type SetPasswordResponse, type SignupRequest, type SocialLoginOptions, type SocialProvider, type SocialVerifyRequest, type TokenDeliveryMode, type TokenResponse, type TrustedDeviceInfo, type UpdateApiKeyRequest, type UpdateProfileRequest, type UpdateVerifiedStatusRequest, type UserSessionInfo, type VerifyEmailResponse, type VerifyPhoneCodeResponse, type VerifyPhoneCollectResponse, apiKeyHeader, defaultAdminEndpoints, defaultEndpoints, getChallengeInstructions, getMFAMethod, getMaskedDestination, isOTPChallenge, requiresPhoneCollection, resolveConfig };
|
|
4496
|
+
export { type AdminAuditHistoryRequest, type AdminCreateApiKeyRequest, AdminOperations, type AdminResetPasswordRequest, type AdminResetPasswordResponse, type AdminSetPasswordOptions, type AdminSetPasswordResponse, type AdminSignupRequest, type AdminSignupResponse, type AdminSignupSocialRequest, type AdminSignupSocialResponse, type ApiKeyInfo, ApiKeyOperations, type AuditHistoryResponse, type AuthAuditEvent, type AuthAuditEventStatus, AuthAuditEventType, AuthChallenge, type AuthChallengeEvent, type AuthErrorEvent, type AuthEvent, type AuthEventListener, type AuthEventType, type AuthLoginEvent, type AuthLogoutEvent, type AuthRefreshEvent, type AuthResponse, type AuthResponseContext, type AuthSessionExpiredEvent, type AuthSignupEvent, type AuthSuccessEvent, type AuthUser, type AuthUserSummary, type AvailableMfaMethodsResponse, type BackupCodesResponse, type BaseChallengeResponse, BrowserStorage, type CanSetPasswordResponse, type ChallengeResponse, ChallengeRouter, type ChangePasswordRequest, type ConfirmForgotPasswordRequest, type ConfirmForgotPasswordResponse, type CreateApiKeyRequest, type CreateApiKeyResult, DEFAULT_INTERACTION_ROUTE, type DateFilter, type DeleteApiKeyResponse, type DeleteUserResponse, type DisableUserResponse, type EnableUserResponse, EventEmitter, FetchAdapter, type ForceChangePasswordResponse, type ForgotPasswordRequest, type ForgotPasswordResponse, type GetChallengeDataRequest, type GetChallengeDataResponse, type GetEventsByTypeRequest, type GetMFADevicesResponse, type GetRiskAssessmentHistoryRequest, type GetSetupDataRequest, type GetSetupDataResponse, type GetSuspiciousActivityRequest, type GetUserByEmailRequest, type GetUserSessionsResponse, type GetUsersRequest, type GetUsersResponse, type HttpAdapter, type HttpRequest, type HttpResponse, InMemoryStorage, type LinkedAccountsResponse, type ListApiKeysResponse, type ListTrustedDevicesResponse, type LoginRequest, type LogoutAllRequest, type LogoutRequest, type LogoutSessionResponse, type MFAChallengeMethod, type MFACodeResponse, type MFADevice, type MFADeviceMethod, type MFAMethod, type MFAPasskeyResponse, type MFASetupData, type MFASetupResponse, type MFAStatus, type MfaGracePeriod, type MfaRoutesConfig, type NAuthAdminEndpoints, NAuthClient, type NAuthClientConfig, NAuthClientError, type NAuthEndpoints, type NAuthError, NAuthErrorCode, type NAuthRedirectsConfig, type NAuthStorageAdapter, type OAuthCallbackEvent, type OAuthCompletedEvent, type OAuthErrorEvent, type OAuthStartedEvent, type OIDCConsentDecision, type OIDCGateStatus, type OIDCInteractionClient, type OIDCInteractionRedirect, type OIDCInteractionState, OIDCOperations, PENDING_INTERACTION_KEY, type RecaptchaConfig, type RecaptchaVersion, type RemoveMFADeviceResponse, type ResendCodeRequest, type ResetPasswordWithCodeRequest, type ResetPasswordWithCodeResponse, type ResolvedNAuthClientConfig, type RevokeAllTrustedDevicesResponse, type RevokeApiKeyResponse, type RevokeTrustedDeviceResponse, type SetMfaExemptionResponse, type SetPasswordResponse, type SignupRequest, type SocialLoginOptions, type SocialProvider, type SocialVerifyRequest, type TokenDeliveryMode, type TokenResponse, type TrustedDeviceInfo, type UpdateApiKeyRequest, type UpdateProfileRequest, type UpdateVerifiedStatusRequest, type UserSessionInfo, type VerifyEmailResponse, type VerifyPhoneCodeResponse, type VerifyPhoneCollectResponse, apiKeyHeader, defaultAdminEndpoints, defaultEndpoints, getChallengeInstructions, getMFAMethod, getMaskedDestination, isOTPChallenge, requiresPhoneCollection, resolveConfig };
|
package/dist/index.mjs
CHANGED
|
@@ -948,8 +948,8 @@ var AdminOperations = class {
|
|
|
948
948
|
* Get user by sub (UUID)
|
|
949
949
|
*
|
|
950
950
|
* @param sub - User UUID
|
|
951
|
-
* @returns
|
|
952
|
-
* @throws {NAuthClientError} If
|
|
951
|
+
* @returns The user, or null when no account has that sub
|
|
952
|
+
* @throws {NAuthClientError} If the request fails
|
|
953
953
|
*
|
|
954
954
|
* @example
|
|
955
955
|
* ```typescript
|
|
@@ -1035,21 +1035,33 @@ var AdminOperations = class {
|
|
|
1035
1035
|
// Password Management
|
|
1036
1036
|
// ============================================================================
|
|
1037
1037
|
/**
|
|
1038
|
-
* Set password
|
|
1038
|
+
* Set a user's password outright, without their involvement.
|
|
1039
1039
|
*
|
|
1040
|
-
*
|
|
1040
|
+
* Both options default to `true` server-side, so the plain two-argument call issues a
|
|
1041
|
+
* temporary password and signs the user out everywhere. Pass `false` to keep the
|
|
1042
|
+
* password permanent or to leave existing sessions alive.
|
|
1043
|
+
*
|
|
1044
|
+
* @param sub - Target user's external identifier (UUID v4)
|
|
1041
1045
|
* @param newPassword - New password
|
|
1042
|
-
* @
|
|
1046
|
+
* @param options - Whether to force a change at next login, and whether to revoke sessions
|
|
1047
|
+
* @returns Success, the resulting must-change flag, and the number of sessions revoked
|
|
1043
1048
|
* @throws {NAuthClientError} If operation fails
|
|
1044
1049
|
*
|
|
1045
1050
|
* @example
|
|
1046
1051
|
* ```typescript
|
|
1047
|
-
*
|
|
1052
|
+
* // Temporary password, all sessions revoked
|
|
1053
|
+
* await client.admin.setPassword('a21b654c-2746-4168-acee-c175083a65cd', 'NewSecurePass123!');
|
|
1054
|
+
*
|
|
1055
|
+
* // Permanent password, sessions left alone
|
|
1056
|
+
* await client.admin.setPassword('a21b654c-2746-4168-acee-c175083a65cd', 'NewSecurePass123!', {
|
|
1057
|
+
* mustChangePassword: false,
|
|
1058
|
+
* revokeSessions: false,
|
|
1059
|
+
* });
|
|
1048
1060
|
* ```
|
|
1049
1061
|
*/
|
|
1050
|
-
async setPassword(
|
|
1062
|
+
async setPassword(sub, newPassword, options) {
|
|
1051
1063
|
const path = this.buildAdminUrl(this.adminEndpoints.setPassword);
|
|
1052
|
-
return this.post(path, {
|
|
1064
|
+
return this.post(path, { sub, newPassword, ...options });
|
|
1053
1065
|
}
|
|
1054
1066
|
/**
|
|
1055
1067
|
* Initiate password reset workflow (sends code/link to user)
|
|
@@ -1191,7 +1203,7 @@ var AdminOperations = class {
|
|
|
1191
1203
|
* @param sub - User UUID
|
|
1192
1204
|
* @param exempt - True to exempt from MFA, false to require
|
|
1193
1205
|
* @param reason - Optional reason for exemption
|
|
1194
|
-
* @returns
|
|
1206
|
+
* @returns The user's resulting exemption state
|
|
1195
1207
|
* @throws {NAuthClientError} If operation fails
|
|
1196
1208
|
*
|
|
1197
1209
|
* @example
|
|
@@ -1236,7 +1248,7 @@ var AdminOperations = class {
|
|
|
1236
1248
|
* `sub` wherever the caller already holds one.
|
|
1237
1249
|
*
|
|
1238
1250
|
* @param params - Email to look up, and whether to require a verified address
|
|
1239
|
-
* @returns The matching user
|
|
1251
|
+
* @returns The matching user, or null when no account matches
|
|
1240
1252
|
*/
|
|
1241
1253
|
async getUserByEmail(params) {
|
|
1242
1254
|
const path = this.buildAdminUrl(this.adminEndpoints.getUserByEmail);
|
|
@@ -1277,7 +1289,7 @@ var AdminOperations = class {
|
|
|
1277
1289
|
*
|
|
1278
1290
|
* @param sub - Target user's external identifier
|
|
1279
1291
|
* @param sessionId - Session to revoke
|
|
1280
|
-
* @returns Whether the session was revoked
|
|
1292
|
+
* @returns Whether the session was revoked, and whether it was the caller's own
|
|
1281
1293
|
*/
|
|
1282
1294
|
async revokeUserSession(sub, sessionId) {
|
|
1283
1295
|
const path = this.buildAdminUrl(this.adminEndpoints.revokeUserSession, { sub, sessionId });
|