@drmhse/sso-sdk 0.3.4 → 0.3.6
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/README.md +4 -4
- package/dist/index.d.mts +54 -1
- package/dist/index.d.ts +54 -1
- package/dist/index.js +75 -0
- package/dist/index.mjs +74 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
# AuthOS SDK
|
|
1
|
+
# [AuthOS](https://authos.dev) SDK
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/@drmhse/sso-sdk)
|
|
4
4
|
[](https://opensource.org/licenses/MIT)
|
|
5
5
|
|
|
6
|
-
A zero-dependency, strongly-typed TypeScript SDK for AuthOS, the multi-tenant authentication platform.
|
|
6
|
+
A zero-dependency, strongly-typed TypeScript SDK for [AuthOS](https://authos.dev), the multi-tenant authentication platform.
|
|
7
7
|
|
|
8
8
|
**[View Full Documentation →](https://drmhse.com/docs/sso/)**
|
|
9
9
|
|
|
@@ -331,7 +331,7 @@ sso.onAuthStateChange((isAuthenticated) => {
|
|
|
331
331
|
|
|
332
332
|
## Platform Administration
|
|
333
333
|
|
|
334
|
-
For platform owners managing AuthOS:
|
|
334
|
+
For platform owners managing [AuthOS](https://authos.dev):
|
|
335
335
|
|
|
336
336
|
```typescript
|
|
337
337
|
// Approve pending organization
|
|
@@ -383,7 +383,7 @@ const login = async (credentials: LoginPayload): Promise<RefreshTokenResponse> =
|
|
|
383
383
|
|
|
384
384
|
## Validating JWTs in Your Backend
|
|
385
385
|
|
|
386
|
-
AuthOS uses RS256 (asymmetric) JWT signing. Your backend can validate tokens without sharing secrets:
|
|
386
|
+
[AuthOS](https://authos.dev) uses RS256 (asymmetric) JWT signing. Your backend can validate tokens without sharing secrets:
|
|
387
387
|
|
|
388
388
|
```typescript
|
|
389
389
|
// Fetch JWKS from the SSO platform
|
package/dist/index.d.mts
CHANGED
|
@@ -23,6 +23,31 @@ declare class BrowserStorage implements TokenStorage {
|
|
|
23
23
|
setItem(key: string, value: string): void;
|
|
24
24
|
removeItem(key: string): void;
|
|
25
25
|
}
|
|
26
|
+
/**
|
|
27
|
+
* Browser Cookie adapter for SSR frameworks (Next.js, Nuxt, etc.)
|
|
28
|
+
*
|
|
29
|
+
* Uses document.cookie for client-side access. Works with server-side
|
|
30
|
+
* middleware that can read the same cookies.
|
|
31
|
+
*
|
|
32
|
+
* For Next.js App Router, pair this with cookies() from 'next/headers'
|
|
33
|
+
* in server components to pass the initial token.
|
|
34
|
+
*/
|
|
35
|
+
declare class CookieStorage implements TokenStorage {
|
|
36
|
+
private options;
|
|
37
|
+
constructor(options?: {
|
|
38
|
+
domain?: string;
|
|
39
|
+
path?: string;
|
|
40
|
+
secure?: boolean;
|
|
41
|
+
sameSite?: 'strict' | 'lax' | 'none';
|
|
42
|
+
maxAge?: number;
|
|
43
|
+
});
|
|
44
|
+
private getCookie;
|
|
45
|
+
private setCookie;
|
|
46
|
+
private deleteCookie;
|
|
47
|
+
getItem(key: string): string | null;
|
|
48
|
+
setItem(key: string, value: string): void;
|
|
49
|
+
removeItem(key: string): void;
|
|
50
|
+
}
|
|
26
51
|
|
|
27
52
|
/**
|
|
28
53
|
* Common types used across the SDK
|
|
@@ -596,6 +621,18 @@ interface ResetPasswordRequest {
|
|
|
596
621
|
interface ResetPasswordResponse {
|
|
597
622
|
message: string;
|
|
598
623
|
}
|
|
624
|
+
/**
|
|
625
|
+
* Resend verification request payload
|
|
626
|
+
*/
|
|
627
|
+
interface ResendVerificationRequest {
|
|
628
|
+
email: string;
|
|
629
|
+
}
|
|
630
|
+
/**
|
|
631
|
+
* Resend verification response
|
|
632
|
+
*/
|
|
633
|
+
interface ResendVerificationResponse {
|
|
634
|
+
message: string;
|
|
635
|
+
}
|
|
599
636
|
/**
|
|
600
637
|
* MFA verification request payload
|
|
601
638
|
*/
|
|
@@ -2440,6 +2477,22 @@ declare class AuthModule {
|
|
|
2440
2477
|
* ```
|
|
2441
2478
|
*/
|
|
2442
2479
|
verifyEmail(token: string): Promise<string>;
|
|
2480
|
+
/**
|
|
2481
|
+
* Resend verification email to a user.
|
|
2482
|
+
* Returns success regardless of whether the email exists (to prevent email enumeration).
|
|
2483
|
+
*
|
|
2484
|
+
* @param payload Resend verification request (email address)
|
|
2485
|
+
* @returns Confirmation message
|
|
2486
|
+
*
|
|
2487
|
+
* @example
|
|
2488
|
+
* ```typescript
|
|
2489
|
+
* const response = await sso.auth.resendVerification({
|
|
2490
|
+
* email: 'user@example.com'
|
|
2491
|
+
* });
|
|
2492
|
+
* console.log(response.message);
|
|
2493
|
+
* ```
|
|
2494
|
+
*/
|
|
2495
|
+
resendVerification(payload: ResendVerificationRequest): Promise<ResendVerificationResponse>;
|
|
2443
2496
|
/**
|
|
2444
2497
|
* Login with email and password.
|
|
2445
2498
|
* Automatically persists the session and configures the client.
|
|
@@ -5716,4 +5769,4 @@ declare class SsoApiError extends Error {
|
|
|
5716
5769
|
isNotFound(): boolean;
|
|
5717
5770
|
}
|
|
5718
5771
|
|
|
5719
|
-
export { type AcceptInvitationPayload, type AdminLoginUrlParams, type AnalyticsQuery, type ApiKey, type ApiKeyCreateResponse, type ApproveOrganizationPayload, type AuditLog, type AuditLogEntry, type AuditLogQueryParams, type AuditLogResponse, AuthErrorCodes, AuthMethod, AuthModule, type AuthSnapshot, type AuthenticationResponseJSON, type BackupCodesResponse, type BrandingConfiguration, BrowserStorage, type ChangePasswordRequest, type ChangePasswordResponse, type ConfigureSamlPayload, type ConfigureSamlResponse, type CreateApiKeyPayload, type CreateCheckoutPayload, type CreateCheckoutResponse, type CreateInvitationPayload, type CreateOrganizationPayload, type CreateOrganizationResponse, type CreatePlanPayload, type CreateScimTokenRequest, type CreateServicePayload, type CreateServiceResponse, type CreateSiemConfigRequest, type CreateWebhookRequest, type DeclineInvitationPayload, type DeviceCodeRequest, type DeviceCodeResponse, type DeviceTrust, type DeviceVerifyResponse, type DomainConfiguration, type DomainVerificationMethod, type DomainVerificationResponse, type DomainVerificationResult, type EndUser, type EndUserDetailResponse, type EndUserIdentity, type EndUserListResponse, type EndUserSubscription, type EventTypeInfo, type ExportUserDataResponse, type ForgetUserResponse, type ForgotPasswordRequest, type ForgotPasswordResponse, type GeolocationData, type GetAuditLogParams, type GetRiskSettingsResponse, type GrowthTrendPoint, type Identity, type ImpersonateRequest, type ImpersonateResponse, type ImpersonationUserInfo, type Invitation, type InvitationStatus, type InvitationWithOrg, InvitationsModule, type JwtClaims, type ListApiKeysResponse, type ListDevicesResponse, type ListEndUsersParams, type ListOrganizationsParams, type ListPlatformOrganizationsParams, type ListScimTokensResponse, type ListSiemConfigsResponse, type LoginActivityPoint, type LoginEventExport, type LoginRequest, type LoginTrendPoint, type LoginUrlParams, type LoginsByProvider, type LoginsByService, type LookupEmailRequest, type LookupEmailResponse, MagicLinks, type MemberListResponse, type MemberRole, type Membership, type MembershipExport, MemoryStorage, type MfaEventExport, type MfaSetupResponse, type MfaStatusResponse, type MfaVerificationRequest, type MfaVerificationResponse, type MfaVerifyRequest, type MfaVerifyResponse, type OAuthCredentials, type OAuthIdentityExport, type OAuthProvider, type Organization, type OrganizationMember, type OrganizationResponse, type OrganizationStatus, type OrganizationStatusBreakdown, type OrganizationTier, OrganizationsModule, type PaginatedResponse, type PaginationInfo, type PaginationParams, type Passkey, type PasskeyAuthFinishRequest, type PasskeyAuthFinishResponse, type PasskeyAuthStartRequest, type PasskeyAuthStartResponse, type PasskeyExport, type PasskeyRegisterFinishRequest, type PasskeyRegisterFinishResponse, type PasskeyRegisterStartRequest, type PasskeyRegisterStartResponse, PasskeysModule, PermissionsModule, type Plan, type PlanResponse, type PlatformAnalyticsDateRangeParams, PlatformModule, type PlatformOrganizationResponse, type PlatformOrganizationsListResponse, type PlatformOverviewMetrics, type PromotePlatformOwnerPayload, type ProviderToken, type ProviderTokenGrant, type RecentLogin, type RecentOrganization, type RefreshTokenRequest, type RefreshTokenResponse, type RegisterRequest, type RegisterResponse, type RegistrationResponseJSON, type RejectOrganizationPayload, type ResetPasswordRequest, type ResetPasswordResponse, type RevokeDeviceRequest, type RevokeDeviceResponse, type RevokeSessionsResponse, RiskAction, type RiskAnalytics, type RiskAssessment, type RiskContext, type RiskEnforcementMode, type RiskEngineConfig, type RiskEvent, RiskEventOutcome, type RiskFactor, RiskFactorType, type RiskRule, type RiskRuleCondition, type RiskScore, type RiskSettings, type SamlCertificate, type SamlConfig, type ScimTokenResponse, type Service, ServiceApiModule, type ServiceListResponse, type ServiceResponse, type ServiceType, type ServiceWithDetails, ServicesModule, type SetCustomDomainRequest, type SetOAuthCredentialsPayload, type SetPasswordRequest, type SetPasswordResponse, type SetSmtpRequest, type SiemConfigResponse, type SiemProviderType, type SmtpConfigResponse, SsoApiError, SsoClient, type SsoClientOptions, type StartLinkResponse, type Subscription, type TestConnectionResponse, type TokenRequest, type TokenResponse, type TokenStorage, type TopOrganization, type TransferOwnershipPayload, type UpdateBrandingRequest, type UpdateMemberRolePayload, type UpdateOrganizationPayload, type UpdateOrganizationTierPayload, type UpdatePlanPayload, type UpdateRiskSettingsRequest, type UpdateRiskSettingsResponse, type UpdateServicePayload, type UpdateSiemConfigRequest, type UpdateUserProfilePayload, type UpdateWebhookRequest, type User, type UserDevice, UserModule, type UserProfile, type Webhook, type WebhookDelivery, type WebhookDeliveryListResponse, type WebhookDeliveryQueryParams, type WebhookListResponse, type WebhookResponse };
|
|
5772
|
+
export { type AcceptInvitationPayload, type AdminLoginUrlParams, type AnalyticsQuery, type ApiKey, type ApiKeyCreateResponse, type ApproveOrganizationPayload, type AuditLog, type AuditLogEntry, type AuditLogQueryParams, type AuditLogResponse, AuthErrorCodes, AuthMethod, AuthModule, type AuthSnapshot, type AuthenticationResponseJSON, type BackupCodesResponse, type BrandingConfiguration, BrowserStorage, type ChangePasswordRequest, type ChangePasswordResponse, type ConfigureSamlPayload, type ConfigureSamlResponse, CookieStorage, type CreateApiKeyPayload, type CreateCheckoutPayload, type CreateCheckoutResponse, type CreateInvitationPayload, type CreateOrganizationPayload, type CreateOrganizationResponse, type CreatePlanPayload, type CreateScimTokenRequest, type CreateServicePayload, type CreateServiceResponse, type CreateSiemConfigRequest, type CreateWebhookRequest, type DeclineInvitationPayload, type DeviceCodeRequest, type DeviceCodeResponse, type DeviceTrust, type DeviceVerifyResponse, type DomainConfiguration, type DomainVerificationMethod, type DomainVerificationResponse, type DomainVerificationResult, type EndUser, type EndUserDetailResponse, type EndUserIdentity, type EndUserListResponse, type EndUserSubscription, type EventTypeInfo, type ExportUserDataResponse, type ForgetUserResponse, type ForgotPasswordRequest, type ForgotPasswordResponse, type GeolocationData, type GetAuditLogParams, type GetRiskSettingsResponse, type GrowthTrendPoint, type Identity, type ImpersonateRequest, type ImpersonateResponse, type ImpersonationUserInfo, type Invitation, type InvitationStatus, type InvitationWithOrg, InvitationsModule, type JwtClaims, type ListApiKeysResponse, type ListDevicesResponse, type ListEndUsersParams, type ListOrganizationsParams, type ListPlatformOrganizationsParams, type ListScimTokensResponse, type ListSiemConfigsResponse, type LoginActivityPoint, type LoginEventExport, type LoginRequest, type LoginTrendPoint, type LoginUrlParams, type LoginsByProvider, type LoginsByService, type LookupEmailRequest, type LookupEmailResponse, MagicLinks, type MemberListResponse, type MemberRole, type Membership, type MembershipExport, MemoryStorage, type MfaEventExport, type MfaSetupResponse, type MfaStatusResponse, type MfaVerificationRequest, type MfaVerificationResponse, type MfaVerifyRequest, type MfaVerifyResponse, type OAuthCredentials, type OAuthIdentityExport, type OAuthProvider, type Organization, type OrganizationMember, type OrganizationResponse, type OrganizationStatus, type OrganizationStatusBreakdown, type OrganizationTier, OrganizationsModule, type PaginatedResponse, type PaginationInfo, type PaginationParams, type Passkey, type PasskeyAuthFinishRequest, type PasskeyAuthFinishResponse, type PasskeyAuthStartRequest, type PasskeyAuthStartResponse, type PasskeyExport, type PasskeyRegisterFinishRequest, type PasskeyRegisterFinishResponse, type PasskeyRegisterStartRequest, type PasskeyRegisterStartResponse, PasskeysModule, PermissionsModule, type Plan, type PlanResponse, type PlatformAnalyticsDateRangeParams, PlatformModule, type PlatformOrganizationResponse, type PlatformOrganizationsListResponse, type PlatformOverviewMetrics, type PromotePlatformOwnerPayload, type ProviderToken, type ProviderTokenGrant, type RecentLogin, type RecentOrganization, type RefreshTokenRequest, type RefreshTokenResponse, type RegisterRequest, type RegisterResponse, type RegistrationResponseJSON, type RejectOrganizationPayload, type ResendVerificationRequest, type ResendVerificationResponse, type ResetPasswordRequest, type ResetPasswordResponse, type RevokeDeviceRequest, type RevokeDeviceResponse, type RevokeSessionsResponse, RiskAction, type RiskAnalytics, type RiskAssessment, type RiskContext, type RiskEnforcementMode, type RiskEngineConfig, type RiskEvent, RiskEventOutcome, type RiskFactor, RiskFactorType, type RiskRule, type RiskRuleCondition, type RiskScore, type RiskSettings, type SamlCertificate, type SamlConfig, type ScimTokenResponse, type Service, ServiceApiModule, type ServiceListResponse, type ServiceResponse, type ServiceType, type ServiceWithDetails, ServicesModule, type SetCustomDomainRequest, type SetOAuthCredentialsPayload, type SetPasswordRequest, type SetPasswordResponse, type SetSmtpRequest, type SiemConfigResponse, type SiemProviderType, type SmtpConfigResponse, SsoApiError, SsoClient, type SsoClientOptions, type StartLinkResponse, type Subscription, type TestConnectionResponse, type TokenRequest, type TokenResponse, type TokenStorage, type TopOrganization, type TransferOwnershipPayload, type UpdateBrandingRequest, type UpdateMemberRolePayload, type UpdateOrganizationPayload, type UpdateOrganizationTierPayload, type UpdatePlanPayload, type UpdateRiskSettingsRequest, type UpdateRiskSettingsResponse, type UpdateServicePayload, type UpdateSiemConfigRequest, type UpdateUserProfilePayload, type UpdateWebhookRequest, type User, type UserDevice, UserModule, type UserProfile, type Webhook, type WebhookDelivery, type WebhookDeliveryListResponse, type WebhookDeliveryQueryParams, type WebhookListResponse, type WebhookResponse };
|
package/dist/index.d.ts
CHANGED
|
@@ -23,6 +23,31 @@ declare class BrowserStorage implements TokenStorage {
|
|
|
23
23
|
setItem(key: string, value: string): void;
|
|
24
24
|
removeItem(key: string): void;
|
|
25
25
|
}
|
|
26
|
+
/**
|
|
27
|
+
* Browser Cookie adapter for SSR frameworks (Next.js, Nuxt, etc.)
|
|
28
|
+
*
|
|
29
|
+
* Uses document.cookie for client-side access. Works with server-side
|
|
30
|
+
* middleware that can read the same cookies.
|
|
31
|
+
*
|
|
32
|
+
* For Next.js App Router, pair this with cookies() from 'next/headers'
|
|
33
|
+
* in server components to pass the initial token.
|
|
34
|
+
*/
|
|
35
|
+
declare class CookieStorage implements TokenStorage {
|
|
36
|
+
private options;
|
|
37
|
+
constructor(options?: {
|
|
38
|
+
domain?: string;
|
|
39
|
+
path?: string;
|
|
40
|
+
secure?: boolean;
|
|
41
|
+
sameSite?: 'strict' | 'lax' | 'none';
|
|
42
|
+
maxAge?: number;
|
|
43
|
+
});
|
|
44
|
+
private getCookie;
|
|
45
|
+
private setCookie;
|
|
46
|
+
private deleteCookie;
|
|
47
|
+
getItem(key: string): string | null;
|
|
48
|
+
setItem(key: string, value: string): void;
|
|
49
|
+
removeItem(key: string): void;
|
|
50
|
+
}
|
|
26
51
|
|
|
27
52
|
/**
|
|
28
53
|
* Common types used across the SDK
|
|
@@ -596,6 +621,18 @@ interface ResetPasswordRequest {
|
|
|
596
621
|
interface ResetPasswordResponse {
|
|
597
622
|
message: string;
|
|
598
623
|
}
|
|
624
|
+
/**
|
|
625
|
+
* Resend verification request payload
|
|
626
|
+
*/
|
|
627
|
+
interface ResendVerificationRequest {
|
|
628
|
+
email: string;
|
|
629
|
+
}
|
|
630
|
+
/**
|
|
631
|
+
* Resend verification response
|
|
632
|
+
*/
|
|
633
|
+
interface ResendVerificationResponse {
|
|
634
|
+
message: string;
|
|
635
|
+
}
|
|
599
636
|
/**
|
|
600
637
|
* MFA verification request payload
|
|
601
638
|
*/
|
|
@@ -2440,6 +2477,22 @@ declare class AuthModule {
|
|
|
2440
2477
|
* ```
|
|
2441
2478
|
*/
|
|
2442
2479
|
verifyEmail(token: string): Promise<string>;
|
|
2480
|
+
/**
|
|
2481
|
+
* Resend verification email to a user.
|
|
2482
|
+
* Returns success regardless of whether the email exists (to prevent email enumeration).
|
|
2483
|
+
*
|
|
2484
|
+
* @param payload Resend verification request (email address)
|
|
2485
|
+
* @returns Confirmation message
|
|
2486
|
+
*
|
|
2487
|
+
* @example
|
|
2488
|
+
* ```typescript
|
|
2489
|
+
* const response = await sso.auth.resendVerification({
|
|
2490
|
+
* email: 'user@example.com'
|
|
2491
|
+
* });
|
|
2492
|
+
* console.log(response.message);
|
|
2493
|
+
* ```
|
|
2494
|
+
*/
|
|
2495
|
+
resendVerification(payload: ResendVerificationRequest): Promise<ResendVerificationResponse>;
|
|
2443
2496
|
/**
|
|
2444
2497
|
* Login with email and password.
|
|
2445
2498
|
* Automatically persists the session and configures the client.
|
|
@@ -5716,4 +5769,4 @@ declare class SsoApiError extends Error {
|
|
|
5716
5769
|
isNotFound(): boolean;
|
|
5717
5770
|
}
|
|
5718
5771
|
|
|
5719
|
-
export { type AcceptInvitationPayload, type AdminLoginUrlParams, type AnalyticsQuery, type ApiKey, type ApiKeyCreateResponse, type ApproveOrganizationPayload, type AuditLog, type AuditLogEntry, type AuditLogQueryParams, type AuditLogResponse, AuthErrorCodes, AuthMethod, AuthModule, type AuthSnapshot, type AuthenticationResponseJSON, type BackupCodesResponse, type BrandingConfiguration, BrowserStorage, type ChangePasswordRequest, type ChangePasswordResponse, type ConfigureSamlPayload, type ConfigureSamlResponse, type CreateApiKeyPayload, type CreateCheckoutPayload, type CreateCheckoutResponse, type CreateInvitationPayload, type CreateOrganizationPayload, type CreateOrganizationResponse, type CreatePlanPayload, type CreateScimTokenRequest, type CreateServicePayload, type CreateServiceResponse, type CreateSiemConfigRequest, type CreateWebhookRequest, type DeclineInvitationPayload, type DeviceCodeRequest, type DeviceCodeResponse, type DeviceTrust, type DeviceVerifyResponse, type DomainConfiguration, type DomainVerificationMethod, type DomainVerificationResponse, type DomainVerificationResult, type EndUser, type EndUserDetailResponse, type EndUserIdentity, type EndUserListResponse, type EndUserSubscription, type EventTypeInfo, type ExportUserDataResponse, type ForgetUserResponse, type ForgotPasswordRequest, type ForgotPasswordResponse, type GeolocationData, type GetAuditLogParams, type GetRiskSettingsResponse, type GrowthTrendPoint, type Identity, type ImpersonateRequest, type ImpersonateResponse, type ImpersonationUserInfo, type Invitation, type InvitationStatus, type InvitationWithOrg, InvitationsModule, type JwtClaims, type ListApiKeysResponse, type ListDevicesResponse, type ListEndUsersParams, type ListOrganizationsParams, type ListPlatformOrganizationsParams, type ListScimTokensResponse, type ListSiemConfigsResponse, type LoginActivityPoint, type LoginEventExport, type LoginRequest, type LoginTrendPoint, type LoginUrlParams, type LoginsByProvider, type LoginsByService, type LookupEmailRequest, type LookupEmailResponse, MagicLinks, type MemberListResponse, type MemberRole, type Membership, type MembershipExport, MemoryStorage, type MfaEventExport, type MfaSetupResponse, type MfaStatusResponse, type MfaVerificationRequest, type MfaVerificationResponse, type MfaVerifyRequest, type MfaVerifyResponse, type OAuthCredentials, type OAuthIdentityExport, type OAuthProvider, type Organization, type OrganizationMember, type OrganizationResponse, type OrganizationStatus, type OrganizationStatusBreakdown, type OrganizationTier, OrganizationsModule, type PaginatedResponse, type PaginationInfo, type PaginationParams, type Passkey, type PasskeyAuthFinishRequest, type PasskeyAuthFinishResponse, type PasskeyAuthStartRequest, type PasskeyAuthStartResponse, type PasskeyExport, type PasskeyRegisterFinishRequest, type PasskeyRegisterFinishResponse, type PasskeyRegisterStartRequest, type PasskeyRegisterStartResponse, PasskeysModule, PermissionsModule, type Plan, type PlanResponse, type PlatformAnalyticsDateRangeParams, PlatformModule, type PlatformOrganizationResponse, type PlatformOrganizationsListResponse, type PlatformOverviewMetrics, type PromotePlatformOwnerPayload, type ProviderToken, type ProviderTokenGrant, type RecentLogin, type RecentOrganization, type RefreshTokenRequest, type RefreshTokenResponse, type RegisterRequest, type RegisterResponse, type RegistrationResponseJSON, type RejectOrganizationPayload, type ResetPasswordRequest, type ResetPasswordResponse, type RevokeDeviceRequest, type RevokeDeviceResponse, type RevokeSessionsResponse, RiskAction, type RiskAnalytics, type RiskAssessment, type RiskContext, type RiskEnforcementMode, type RiskEngineConfig, type RiskEvent, RiskEventOutcome, type RiskFactor, RiskFactorType, type RiskRule, type RiskRuleCondition, type RiskScore, type RiskSettings, type SamlCertificate, type SamlConfig, type ScimTokenResponse, type Service, ServiceApiModule, type ServiceListResponse, type ServiceResponse, type ServiceType, type ServiceWithDetails, ServicesModule, type SetCustomDomainRequest, type SetOAuthCredentialsPayload, type SetPasswordRequest, type SetPasswordResponse, type SetSmtpRequest, type SiemConfigResponse, type SiemProviderType, type SmtpConfigResponse, SsoApiError, SsoClient, type SsoClientOptions, type StartLinkResponse, type Subscription, type TestConnectionResponse, type TokenRequest, type TokenResponse, type TokenStorage, type TopOrganization, type TransferOwnershipPayload, type UpdateBrandingRequest, type UpdateMemberRolePayload, type UpdateOrganizationPayload, type UpdateOrganizationTierPayload, type UpdatePlanPayload, type UpdateRiskSettingsRequest, type UpdateRiskSettingsResponse, type UpdateServicePayload, type UpdateSiemConfigRequest, type UpdateUserProfilePayload, type UpdateWebhookRequest, type User, type UserDevice, UserModule, type UserProfile, type Webhook, type WebhookDelivery, type WebhookDeliveryListResponse, type WebhookDeliveryQueryParams, type WebhookListResponse, type WebhookResponse };
|
|
5772
|
+
export { type AcceptInvitationPayload, type AdminLoginUrlParams, type AnalyticsQuery, type ApiKey, type ApiKeyCreateResponse, type ApproveOrganizationPayload, type AuditLog, type AuditLogEntry, type AuditLogQueryParams, type AuditLogResponse, AuthErrorCodes, AuthMethod, AuthModule, type AuthSnapshot, type AuthenticationResponseJSON, type BackupCodesResponse, type BrandingConfiguration, BrowserStorage, type ChangePasswordRequest, type ChangePasswordResponse, type ConfigureSamlPayload, type ConfigureSamlResponse, CookieStorage, type CreateApiKeyPayload, type CreateCheckoutPayload, type CreateCheckoutResponse, type CreateInvitationPayload, type CreateOrganizationPayload, type CreateOrganizationResponse, type CreatePlanPayload, type CreateScimTokenRequest, type CreateServicePayload, type CreateServiceResponse, type CreateSiemConfigRequest, type CreateWebhookRequest, type DeclineInvitationPayload, type DeviceCodeRequest, type DeviceCodeResponse, type DeviceTrust, type DeviceVerifyResponse, type DomainConfiguration, type DomainVerificationMethod, type DomainVerificationResponse, type DomainVerificationResult, type EndUser, type EndUserDetailResponse, type EndUserIdentity, type EndUserListResponse, type EndUserSubscription, type EventTypeInfo, type ExportUserDataResponse, type ForgetUserResponse, type ForgotPasswordRequest, type ForgotPasswordResponse, type GeolocationData, type GetAuditLogParams, type GetRiskSettingsResponse, type GrowthTrendPoint, type Identity, type ImpersonateRequest, type ImpersonateResponse, type ImpersonationUserInfo, type Invitation, type InvitationStatus, type InvitationWithOrg, InvitationsModule, type JwtClaims, type ListApiKeysResponse, type ListDevicesResponse, type ListEndUsersParams, type ListOrganizationsParams, type ListPlatformOrganizationsParams, type ListScimTokensResponse, type ListSiemConfigsResponse, type LoginActivityPoint, type LoginEventExport, type LoginRequest, type LoginTrendPoint, type LoginUrlParams, type LoginsByProvider, type LoginsByService, type LookupEmailRequest, type LookupEmailResponse, MagicLinks, type MemberListResponse, type MemberRole, type Membership, type MembershipExport, MemoryStorage, type MfaEventExport, type MfaSetupResponse, type MfaStatusResponse, type MfaVerificationRequest, type MfaVerificationResponse, type MfaVerifyRequest, type MfaVerifyResponse, type OAuthCredentials, type OAuthIdentityExport, type OAuthProvider, type Organization, type OrganizationMember, type OrganizationResponse, type OrganizationStatus, type OrganizationStatusBreakdown, type OrganizationTier, OrganizationsModule, type PaginatedResponse, type PaginationInfo, type PaginationParams, type Passkey, type PasskeyAuthFinishRequest, type PasskeyAuthFinishResponse, type PasskeyAuthStartRequest, type PasskeyAuthStartResponse, type PasskeyExport, type PasskeyRegisterFinishRequest, type PasskeyRegisterFinishResponse, type PasskeyRegisterStartRequest, type PasskeyRegisterStartResponse, PasskeysModule, PermissionsModule, type Plan, type PlanResponse, type PlatformAnalyticsDateRangeParams, PlatformModule, type PlatformOrganizationResponse, type PlatformOrganizationsListResponse, type PlatformOverviewMetrics, type PromotePlatformOwnerPayload, type ProviderToken, type ProviderTokenGrant, type RecentLogin, type RecentOrganization, type RefreshTokenRequest, type RefreshTokenResponse, type RegisterRequest, type RegisterResponse, type RegistrationResponseJSON, type RejectOrganizationPayload, type ResendVerificationRequest, type ResendVerificationResponse, type ResetPasswordRequest, type ResetPasswordResponse, type RevokeDeviceRequest, type RevokeDeviceResponse, type RevokeSessionsResponse, RiskAction, type RiskAnalytics, type RiskAssessment, type RiskContext, type RiskEnforcementMode, type RiskEngineConfig, type RiskEvent, RiskEventOutcome, type RiskFactor, RiskFactorType, type RiskRule, type RiskRuleCondition, type RiskScore, type RiskSettings, type SamlCertificate, type SamlConfig, type ScimTokenResponse, type Service, ServiceApiModule, type ServiceListResponse, type ServiceResponse, type ServiceType, type ServiceWithDetails, ServicesModule, type SetCustomDomainRequest, type SetOAuthCredentialsPayload, type SetPasswordRequest, type SetPasswordResponse, type SetSmtpRequest, type SiemConfigResponse, type SiemProviderType, type SmtpConfigResponse, SsoApiError, SsoClient, type SsoClientOptions, type StartLinkResponse, type Subscription, type TestConnectionResponse, type TokenRequest, type TokenResponse, type TokenStorage, type TopOrganization, type TransferOwnershipPayload, type UpdateBrandingRequest, type UpdateMemberRolePayload, type UpdateOrganizationPayload, type UpdateOrganizationTierPayload, type UpdatePlanPayload, type UpdateRiskSettingsRequest, type UpdateRiskSettingsResponse, type UpdateServicePayload, type UpdateSiemConfigRequest, type UpdateUserProfilePayload, type UpdateWebhookRequest, type User, type UserDevice, UserModule, type UserProfile, type Webhook, type WebhookDelivery, type WebhookDeliveryListResponse, type WebhookDeliveryQueryParams, type WebhookListResponse, type WebhookResponse };
|
package/dist/index.js
CHANGED
|
@@ -24,6 +24,7 @@ __export(index_exports, {
|
|
|
24
24
|
AuthMethod: () => AuthMethod,
|
|
25
25
|
AuthModule: () => AuthModule,
|
|
26
26
|
BrowserStorage: () => BrowserStorage,
|
|
27
|
+
CookieStorage: () => CookieStorage,
|
|
27
28
|
InvitationsModule: () => InvitationsModule,
|
|
28
29
|
MagicLinks: () => MagicLinks,
|
|
29
30
|
MemoryStorage: () => MemoryStorage,
|
|
@@ -409,6 +410,60 @@ var BrowserStorage = class {
|
|
|
409
410
|
if (typeof window !== "undefined") window.localStorage.removeItem(key);
|
|
410
411
|
}
|
|
411
412
|
};
|
|
413
|
+
var CookieStorage = class {
|
|
414
|
+
constructor(options = {}) {
|
|
415
|
+
this.options = options;
|
|
416
|
+
}
|
|
417
|
+
getCookie(name) {
|
|
418
|
+
if (typeof window === "undefined") return null;
|
|
419
|
+
const value = `; ${document.cookie}`;
|
|
420
|
+
const parts = value.split(`; ${name}=`);
|
|
421
|
+
if (parts.length === 2) {
|
|
422
|
+
return parts.pop()?.split(";").shift() || null;
|
|
423
|
+
}
|
|
424
|
+
return null;
|
|
425
|
+
}
|
|
426
|
+
setCookie(name, value) {
|
|
427
|
+
if (typeof window === "undefined") return;
|
|
428
|
+
let cookie = `${name}=${value}`;
|
|
429
|
+
if (this.options.path) {
|
|
430
|
+
cookie += `; Path=${this.options.path}`;
|
|
431
|
+
}
|
|
432
|
+
if (this.options.domain) {
|
|
433
|
+
cookie += `; Domain=${this.options.domain}`;
|
|
434
|
+
}
|
|
435
|
+
if (this.options.secure !== false) {
|
|
436
|
+
cookie += "; Secure";
|
|
437
|
+
}
|
|
438
|
+
if (this.options.sameSite ?? "lax") {
|
|
439
|
+
cookie += `; SameSite=${this.options.sameSite ?? "lax"}`;
|
|
440
|
+
}
|
|
441
|
+
if (this.options.maxAge) {
|
|
442
|
+
cookie += `; Max-Age=${this.options.maxAge}`;
|
|
443
|
+
}
|
|
444
|
+
document.cookie = cookie;
|
|
445
|
+
}
|
|
446
|
+
deleteCookie(name) {
|
|
447
|
+
if (typeof window === "undefined") return;
|
|
448
|
+
let cookie = `${name}=; Expires=Thu, 01 Jan 1970 00:00:00 GMT`;
|
|
449
|
+
if (this.options.path) {
|
|
450
|
+
cookie += `; Path=${this.options.path}`;
|
|
451
|
+
}
|
|
452
|
+
if (this.options.domain) {
|
|
453
|
+
cookie += `; Domain=${this.options.domain}`;
|
|
454
|
+
}
|
|
455
|
+
document.cookie = cookie;
|
|
456
|
+
}
|
|
457
|
+
getItem(key) {
|
|
458
|
+
return this.getCookie(key);
|
|
459
|
+
}
|
|
460
|
+
setItem(key, value) {
|
|
461
|
+
this.setCookie(key, value);
|
|
462
|
+
}
|
|
463
|
+
removeItem(key) {
|
|
464
|
+
this.deleteCookie(key);
|
|
465
|
+
}
|
|
466
|
+
};
|
|
412
467
|
function resolveStorage(userStorage) {
|
|
413
468
|
if (userStorage) return userStorage;
|
|
414
469
|
if (typeof window !== "undefined" && window.localStorage) return new BrowserStorage();
|
|
@@ -784,6 +839,25 @@ var AuthModule = class {
|
|
|
784
839
|
});
|
|
785
840
|
return response.data;
|
|
786
841
|
}
|
|
842
|
+
/**
|
|
843
|
+
* Resend verification email to a user.
|
|
844
|
+
* Returns success regardless of whether the email exists (to prevent email enumeration).
|
|
845
|
+
*
|
|
846
|
+
* @param payload Resend verification request (email address)
|
|
847
|
+
* @returns Confirmation message
|
|
848
|
+
*
|
|
849
|
+
* @example
|
|
850
|
+
* ```typescript
|
|
851
|
+
* const response = await sso.auth.resendVerification({
|
|
852
|
+
* email: 'user@example.com'
|
|
853
|
+
* });
|
|
854
|
+
* console.log(response.message);
|
|
855
|
+
* ```
|
|
856
|
+
*/
|
|
857
|
+
async resendVerification(payload) {
|
|
858
|
+
const response = await this.http.post("/api/auth/resend-verification", payload);
|
|
859
|
+
return response.data;
|
|
860
|
+
}
|
|
787
861
|
/**
|
|
788
862
|
* Login with email and password.
|
|
789
863
|
* Automatically persists the session and configures the client.
|
|
@@ -4617,6 +4691,7 @@ var RiskEventOutcome = /* @__PURE__ */ ((RiskEventOutcome2) => {
|
|
|
4617
4691
|
AuthMethod,
|
|
4618
4692
|
AuthModule,
|
|
4619
4693
|
BrowserStorage,
|
|
4694
|
+
CookieStorage,
|
|
4620
4695
|
InvitationsModule,
|
|
4621
4696
|
MagicLinks,
|
|
4622
4697
|
MemoryStorage,
|
package/dist/index.mjs
CHANGED
|
@@ -365,6 +365,60 @@ var BrowserStorage = class {
|
|
|
365
365
|
if (typeof window !== "undefined") window.localStorage.removeItem(key);
|
|
366
366
|
}
|
|
367
367
|
};
|
|
368
|
+
var CookieStorage = class {
|
|
369
|
+
constructor(options = {}) {
|
|
370
|
+
this.options = options;
|
|
371
|
+
}
|
|
372
|
+
getCookie(name) {
|
|
373
|
+
if (typeof window === "undefined") return null;
|
|
374
|
+
const value = `; ${document.cookie}`;
|
|
375
|
+
const parts = value.split(`; ${name}=`);
|
|
376
|
+
if (parts.length === 2) {
|
|
377
|
+
return parts.pop()?.split(";").shift() || null;
|
|
378
|
+
}
|
|
379
|
+
return null;
|
|
380
|
+
}
|
|
381
|
+
setCookie(name, value) {
|
|
382
|
+
if (typeof window === "undefined") return;
|
|
383
|
+
let cookie = `${name}=${value}`;
|
|
384
|
+
if (this.options.path) {
|
|
385
|
+
cookie += `; Path=${this.options.path}`;
|
|
386
|
+
}
|
|
387
|
+
if (this.options.domain) {
|
|
388
|
+
cookie += `; Domain=${this.options.domain}`;
|
|
389
|
+
}
|
|
390
|
+
if (this.options.secure !== false) {
|
|
391
|
+
cookie += "; Secure";
|
|
392
|
+
}
|
|
393
|
+
if (this.options.sameSite ?? "lax") {
|
|
394
|
+
cookie += `; SameSite=${this.options.sameSite ?? "lax"}`;
|
|
395
|
+
}
|
|
396
|
+
if (this.options.maxAge) {
|
|
397
|
+
cookie += `; Max-Age=${this.options.maxAge}`;
|
|
398
|
+
}
|
|
399
|
+
document.cookie = cookie;
|
|
400
|
+
}
|
|
401
|
+
deleteCookie(name) {
|
|
402
|
+
if (typeof window === "undefined") return;
|
|
403
|
+
let cookie = `${name}=; Expires=Thu, 01 Jan 1970 00:00:00 GMT`;
|
|
404
|
+
if (this.options.path) {
|
|
405
|
+
cookie += `; Path=${this.options.path}`;
|
|
406
|
+
}
|
|
407
|
+
if (this.options.domain) {
|
|
408
|
+
cookie += `; Domain=${this.options.domain}`;
|
|
409
|
+
}
|
|
410
|
+
document.cookie = cookie;
|
|
411
|
+
}
|
|
412
|
+
getItem(key) {
|
|
413
|
+
return this.getCookie(key);
|
|
414
|
+
}
|
|
415
|
+
setItem(key, value) {
|
|
416
|
+
this.setCookie(key, value);
|
|
417
|
+
}
|
|
418
|
+
removeItem(key) {
|
|
419
|
+
this.deleteCookie(key);
|
|
420
|
+
}
|
|
421
|
+
};
|
|
368
422
|
function resolveStorage(userStorage) {
|
|
369
423
|
if (userStorage) return userStorage;
|
|
370
424
|
if (typeof window !== "undefined" && window.localStorage) return new BrowserStorage();
|
|
@@ -740,6 +794,25 @@ var AuthModule = class {
|
|
|
740
794
|
});
|
|
741
795
|
return response.data;
|
|
742
796
|
}
|
|
797
|
+
/**
|
|
798
|
+
* Resend verification email to a user.
|
|
799
|
+
* Returns success regardless of whether the email exists (to prevent email enumeration).
|
|
800
|
+
*
|
|
801
|
+
* @param payload Resend verification request (email address)
|
|
802
|
+
* @returns Confirmation message
|
|
803
|
+
*
|
|
804
|
+
* @example
|
|
805
|
+
* ```typescript
|
|
806
|
+
* const response = await sso.auth.resendVerification({
|
|
807
|
+
* email: 'user@example.com'
|
|
808
|
+
* });
|
|
809
|
+
* console.log(response.message);
|
|
810
|
+
* ```
|
|
811
|
+
*/
|
|
812
|
+
async resendVerification(payload) {
|
|
813
|
+
const response = await this.http.post("/api/auth/resend-verification", payload);
|
|
814
|
+
return response.data;
|
|
815
|
+
}
|
|
743
816
|
/**
|
|
744
817
|
* Login with email and password.
|
|
745
818
|
* Automatically persists the session and configures the client.
|
|
@@ -4572,6 +4645,7 @@ export {
|
|
|
4572
4645
|
AuthMethod,
|
|
4573
4646
|
AuthModule,
|
|
4574
4647
|
BrowserStorage,
|
|
4648
|
+
CookieStorage,
|
|
4575
4649
|
InvitationsModule,
|
|
4576
4650
|
MagicLinks,
|
|
4577
4651
|
MemoryStorage,
|