@nauth-toolkit/client 0.4.0 → 0.6.0
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 +373 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +453 -2
- package/dist/index.d.ts +453 -2
- package/dist/index.mjs +373 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -250,6 +250,90 @@ interface ForceChangePasswordResponse extends BaseChallengeResponse {
|
|
|
250
250
|
type: AuthChallenge.FORCE_CHANGE_PASSWORD;
|
|
251
251
|
newPassword: string;
|
|
252
252
|
}
|
|
253
|
+
/**
|
|
254
|
+
* Response from revoking a single session.
|
|
255
|
+
*/
|
|
256
|
+
interface LogoutSessionResponse {
|
|
257
|
+
/** Whether the session was revoked */
|
|
258
|
+
success: boolean;
|
|
259
|
+
/**
|
|
260
|
+
* Whether the revoked session was the one making the request.
|
|
261
|
+
*
|
|
262
|
+
* When true the caller has just signed itself out, so the local auth state should be
|
|
263
|
+
* cleared rather than left pointing at a session the server no longer honours.
|
|
264
|
+
*/
|
|
265
|
+
wasCurrentSession: boolean;
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* Response from checking whether the current user may set a first password.
|
|
269
|
+
*/
|
|
270
|
+
interface CanSetPasswordResponse {
|
|
271
|
+
/** True for a social-only account that has no password yet */
|
|
272
|
+
canSetPassword: boolean;
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* Response from setting a first password on a social-only account.
|
|
276
|
+
*/
|
|
277
|
+
interface SetPasswordResponse {
|
|
278
|
+
/** Human-readable confirmation message */
|
|
279
|
+
message: string;
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* Response listing the MFA methods this deployment permits.
|
|
283
|
+
*/
|
|
284
|
+
interface AvailableMfaMethodsResponse {
|
|
285
|
+
/**
|
|
286
|
+
* Method names that are registered and allowed by configuration, whether or not the
|
|
287
|
+
* caller has enrolled them.
|
|
288
|
+
*/
|
|
289
|
+
availableMethods: string[];
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* A trusted device that may skip MFA, without any token material.
|
|
293
|
+
*/
|
|
294
|
+
interface TrustedDeviceInfo {
|
|
295
|
+
/** Record id. Identifies the device when revoking it. */
|
|
296
|
+
id: number;
|
|
297
|
+
/** Client-supplied device identifier, when the client sends one. */
|
|
298
|
+
deviceId?: string | null;
|
|
299
|
+
/** Human-readable device label. */
|
|
300
|
+
deviceName?: string | null;
|
|
301
|
+
/** Device form factor (e.g. `mobile`, `desktop`). */
|
|
302
|
+
deviceType?: string | null;
|
|
303
|
+
/** IP address the device was trusted from. */
|
|
304
|
+
ipAddress?: string | null;
|
|
305
|
+
/** Operating system reported by the device. */
|
|
306
|
+
platform?: string | null;
|
|
307
|
+
/** Browser reported by the device. */
|
|
308
|
+
browser?: string | null;
|
|
309
|
+
/** ISO timestamp at which the trust expires. */
|
|
310
|
+
trustedUntil: string | Date;
|
|
311
|
+
/** ISO timestamp of last use, or null if unused since being trusted. */
|
|
312
|
+
lastUsedAt?: string | Date | null;
|
|
313
|
+
/** ISO timestamp at which the device was trusted. */
|
|
314
|
+
createdAt: string | Date;
|
|
315
|
+
}
|
|
316
|
+
/**
|
|
317
|
+
* Response listing trusted devices.
|
|
318
|
+
*/
|
|
319
|
+
interface ListTrustedDevicesResponse {
|
|
320
|
+
/** Unexpired trusted devices, most recently used first. */
|
|
321
|
+
trustedDevices: TrustedDeviceInfo[];
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
324
|
+
* Response from revoking a single trusted device.
|
|
325
|
+
*/
|
|
326
|
+
interface RevokeTrustedDeviceResponse {
|
|
327
|
+
/** Whether a matching device was found and revoked. */
|
|
328
|
+
success: boolean;
|
|
329
|
+
}
|
|
330
|
+
/**
|
|
331
|
+
* Response from revoking every trusted device.
|
|
332
|
+
*/
|
|
333
|
+
interface RevokeAllTrustedDevicesResponse {
|
|
334
|
+
/** How many devices were revoked. */
|
|
335
|
+
revokedCount: number;
|
|
336
|
+
}
|
|
253
337
|
|
|
254
338
|
/**
|
|
255
339
|
* Full user profile returned from profile endpoints.
|
|
@@ -694,16 +778,27 @@ interface NAuthEndpoints {
|
|
|
694
778
|
mfaVerifySetup: string;
|
|
695
779
|
mfaPreferred: string;
|
|
696
780
|
mfaBackupCodes: string;
|
|
781
|
+
mfaAvailableMethods: string;
|
|
697
782
|
socialLinked: string;
|
|
698
783
|
socialLink: string;
|
|
699
784
|
socialUnlink: string;
|
|
700
785
|
socialVerify: string;
|
|
701
786
|
socialRedirectStart: string;
|
|
702
787
|
socialExchange: string;
|
|
788
|
+
socialCanSetPassword: string;
|
|
789
|
+
socialSetPassword: string;
|
|
703
790
|
trustDevice: string;
|
|
704
791
|
isTrustedDevice: string;
|
|
705
792
|
auditHistory: string;
|
|
706
793
|
updateProfile: string;
|
|
794
|
+
/** GET /sessions - the caller's own sessions */
|
|
795
|
+
sessions: string;
|
|
796
|
+
/** DELETE /sessions/:sessionId - revoke one of the caller's own sessions */
|
|
797
|
+
logoutSession: string;
|
|
798
|
+
/** GET + DELETE /trusted-devices - list, or revoke all of, the caller's trusted devices */
|
|
799
|
+
trustedDevices: string;
|
|
800
|
+
/** DELETE /trusted-devices/:deviceId - revoke one of the caller's trusted devices */
|
|
801
|
+
trustedDevice: string;
|
|
707
802
|
}
|
|
708
803
|
/**
|
|
709
804
|
* Admin endpoint paths for administrative operations.
|
|
@@ -717,6 +812,12 @@ interface NAuthAdminEndpoints {
|
|
|
717
812
|
getUsers: string;
|
|
718
813
|
/** GET /users/:sub - Get user by sub */
|
|
719
814
|
getUser: string;
|
|
815
|
+
/** GET /users/by-email - Resolve a user by email address */
|
|
816
|
+
getUserByEmail: string;
|
|
817
|
+
/** PUT /users/:sub - Update a user's attributes */
|
|
818
|
+
updateUser: string;
|
|
819
|
+
/** POST /users/:sub/verified-status - Set email/phone verified flags */
|
|
820
|
+
updateVerifiedStatus: string;
|
|
720
821
|
/** DELETE /users/:sub - Delete user */
|
|
721
822
|
deleteUser: string;
|
|
722
823
|
/** POST /users/:sub/disable - Disable user account */
|
|
@@ -731,6 +832,12 @@ interface NAuthAdminEndpoints {
|
|
|
731
832
|
resetPasswordInitiate: string;
|
|
732
833
|
/** GET /users/:sub/sessions - Get user sessions */
|
|
733
834
|
getUserSessions: string;
|
|
835
|
+
/** DELETE /users/:sub/sessions/:sessionId - Revoke one session of a user */
|
|
836
|
+
revokeUserSession: string;
|
|
837
|
+
/** GET + DELETE /users/:sub/trusted-devices - List, or revoke all of, a user's trusted devices */
|
|
838
|
+
trustedDevices: string;
|
|
839
|
+
/** DELETE /users/:sub/trusted-devices/:deviceId - Revoke one trusted device of a user */
|
|
840
|
+
trustedDevice: string;
|
|
734
841
|
/** POST /users/:sub/logout-all - Logout all sessions */
|
|
735
842
|
logoutAll: string;
|
|
736
843
|
/** GET /users/:sub/mfa/status - Get MFA status */
|
|
@@ -745,6 +852,18 @@ interface NAuthAdminEndpoints {
|
|
|
745
852
|
setMfaExemption: string;
|
|
746
853
|
/** GET /audit/history - Get audit history */
|
|
747
854
|
getAuditHistory: string;
|
|
855
|
+
/** GET /audit/events - Get audit events filtered by event type */
|
|
856
|
+
getEventsByType: string;
|
|
857
|
+
/** GET /audit/suspicious - Get events flagged as suspicious */
|
|
858
|
+
getSuspiciousActivity: string;
|
|
859
|
+
/** GET /audit/risk - Get a user's risk assessment history */
|
|
860
|
+
getRiskAssessmentHistory: string;
|
|
861
|
+
/** POST + GET /api-keys - Create and list API keys on behalf of a user */
|
|
862
|
+
apiKeys: string;
|
|
863
|
+
/** PATCH + DELETE /api-keys/:keyId - Update and delete a user's API key */
|
|
864
|
+
apiKey: string;
|
|
865
|
+
/** POST /api-keys/:keyId/revoke - Revoke a user's API key */
|
|
866
|
+
apiKeyRevoke: string;
|
|
748
867
|
}
|
|
749
868
|
/**
|
|
750
869
|
* Context provided to onAuthResponse callback.
|
|
@@ -1823,6 +1942,59 @@ interface AdminAuditHistoryRequest {
|
|
|
1823
1942
|
*/
|
|
1824
1943
|
eventStatus?: string;
|
|
1825
1944
|
}
|
|
1945
|
+
/**
|
|
1946
|
+
* Request for resolving a user by email address.
|
|
1947
|
+
*/
|
|
1948
|
+
interface GetUserByEmailRequest {
|
|
1949
|
+
/** Email address to look up */
|
|
1950
|
+
email: string;
|
|
1951
|
+
/** When true, only match accounts whose email is already verified */
|
|
1952
|
+
requireEmailVerified?: boolean;
|
|
1953
|
+
}
|
|
1954
|
+
/**
|
|
1955
|
+
* Request for setting a user's verified flags.
|
|
1956
|
+
*
|
|
1957
|
+
* Omitted flags are left unchanged, so a caller can set one without disturbing the other.
|
|
1958
|
+
*/
|
|
1959
|
+
interface UpdateVerifiedStatusRequest {
|
|
1960
|
+
/** Mark the email address verified or unverified */
|
|
1961
|
+
isEmailVerified?: boolean;
|
|
1962
|
+
/** Mark the phone number verified or unverified */
|
|
1963
|
+
isPhoneVerified?: boolean;
|
|
1964
|
+
}
|
|
1965
|
+
/**
|
|
1966
|
+
* Request for fetching audit events of a single type.
|
|
1967
|
+
*/
|
|
1968
|
+
interface GetEventsByTypeRequest {
|
|
1969
|
+
/** Event type to filter on */
|
|
1970
|
+
eventType: string;
|
|
1971
|
+
/** Page number (1-indexed) */
|
|
1972
|
+
page?: number;
|
|
1973
|
+
/** Records per page */
|
|
1974
|
+
limit?: number;
|
|
1975
|
+
/** Only include events at or after this instant */
|
|
1976
|
+
startDate?: string | Date;
|
|
1977
|
+
/** Only include events at or before this instant */
|
|
1978
|
+
endDate?: string | Date;
|
|
1979
|
+
}
|
|
1980
|
+
/**
|
|
1981
|
+
* Request for fetching events flagged as suspicious.
|
|
1982
|
+
*/
|
|
1983
|
+
interface GetSuspiciousActivityRequest {
|
|
1984
|
+
/** Restrict to a single user; omit to search across all users */
|
|
1985
|
+
sub?: string;
|
|
1986
|
+
/** Maximum number of events to return */
|
|
1987
|
+
limit?: number;
|
|
1988
|
+
}
|
|
1989
|
+
/**
|
|
1990
|
+
* Request for fetching a user's risk assessment history.
|
|
1991
|
+
*/
|
|
1992
|
+
interface GetRiskAssessmentHistoryRequest {
|
|
1993
|
+
/** Target user's external identifier (UUID v4) */
|
|
1994
|
+
sub: string;
|
|
1995
|
+
/** Maximum number of assessments to return */
|
|
1996
|
+
limit?: number;
|
|
1997
|
+
}
|
|
1826
1998
|
|
|
1827
1999
|
/**
|
|
1828
2000
|
* API Key types for the NAuth client SDK.
|
|
@@ -1889,6 +2061,37 @@ interface CreateApiKeyResult {
|
|
|
1889
2061
|
/** Sanitized metadata for the created key */
|
|
1890
2062
|
apiKey: ApiKeyInfo;
|
|
1891
2063
|
}
|
|
2064
|
+
/**
|
|
2065
|
+
* Response from listing API keys.
|
|
2066
|
+
*/
|
|
2067
|
+
interface ListApiKeysResponse {
|
|
2068
|
+
/** Sanitized metadata for each key; never contains plaintext */
|
|
2069
|
+
apiKeys: ApiKeyInfo[];
|
|
2070
|
+
}
|
|
2071
|
+
/**
|
|
2072
|
+
* Response from revoking an API key.
|
|
2073
|
+
*/
|
|
2074
|
+
interface RevokeApiKeyResponse {
|
|
2075
|
+
/** Whether the key was revoked */
|
|
2076
|
+
success: boolean;
|
|
2077
|
+
}
|
|
2078
|
+
/**
|
|
2079
|
+
* Response from permanently deleting an API key.
|
|
2080
|
+
*/
|
|
2081
|
+
interface DeleteApiKeyResponse {
|
|
2082
|
+
/** Whether the key was deleted */
|
|
2083
|
+
success: boolean;
|
|
2084
|
+
}
|
|
2085
|
+
/**
|
|
2086
|
+
* Request body for creating an API key on behalf of another user (admin).
|
|
2087
|
+
*
|
|
2088
|
+
* Administrative creation bypasses the `allowUserCreation` setting but still enforces
|
|
2089
|
+
* per-user key limits, expiry rules, and IP restrictions.
|
|
2090
|
+
*/
|
|
2091
|
+
interface AdminCreateApiKeyRequest extends CreateApiKeyRequest {
|
|
2092
|
+
/** Target user's external identifier (UUID v4) */
|
|
2093
|
+
sub: string;
|
|
2094
|
+
}
|
|
1892
2095
|
|
|
1893
2096
|
/**
|
|
1894
2097
|
* Types for driving an OpenID Connect interaction from the browser.
|
|
@@ -2782,6 +2985,145 @@ declare class AdminOperations {
|
|
|
2782
2985
|
* ```
|
|
2783
2986
|
*/
|
|
2784
2987
|
getAuditHistory(params: AdminAuditHistoryRequest): Promise<AuditHistoryResponse>;
|
|
2988
|
+
/**
|
|
2989
|
+
* Resolve a user by email address.
|
|
2990
|
+
*
|
|
2991
|
+
* Email is not necessarily a stable identifier - an account's address can be changed,
|
|
2992
|
+
* and with `requireEmailVerified` unset an unverified address matches too - so prefer
|
|
2993
|
+
* `sub` wherever the caller already holds one.
|
|
2994
|
+
*
|
|
2995
|
+
* @param params - Email to look up, and whether to require a verified address
|
|
2996
|
+
* @returns The matching user
|
|
2997
|
+
*/
|
|
2998
|
+
getUserByEmail(params: GetUserByEmailRequest): Promise<AuthUser>;
|
|
2999
|
+
/**
|
|
3000
|
+
* Update a user's profile attributes.
|
|
3001
|
+
*
|
|
3002
|
+
* @param sub - Target user's external identifier
|
|
3003
|
+
* @param attributes - Attributes to change; omitted fields are left as they are
|
|
3004
|
+
* @returns The updated user
|
|
3005
|
+
*/
|
|
3006
|
+
updateUser(sub: string, attributes: UpdateProfileRequest): Promise<AuthUser>;
|
|
3007
|
+
/**
|
|
3008
|
+
* Set a user's email/phone verified flags directly.
|
|
3009
|
+
*
|
|
3010
|
+
* Marks contact details verified without the user completing a verification challenge -
|
|
3011
|
+
* for accounts migrated from a system that already verified them, or verified out of
|
|
3012
|
+
* band. Omitted flags are left unchanged.
|
|
3013
|
+
*
|
|
3014
|
+
* @param sub - Target user's external identifier
|
|
3015
|
+
* @param status - Flags to set
|
|
3016
|
+
* @returns The updated user
|
|
3017
|
+
*/
|
|
3018
|
+
updateVerifiedStatus(sub: string, status: UpdateVerifiedStatusRequest): Promise<AuthUser>;
|
|
3019
|
+
/**
|
|
3020
|
+
* Revoke one specific session of a user.
|
|
3021
|
+
*
|
|
3022
|
+
* Signs that one device out and leaves the user's other sessions alone; to end every
|
|
3023
|
+
* session use {@link logoutAllSessions}.
|
|
3024
|
+
*
|
|
3025
|
+
* @param sub - Target user's external identifier
|
|
3026
|
+
* @param sessionId - Session to revoke
|
|
3027
|
+
* @returns Whether the session was revoked
|
|
3028
|
+
*/
|
|
3029
|
+
revokeUserSession(sub: string, sessionId: string): Promise<{
|
|
3030
|
+
success: boolean;
|
|
3031
|
+
}>;
|
|
3032
|
+
/**
|
|
3033
|
+
* List a user's trusted devices.
|
|
3034
|
+
*
|
|
3035
|
+
* These are the devices allowed to skip MFA for that user. Expired devices are
|
|
3036
|
+
* filtered out server-side.
|
|
3037
|
+
*
|
|
3038
|
+
* @param sub - Target user's external identifier
|
|
3039
|
+
* @returns The user's unexpired trusted devices, most recently used first
|
|
3040
|
+
*/
|
|
3041
|
+
getUserTrustedDevices(sub: string): Promise<ListTrustedDevicesResponse>;
|
|
3042
|
+
/**
|
|
3043
|
+
* Revoke one of a user's trusted devices.
|
|
3044
|
+
*
|
|
3045
|
+
* That device must satisfy MFA again on its next sign-in; the user's other devices
|
|
3046
|
+
* are left alone.
|
|
3047
|
+
*
|
|
3048
|
+
* @param sub - Target user's external identifier
|
|
3049
|
+
* @param deviceId - Trusted device record id, from {@link getUserTrustedDevices}
|
|
3050
|
+
* @returns Whether a matching device was revoked
|
|
3051
|
+
*/
|
|
3052
|
+
revokeUserTrustedDevice(sub: string, deviceId: number): Promise<RevokeTrustedDeviceResponse>;
|
|
3053
|
+
/**
|
|
3054
|
+
* Revoke every trusted device belonging to a user.
|
|
3055
|
+
*
|
|
3056
|
+
* Each of their devices must then satisfy MFA again. This does not sign them out —
|
|
3057
|
+
* use {@link logoutAllSessions} for that.
|
|
3058
|
+
*
|
|
3059
|
+
* @param sub - Target user's external identifier
|
|
3060
|
+
* @returns How many devices were revoked
|
|
3061
|
+
*/
|
|
3062
|
+
revokeAllUserTrustedDevices(sub: string): Promise<RevokeAllTrustedDevicesResponse>;
|
|
3063
|
+
/**
|
|
3064
|
+
* Fetch audit events of a single type, across all users.
|
|
3065
|
+
*
|
|
3066
|
+
* @param params - Event type to filter on, plus paging and an optional date window
|
|
3067
|
+
* @returns Paginated matching events
|
|
3068
|
+
*/
|
|
3069
|
+
getEventsByType(params: GetEventsByTypeRequest): Promise<AuditHistoryResponse>;
|
|
3070
|
+
/**
|
|
3071
|
+
* Fetch events the risk engine flagged as suspicious.
|
|
3072
|
+
*
|
|
3073
|
+
* @param params - Optional user to restrict to, and a result cap
|
|
3074
|
+
* @returns The flagged events
|
|
3075
|
+
*/
|
|
3076
|
+
getSuspiciousActivity(params?: GetSuspiciousActivityRequest): Promise<AuditHistoryResponse>;
|
|
3077
|
+
/**
|
|
3078
|
+
* Fetch a user's risk assessment history.
|
|
3079
|
+
*
|
|
3080
|
+
* @param params - Target user, and a result cap
|
|
3081
|
+
* @returns The user's recorded risk assessments
|
|
3082
|
+
*/
|
|
3083
|
+
getRiskAssessmentHistory(params: GetRiskAssessmentHistoryRequest): Promise<AuditHistoryResponse>;
|
|
3084
|
+
/**
|
|
3085
|
+
* Create an API key on behalf of a user.
|
|
3086
|
+
*
|
|
3087
|
+
* Bypasses the server's `allowUserCreation` setting - which governs users creating
|
|
3088
|
+
* their own keys - but still enforces per-user limits, expiry rules, and IP
|
|
3089
|
+
* restrictions. The plaintext key is returned exactly once.
|
|
3090
|
+
*
|
|
3091
|
+
* @param request - Target user plus label, expiry, and optional IP allowlist
|
|
3092
|
+
* @returns The plaintext key and its sanitized metadata
|
|
3093
|
+
*/
|
|
3094
|
+
createApiKey(request: AdminCreateApiKeyRequest): Promise<CreateApiKeyResult>;
|
|
3095
|
+
/**
|
|
3096
|
+
* List a user's API keys.
|
|
3097
|
+
*
|
|
3098
|
+
* @param sub - Target user's external identifier
|
|
3099
|
+
* @returns Sanitized key metadata; never includes plaintext keys
|
|
3100
|
+
*/
|
|
3101
|
+
listApiKeys(sub: string): Promise<ListApiKeysResponse>;
|
|
3102
|
+
/**
|
|
3103
|
+
* Update the label and/or IP allowlist of a user's API key.
|
|
3104
|
+
*
|
|
3105
|
+
* @param sub - Target user's external identifier
|
|
3106
|
+
* @param keyId - Key to update
|
|
3107
|
+
* @param updates - New label and/or replacement IP allowlist
|
|
3108
|
+
* @returns The key's updated metadata
|
|
3109
|
+
*/
|
|
3110
|
+
updateApiKey(sub: string, keyId: string, updates: UpdateApiKeyRequest): Promise<ApiKeyInfo>;
|
|
3111
|
+
/**
|
|
3112
|
+
* Revoke a user's API key, leaving it in place but unusable.
|
|
3113
|
+
*
|
|
3114
|
+
* @param sub - Target user's external identifier
|
|
3115
|
+
* @param keyId - Key to revoke
|
|
3116
|
+
* @returns Whether the key was revoked
|
|
3117
|
+
*/
|
|
3118
|
+
revokeApiKey(sub: string, keyId: string): Promise<RevokeApiKeyResponse>;
|
|
3119
|
+
/**
|
|
3120
|
+
* Permanently delete a user's API key.
|
|
3121
|
+
*
|
|
3122
|
+
* @param sub - Target user's external identifier
|
|
3123
|
+
* @param keyId - Key to delete
|
|
3124
|
+
* @returns Whether the key was deleted
|
|
3125
|
+
*/
|
|
3126
|
+
deleteApiKey(sub: string, keyId: string): Promise<DeleteApiKeyResponse>;
|
|
2785
3127
|
/**
|
|
2786
3128
|
* Build admin endpoint URL with path parameter replacement
|
|
2787
3129
|
*
|
|
@@ -2845,10 +3187,30 @@ declare class AdminOperations {
|
|
|
2845
3187
|
* @private
|
|
2846
3188
|
*/
|
|
2847
3189
|
private post;
|
|
3190
|
+
/**
|
|
3191
|
+
* Execute PUT request
|
|
3192
|
+
*
|
|
3193
|
+
* @param path - Full URL path
|
|
3194
|
+
* @param body - Request body
|
|
3195
|
+
* @returns Response data
|
|
3196
|
+
* @private
|
|
3197
|
+
*/
|
|
3198
|
+
private put;
|
|
3199
|
+
/**
|
|
3200
|
+
* Execute PATCH request
|
|
3201
|
+
*
|
|
3202
|
+
* @param path - Full URL path
|
|
3203
|
+
* @param body - Request body
|
|
3204
|
+
* @returns Response data
|
|
3205
|
+
* @private
|
|
3206
|
+
*/
|
|
3207
|
+
private patch;
|
|
2848
3208
|
/**
|
|
2849
3209
|
* Execute DELETE request
|
|
2850
3210
|
*
|
|
2851
3211
|
* @param path - Full URL path
|
|
3212
|
+
* @param body - Optional request body, for routes that identify their target from the
|
|
3213
|
+
* body as well as the path
|
|
2852
3214
|
* @returns Response data
|
|
2853
3215
|
* @private
|
|
2854
3216
|
*/
|
|
@@ -3417,15 +3779,22 @@ declare class NAuthClient {
|
|
|
3417
3779
|
* - Passkey: WebAuthn registration options
|
|
3418
3780
|
*
|
|
3419
3781
|
* @param method - MFA method to set up
|
|
3782
|
+
* @param setupData - Method-specific enrolment input. SMS and email enrolment need a
|
|
3783
|
+
* destination (`{ phoneNumber }` in E.164, or `{ emailAddress }`) whenever the account
|
|
3784
|
+
* does not already hold a verified one; without it the server answers `PHONE_REQUIRED`
|
|
3785
|
+
* or `EMAIL_REQUIRED`. Pass `deviceName` to label the device.
|
|
3420
3786
|
* @returns Promise of setup data response
|
|
3421
3787
|
*
|
|
3422
3788
|
* @example
|
|
3423
3789
|
* ```typescript
|
|
3424
3790
|
* const result = await client.setupMfaDevice('totp');
|
|
3425
3791
|
* console.log('QR Code:', result.setupData.qrCode);
|
|
3792
|
+
*
|
|
3793
|
+
* // Enrolling a phone the account does not have on file yet
|
|
3794
|
+
* await client.setupMfaDevice('sms', { phoneNumber: '+15551234567', deviceName: 'Work phone' });
|
|
3426
3795
|
* ```
|
|
3427
3796
|
*/
|
|
3428
|
-
setupMfaDevice(method: string): Promise<GetSetupDataResponse>;
|
|
3797
|
+
setupMfaDevice(method: string, setupData?: Record<string, unknown>): Promise<GetSetupDataResponse>;
|
|
3429
3798
|
/**
|
|
3430
3799
|
* Verify MFA setup (authenticated user).
|
|
3431
3800
|
*
|
|
@@ -3530,6 +3899,69 @@ declare class NAuthClient {
|
|
|
3530
3899
|
* Generate backup codes.
|
|
3531
3900
|
*/
|
|
3532
3901
|
generateBackupCodes(): Promise<string[]>;
|
|
3902
|
+
/**
|
|
3903
|
+
* List the MFA methods this deployment permits.
|
|
3904
|
+
*
|
|
3905
|
+
* Reflects what the server has registered and enabled, not what the caller has
|
|
3906
|
+
* enrolled - use {@link getMfaDevices} for that. Enrolment screens use this to decide
|
|
3907
|
+
* which options to offer.
|
|
3908
|
+
*
|
|
3909
|
+
* @returns The allowed method names
|
|
3910
|
+
*/
|
|
3911
|
+
getAvailableMfaMethods(): Promise<AvailableMfaMethodsResponse>;
|
|
3912
|
+
/**
|
|
3913
|
+
* ============================================================================
|
|
3914
|
+
* Sessions
|
|
3915
|
+
* ============================================================================
|
|
3916
|
+
*/
|
|
3917
|
+
/**
|
|
3918
|
+
* List the caller's own active sessions.
|
|
3919
|
+
*
|
|
3920
|
+
* @returns The caller's sessions, one entry per active device/session
|
|
3921
|
+
*/
|
|
3922
|
+
listSessions(): Promise<GetUserSessionsResponse>;
|
|
3923
|
+
/**
|
|
3924
|
+
* Revoke one of the caller's own sessions.
|
|
3925
|
+
*
|
|
3926
|
+
* Revoking the session that is making the request signs the caller out; the response's
|
|
3927
|
+
* `wasCurrentSession` reports that, so the caller can clear local auth state.
|
|
3928
|
+
*
|
|
3929
|
+
* @param sessionId - Session to revoke
|
|
3930
|
+
* @returns Whether the session was revoked, and whether it was the caller's own
|
|
3931
|
+
*/
|
|
3932
|
+
revokeSession(sessionId: string): Promise<LogoutSessionResponse>;
|
|
3933
|
+
/**
|
|
3934
|
+
* ============================================================================
|
|
3935
|
+
* Trusted Devices
|
|
3936
|
+
* ============================================================================
|
|
3937
|
+
*/
|
|
3938
|
+
/**
|
|
3939
|
+
* List the caller's own trusted devices.
|
|
3940
|
+
*
|
|
3941
|
+
* These are the devices allowed to skip MFA. Expired devices are filtered out
|
|
3942
|
+
* server-side, so the list is what can currently be used and is worth showing.
|
|
3943
|
+
*
|
|
3944
|
+
* @returns The caller's unexpired trusted devices, most recently used first
|
|
3945
|
+
*/
|
|
3946
|
+
listTrustedDevices(): Promise<ListTrustedDevicesResponse>;
|
|
3947
|
+
/**
|
|
3948
|
+
* Revoke one of the caller's own trusted devices.
|
|
3949
|
+
*
|
|
3950
|
+
* That device must satisfy MFA again on its next sign-in.
|
|
3951
|
+
*
|
|
3952
|
+
* @param deviceId - Trusted device record id, from {@link listTrustedDevices}
|
|
3953
|
+
* @returns Whether a matching device was revoked
|
|
3954
|
+
*/
|
|
3955
|
+
revokeTrustedDevice(deviceId: number): Promise<RevokeTrustedDeviceResponse>;
|
|
3956
|
+
/**
|
|
3957
|
+
* Revoke every trusted device belonging to the caller.
|
|
3958
|
+
*
|
|
3959
|
+
* Every device must then satisfy MFA again. This does not sign anyone out — use
|
|
3960
|
+
* {@link logoutAll} for that.
|
|
3961
|
+
*
|
|
3962
|
+
* @returns How many devices were revoked
|
|
3963
|
+
*/
|
|
3964
|
+
revokeAllTrustedDevices(): Promise<RevokeAllTrustedDevicesResponse>;
|
|
3533
3965
|
/**
|
|
3534
3966
|
* ============================================================================
|
|
3535
3967
|
* Event System
|
|
@@ -3620,6 +4052,25 @@ declare class NAuthClient {
|
|
|
3620
4052
|
unlinkSocialAccount(provider: string): Promise<{
|
|
3621
4053
|
message: string;
|
|
3622
4054
|
}>;
|
|
4055
|
+
/**
|
|
4056
|
+
* Check whether the caller may set a first password.
|
|
4057
|
+
*
|
|
4058
|
+
* True for a social-only account that has no password yet. Use it to decide whether to
|
|
4059
|
+
* offer "set a password" (this call) or "change password" ({@link changePassword}).
|
|
4060
|
+
*
|
|
4061
|
+
* @returns Whether the caller can set a first password
|
|
4062
|
+
*/
|
|
4063
|
+
canSetPassword(): Promise<CanSetPasswordResponse>;
|
|
4064
|
+
/**
|
|
4065
|
+
* Give a social-only account its first password.
|
|
4066
|
+
*
|
|
4067
|
+
* Only valid while {@link canSetPassword} is true; an account that already has one must
|
|
4068
|
+
* use {@link changePassword}, which verifies the existing password.
|
|
4069
|
+
*
|
|
4070
|
+
* @param newPassword - Password to set, subject to the server's password policy
|
|
4071
|
+
* @returns Confirmation message
|
|
4072
|
+
*/
|
|
4073
|
+
setPasswordForSocialUser(newPassword: string): Promise<SetPasswordResponse>;
|
|
3623
4074
|
/**
|
|
3624
4075
|
* Trust current device.
|
|
3625
4076
|
*/
|
|
@@ -3970,4 +4421,4 @@ declare class FetchAdapter implements HttpAdapter {
|
|
|
3970
4421
|
request<T>(config: HttpRequest): Promise<HttpResponse<T>>;
|
|
3971
4422
|
}
|
|
3972
4423
|
|
|
3973
|
-
export { type AdminAuditHistoryRequest, 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 BackupCodesResponse, type BaseChallengeResponse, BrowserStorage, type ChallengeResponse, ChallengeRouter, type ChangePasswordRequest, type ConfirmForgotPasswordRequest, type ConfirmForgotPasswordResponse, type CreateApiKeyRequest, type CreateApiKeyResult, DEFAULT_INTERACTION_ROUTE, type DateFilter, type DeleteUserResponse, type DisableUserResponse, type EnableUserResponse, EventEmitter, FetchAdapter, type ForceChangePasswordResponse, type ForgotPasswordRequest, type ForgotPasswordResponse, type GetChallengeDataRequest, type GetChallengeDataResponse, type GetMFADevicesResponse, type GetSetupDataRequest, type GetSetupDataResponse, type GetUserSessionsResponse, type GetUsersRequest, type GetUsersResponse, type HttpAdapter, type HttpRequest, type HttpResponse, InMemoryStorage, type LinkedAccountsResponse, type LoginRequest, type LogoutAllRequest, type LogoutRequest, type MFAChallengeMethod, type MFACodeResponse, type MFADevice, type MFADeviceMethod, type MFAMethod, type MFAPasskeyResponse, type MFASetupData, type MFASetupResponse, type MFAStatus, 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 SignupRequest, type SocialLoginOptions, type SocialProvider, type SocialVerifyRequest, type TokenDeliveryMode, type TokenResponse, type UpdateApiKeyRequest, type UpdateProfileRequest, type UserSessionInfo, type VerifyEmailResponse, type VerifyPhoneCodeResponse, type VerifyPhoneCollectResponse, apiKeyHeader, defaultAdminEndpoints, defaultEndpoints, getChallengeInstructions, getMFAMethod, getMaskedDestination, isOTPChallenge, requiresPhoneCollection, resolveConfig };
|
|
4424
|
+
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 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 };
|