@drmhse/sso-sdk 0.3.8 → 0.3.9

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.d.mts CHANGED
@@ -162,306 +162,35 @@ interface JwtClaims {
162
162
  iat: number;
163
163
  }
164
164
 
165
- /**
166
- * Risk assessment and engine types
167
- */
168
- /**
169
- * Risk score levels
170
- */
171
- type RiskScore = number;
172
- /**
173
- * Risk assessment results from the risk engine
174
- */
175
- interface RiskAssessment {
176
- /** Overall risk score (0-100, higher is more risky) */
177
- score: RiskScore;
178
- /** Action to take based on risk assessment */
179
- action: RiskAction;
180
- /** Specific risk factors that contributed to the score */
181
- factors: RiskFactor[];
182
- /** Geolocation data if available */
183
- location?: GeolocationData;
184
- /** When the assessment was performed */
185
- assessedAt: string;
186
- /** Additional metadata about the assessment */
187
- metadata?: Record<string, unknown>;
188
- }
189
- /**
190
- * Risk actions the engine can recommend
191
- */
192
- declare enum RiskAction {
193
- /** Allow the authentication to proceed */
194
- ALLOW = "allow",
195
- /** Log only - allow but monitor */
196
- LOG_ONLY = "log_only",
197
- /** Require additional verification (MFA) */
198
- CHALLENGE_MFA = "challenge_mfa",
199
- /** Block the authentication attempt */
200
- BLOCK = "block"
201
- }
202
- /**
203
- * Individual risk factors that contribute to overall risk score
204
- */
205
- interface RiskFactor {
206
- /** Type of risk factor */
207
- type: RiskFactorType;
208
- /** How much this factor contributes to the score */
209
- weight: number;
210
- /** Human-readable description */
211
- description: string;
212
- /** Additional data about this factor */
213
- data?: Record<string, unknown>;
214
- }
215
- /**
216
- * Types of risk factors the engine can detect
217
- */
218
- declare enum RiskFactorType {
219
- /** Unknown IP address or never seen before */
220
- NEW_IP = "new_ip",
221
- /** IP from high-risk country or region */
222
- HIGH_RISK_LOCATION = "high_risk_location",
223
- /** Impossible travel - login from geographically impossible locations */
224
- IMPOSSIBLE_TRAVEL = "impossible_travel",
225
- /** New device or browser fingerprint */
226
- NEW_DEVICE = "new_device",
227
- /** Multiple failed login attempts */
228
- FAILED_ATTEMPTS = "failed_attempts",
229
- /** Login from unusual time of day */
230
- UNUSUAL_TIME = "unusual_time",
231
- /** Suspicious user agent or bot patterns */
232
- SUSPICIOUS_USER_AGENT = "suspicious_user_agent",
233
- /** Tor exit node or VPN detected */
234
- ANONYMOUS_NETWORK = "anonymous_network",
235
- /** Account is new (recently created) */
236
- NEW_ACCOUNT = "new_account",
237
- /** Account has suspicious activity history */
238
- SUSPICIOUS_HISTORY = "suspicious_history",
239
- /** Velocity-based detection (too many actions) */
240
- HIGH_VELOCITY = "high_velocity",
241
- /** Custom rule triggered */
242
- CUSTOM_RULE = "custom_rule"
243
- }
244
- /**
245
- * Geolocation data for risk assessment
246
- */
247
- interface GeolocationData {
248
- /** Two-letter ISO country code */
165
+ interface GeoLocation {
249
166
  country: string;
250
- /** City name if available */
251
167
  city?: string;
252
- /** Region/state if available */
253
- region?: string;
254
- /** Latitude coordinate */
255
- latitude?: number;
256
- /** Longitude coordinate */
257
- longitude?: number;
258
- /** ISP or organization name */
259
- isp?: string;
260
- /** Whether this is a known VPN/proxy */
261
- isVpn?: boolean;
262
- /** Whether this is a Tor exit node */
263
- isTor?: boolean;
264
- }
265
- /**
266
- * Context provided to risk engine for assessment
267
- */
268
- interface RiskContext {
269
- /** User ID being authenticated */
270
- userId: string;
271
- /** Organization ID if applicable */
272
- orgId?: string;
273
- /** IP address of the request */
274
- ipAddress: string;
275
- /** User agent string */
276
- userAgent: string;
277
- /** Device fingerprint or cookie if available */
278
- deviceCookie?: string;
279
- /** Authentication method being used */
280
- authMethod: AuthMethod;
281
- /** Additional context data */
282
- metadata?: Record<string, unknown>;
283
- }
284
- /**
285
- * Authentication methods for risk assessment
286
- */
287
- declare enum AuthMethod {
288
- /** Email and password */
289
- PASSWORD = "password",
290
- /** OAuth provider (Google, GitHub, etc.) */
291
- OAUTH = "oauth",
292
- /** WebAuthn passkeys */
293
- PASSKEY = "passkey",
294
- /** Magic link email */
295
- MAGIC_LINK = "magic_link",
296
- /** Multi-factor authentication */
297
- MFA = "mfa",
298
- /** SAML SSO */
299
- SAML = "saml"
300
- }
301
- /**
302
- * Risk engine configuration for organizations
303
- */
304
- interface RiskEngineConfig {
305
- /** Enable/disable risk engine */
306
- enabled: boolean;
307
- /** Risk score threshold for blocking */
308
- blockThreshold: RiskScore;
309
- /** Risk score threshold for requiring MFA */
310
- mfaThreshold: RiskScore;
311
- /** Which risk factors to consider */
312
- enabledFactors: RiskFactorType[];
313
- /** Custom rules and weights */
314
- customRules?: RiskRule[];
315
- /** How long to remember trusted devices */
316
- deviceTrustDuration: number;
317
- /** Whether to enable location-based risk assessment */
318
- enableLocationTracking: boolean;
319
- /** Max failed attempts before increased risk */
320
- maxFailedAttempts: number;
321
- /** Time window for velocity checks */
322
- velocityWindow: number;
323
- }
324
- /**
325
- * Custom risk rule definition
326
- */
327
- interface RiskRule {
328
- /** Unique rule identifier */
329
- id: string;
330
- /** Rule name for display */
331
- name: string;
332
- /** Rule description */
333
- description: string;
334
- /** Condition to trigger the rule */
335
- condition: RiskRuleCondition;
336
- /** Action to take when rule triggers */
337
- action: RiskAction;
338
- /** How much weight this rule carries */
339
- weight: number;
340
- /** Whether the rule is enabled */
341
- enabled: boolean;
168
+ latitude: number;
169
+ longitude: number;
342
170
  }
343
- /**
344
- * Risk rule condition
345
- */
346
- interface RiskRuleCondition {
347
- /** Field to check */
348
- field: string;
349
- /** Operator for comparison */
350
- operator: 'eq' | 'ne' | 'gt' | 'gte' | 'lt' | 'lte' | 'in' | 'contains' | 'regex';
351
- /** Value to compare against */
352
- value: unknown;
353
- /** Additional conditions (AND logic) */
354
- and?: RiskRuleCondition[];
355
- /** Alternative conditions (OR logic) */
356
- or?: RiskRuleCondition[];
357
- }
358
- /**
359
- * Device trust information
360
- */
361
- interface DeviceTrust {
362
- /** Device ID */
363
- deviceId: string;
364
- /** User ID this device belongs to */
365
- userId: string;
366
- /** Device name or description */
367
- deviceName: string;
368
- /** When the device was first seen */
369
- firstSeenAt: string;
370
- /** When the device was last used */
371
- lastSeenAt: string;
372
- /** When the device trust expires */
373
- expiresAt: string;
374
- /** IP address when device was registered */
375
- registrationIp?: string;
376
- /** Risk score for this device */
377
- riskScore: RiskScore;
378
- /** Whether this device is currently trusted */
379
- isTrusted: boolean;
171
+ type RiskAction = 'allow' | 'challenge_mfa' | 'block' | 'log_only';
172
+ interface RiskAssessment {
173
+ score: number;
174
+ factors: string[];
175
+ action: RiskAction;
176
+ location?: GeoLocation;
380
177
  }
381
- /**
382
- * Risk event for logging and monitoring
383
- */
384
- interface RiskEvent {
385
- /** Unique event ID */
178
+ interface RiskEventResponse {
386
179
  id: string;
387
- /** User ID involved */
388
- userId: string;
389
- /** Organization ID if applicable */
390
- orgId?: string;
391
- /** Risk assessment that triggered this event */
392
- assessment: RiskAssessment;
393
- /** Authentication context */
394
- context: RiskContext;
395
- /** When the event occurred */
396
- timestamp: string;
397
- /** Event outcome */
398
- outcome: RiskEventOutcome;
399
- /** Additional event metadata */
400
- metadata?: Record<string, unknown>;
401
- }
402
- /**
403
- * Risk event outcomes
404
- */
405
- declare enum RiskEventOutcome {
406
- /** Authentication was allowed */
407
- ALLOWED = "allowed",
408
- /** Authentication was blocked */
409
- BLOCKED = "blocked",
410
- /** Additional verification was required */
411
- CHALLENGED = "challenged",
412
- /** Event was logged but no action taken */
413
- LOGGED = "logged"
414
- }
415
- /**
416
- * Risk engine analytics and reporting
417
- */
418
- interface RiskAnalytics {
419
- /** Total risk assessments in time period */
420
- totalAssessments: number;
421
- /** Risk score distribution */
422
- scoreDistribution: {
423
- low: number;
424
- medium: number;
425
- high: number;
426
- critical: number;
427
- };
428
- /** Most common risk factors */
429
- topRiskFactors: Array<{
430
- factor: RiskFactorType;
431
- count: number;
432
- percentage: number;
433
- }>;
434
- /** Blocked authentication attempts */
435
- blockedAttempts: number;
436
- /** MFA challenges issued */
437
- mfaChallenges: number;
438
- /** Geographic risk data */
439
- locationRisk: Array<{
440
- country: string;
441
- riskCount: number;
442
- riskScore: number;
443
- }>;
444
- /** Time-based risk patterns */
445
- temporalPatterns: {
446
- hourly: number[];
447
- daily: number[];
448
- };
180
+ user_id: string;
181
+ user_email?: string;
182
+ created_at: string;
183
+ risk_score: number;
184
+ risk_factors: string[];
185
+ geo_country?: string;
186
+ geo_city?: string;
187
+ ip_address?: string;
188
+ provider: string;
449
189
  }
450
- /**
451
- * Risk enforcement modes
452
- */
453
- type RiskEnforcementMode = 'log_only' | 'monitor' | 'block' | 'challenge_mfa';
454
- /**
455
- * Organization risk settings
456
- */
457
- interface RiskSettings {
458
- enforcement_mode: RiskEnforcementMode;
459
- low_threshold: number;
460
- medium_threshold: number;
461
- new_device_score: number;
462
- impossible_travel_score: number;
463
- velocity_threshold: number;
464
- velocity_score: number;
190
+ interface RiskEventsQuery {
191
+ page?: number;
192
+ limit?: number;
193
+ min_score?: number;
465
194
  }
466
195
 
467
196
  /**
@@ -3834,6 +3563,19 @@ declare class OrganizationsModule {
3834
3563
  url: string;
3835
3564
  }>;
3836
3565
  };
3566
+ /**
3567
+ * Security & Risk insights
3568
+ */
3569
+ security: {
3570
+ /**
3571
+ * Get risk events for an organization.
3572
+ * Requires 'owner' or 'admin' role.
3573
+ *
3574
+ * @param orgSlug Organization slug
3575
+ * @param params Query parameters
3576
+ */
3577
+ getRiskEvents: (orgSlug: string, params?: RiskEventsQuery) => Promise<RiskEventResponse[]>;
3578
+ };
3837
3579
  /**
3838
3580
  * BYOP (Bring Your Own Payment) credential management.
3839
3581
  * Allows organizations to configure their own billing provider credentials
@@ -5799,4 +5541,4 @@ declare class SsoApiError extends Error {
5799
5541
  isNotFound(): boolean;
5800
5542
  }
5801
5543
 
5802
- 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 SelectOrganizationResponse, 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 };
5544
+ export { type AcceptInvitationPayload, type AdminLoginUrlParams, type AnalyticsQuery, type ApiKey, type ApiKeyCreateResponse, type ApproveOrganizationPayload, type AuditLog, type AuditLogEntry, type AuditLogQueryParams, type AuditLogResponse, AuthErrorCodes, 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 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 GeoLocation, 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, type RiskAction, type RiskAssessment, type RiskEventResponse, type RiskEventsQuery, type SamlCertificate, type SamlConfig, type ScimTokenResponse, type SelectOrganizationResponse, 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
@@ -162,306 +162,35 @@ interface JwtClaims {
162
162
  iat: number;
163
163
  }
164
164
 
165
- /**
166
- * Risk assessment and engine types
167
- */
168
- /**
169
- * Risk score levels
170
- */
171
- type RiskScore = number;
172
- /**
173
- * Risk assessment results from the risk engine
174
- */
175
- interface RiskAssessment {
176
- /** Overall risk score (0-100, higher is more risky) */
177
- score: RiskScore;
178
- /** Action to take based on risk assessment */
179
- action: RiskAction;
180
- /** Specific risk factors that contributed to the score */
181
- factors: RiskFactor[];
182
- /** Geolocation data if available */
183
- location?: GeolocationData;
184
- /** When the assessment was performed */
185
- assessedAt: string;
186
- /** Additional metadata about the assessment */
187
- metadata?: Record<string, unknown>;
188
- }
189
- /**
190
- * Risk actions the engine can recommend
191
- */
192
- declare enum RiskAction {
193
- /** Allow the authentication to proceed */
194
- ALLOW = "allow",
195
- /** Log only - allow but monitor */
196
- LOG_ONLY = "log_only",
197
- /** Require additional verification (MFA) */
198
- CHALLENGE_MFA = "challenge_mfa",
199
- /** Block the authentication attempt */
200
- BLOCK = "block"
201
- }
202
- /**
203
- * Individual risk factors that contribute to overall risk score
204
- */
205
- interface RiskFactor {
206
- /** Type of risk factor */
207
- type: RiskFactorType;
208
- /** How much this factor contributes to the score */
209
- weight: number;
210
- /** Human-readable description */
211
- description: string;
212
- /** Additional data about this factor */
213
- data?: Record<string, unknown>;
214
- }
215
- /**
216
- * Types of risk factors the engine can detect
217
- */
218
- declare enum RiskFactorType {
219
- /** Unknown IP address or never seen before */
220
- NEW_IP = "new_ip",
221
- /** IP from high-risk country or region */
222
- HIGH_RISK_LOCATION = "high_risk_location",
223
- /** Impossible travel - login from geographically impossible locations */
224
- IMPOSSIBLE_TRAVEL = "impossible_travel",
225
- /** New device or browser fingerprint */
226
- NEW_DEVICE = "new_device",
227
- /** Multiple failed login attempts */
228
- FAILED_ATTEMPTS = "failed_attempts",
229
- /** Login from unusual time of day */
230
- UNUSUAL_TIME = "unusual_time",
231
- /** Suspicious user agent or bot patterns */
232
- SUSPICIOUS_USER_AGENT = "suspicious_user_agent",
233
- /** Tor exit node or VPN detected */
234
- ANONYMOUS_NETWORK = "anonymous_network",
235
- /** Account is new (recently created) */
236
- NEW_ACCOUNT = "new_account",
237
- /** Account has suspicious activity history */
238
- SUSPICIOUS_HISTORY = "suspicious_history",
239
- /** Velocity-based detection (too many actions) */
240
- HIGH_VELOCITY = "high_velocity",
241
- /** Custom rule triggered */
242
- CUSTOM_RULE = "custom_rule"
243
- }
244
- /**
245
- * Geolocation data for risk assessment
246
- */
247
- interface GeolocationData {
248
- /** Two-letter ISO country code */
165
+ interface GeoLocation {
249
166
  country: string;
250
- /** City name if available */
251
167
  city?: string;
252
- /** Region/state if available */
253
- region?: string;
254
- /** Latitude coordinate */
255
- latitude?: number;
256
- /** Longitude coordinate */
257
- longitude?: number;
258
- /** ISP or organization name */
259
- isp?: string;
260
- /** Whether this is a known VPN/proxy */
261
- isVpn?: boolean;
262
- /** Whether this is a Tor exit node */
263
- isTor?: boolean;
264
- }
265
- /**
266
- * Context provided to risk engine for assessment
267
- */
268
- interface RiskContext {
269
- /** User ID being authenticated */
270
- userId: string;
271
- /** Organization ID if applicable */
272
- orgId?: string;
273
- /** IP address of the request */
274
- ipAddress: string;
275
- /** User agent string */
276
- userAgent: string;
277
- /** Device fingerprint or cookie if available */
278
- deviceCookie?: string;
279
- /** Authentication method being used */
280
- authMethod: AuthMethod;
281
- /** Additional context data */
282
- metadata?: Record<string, unknown>;
283
- }
284
- /**
285
- * Authentication methods for risk assessment
286
- */
287
- declare enum AuthMethod {
288
- /** Email and password */
289
- PASSWORD = "password",
290
- /** OAuth provider (Google, GitHub, etc.) */
291
- OAUTH = "oauth",
292
- /** WebAuthn passkeys */
293
- PASSKEY = "passkey",
294
- /** Magic link email */
295
- MAGIC_LINK = "magic_link",
296
- /** Multi-factor authentication */
297
- MFA = "mfa",
298
- /** SAML SSO */
299
- SAML = "saml"
300
- }
301
- /**
302
- * Risk engine configuration for organizations
303
- */
304
- interface RiskEngineConfig {
305
- /** Enable/disable risk engine */
306
- enabled: boolean;
307
- /** Risk score threshold for blocking */
308
- blockThreshold: RiskScore;
309
- /** Risk score threshold for requiring MFA */
310
- mfaThreshold: RiskScore;
311
- /** Which risk factors to consider */
312
- enabledFactors: RiskFactorType[];
313
- /** Custom rules and weights */
314
- customRules?: RiskRule[];
315
- /** How long to remember trusted devices */
316
- deviceTrustDuration: number;
317
- /** Whether to enable location-based risk assessment */
318
- enableLocationTracking: boolean;
319
- /** Max failed attempts before increased risk */
320
- maxFailedAttempts: number;
321
- /** Time window for velocity checks */
322
- velocityWindow: number;
323
- }
324
- /**
325
- * Custom risk rule definition
326
- */
327
- interface RiskRule {
328
- /** Unique rule identifier */
329
- id: string;
330
- /** Rule name for display */
331
- name: string;
332
- /** Rule description */
333
- description: string;
334
- /** Condition to trigger the rule */
335
- condition: RiskRuleCondition;
336
- /** Action to take when rule triggers */
337
- action: RiskAction;
338
- /** How much weight this rule carries */
339
- weight: number;
340
- /** Whether the rule is enabled */
341
- enabled: boolean;
168
+ latitude: number;
169
+ longitude: number;
342
170
  }
343
- /**
344
- * Risk rule condition
345
- */
346
- interface RiskRuleCondition {
347
- /** Field to check */
348
- field: string;
349
- /** Operator for comparison */
350
- operator: 'eq' | 'ne' | 'gt' | 'gte' | 'lt' | 'lte' | 'in' | 'contains' | 'regex';
351
- /** Value to compare against */
352
- value: unknown;
353
- /** Additional conditions (AND logic) */
354
- and?: RiskRuleCondition[];
355
- /** Alternative conditions (OR logic) */
356
- or?: RiskRuleCondition[];
357
- }
358
- /**
359
- * Device trust information
360
- */
361
- interface DeviceTrust {
362
- /** Device ID */
363
- deviceId: string;
364
- /** User ID this device belongs to */
365
- userId: string;
366
- /** Device name or description */
367
- deviceName: string;
368
- /** When the device was first seen */
369
- firstSeenAt: string;
370
- /** When the device was last used */
371
- lastSeenAt: string;
372
- /** When the device trust expires */
373
- expiresAt: string;
374
- /** IP address when device was registered */
375
- registrationIp?: string;
376
- /** Risk score for this device */
377
- riskScore: RiskScore;
378
- /** Whether this device is currently trusted */
379
- isTrusted: boolean;
171
+ type RiskAction = 'allow' | 'challenge_mfa' | 'block' | 'log_only';
172
+ interface RiskAssessment {
173
+ score: number;
174
+ factors: string[];
175
+ action: RiskAction;
176
+ location?: GeoLocation;
380
177
  }
381
- /**
382
- * Risk event for logging and monitoring
383
- */
384
- interface RiskEvent {
385
- /** Unique event ID */
178
+ interface RiskEventResponse {
386
179
  id: string;
387
- /** User ID involved */
388
- userId: string;
389
- /** Organization ID if applicable */
390
- orgId?: string;
391
- /** Risk assessment that triggered this event */
392
- assessment: RiskAssessment;
393
- /** Authentication context */
394
- context: RiskContext;
395
- /** When the event occurred */
396
- timestamp: string;
397
- /** Event outcome */
398
- outcome: RiskEventOutcome;
399
- /** Additional event metadata */
400
- metadata?: Record<string, unknown>;
401
- }
402
- /**
403
- * Risk event outcomes
404
- */
405
- declare enum RiskEventOutcome {
406
- /** Authentication was allowed */
407
- ALLOWED = "allowed",
408
- /** Authentication was blocked */
409
- BLOCKED = "blocked",
410
- /** Additional verification was required */
411
- CHALLENGED = "challenged",
412
- /** Event was logged but no action taken */
413
- LOGGED = "logged"
414
- }
415
- /**
416
- * Risk engine analytics and reporting
417
- */
418
- interface RiskAnalytics {
419
- /** Total risk assessments in time period */
420
- totalAssessments: number;
421
- /** Risk score distribution */
422
- scoreDistribution: {
423
- low: number;
424
- medium: number;
425
- high: number;
426
- critical: number;
427
- };
428
- /** Most common risk factors */
429
- topRiskFactors: Array<{
430
- factor: RiskFactorType;
431
- count: number;
432
- percentage: number;
433
- }>;
434
- /** Blocked authentication attempts */
435
- blockedAttempts: number;
436
- /** MFA challenges issued */
437
- mfaChallenges: number;
438
- /** Geographic risk data */
439
- locationRisk: Array<{
440
- country: string;
441
- riskCount: number;
442
- riskScore: number;
443
- }>;
444
- /** Time-based risk patterns */
445
- temporalPatterns: {
446
- hourly: number[];
447
- daily: number[];
448
- };
180
+ user_id: string;
181
+ user_email?: string;
182
+ created_at: string;
183
+ risk_score: number;
184
+ risk_factors: string[];
185
+ geo_country?: string;
186
+ geo_city?: string;
187
+ ip_address?: string;
188
+ provider: string;
449
189
  }
450
- /**
451
- * Risk enforcement modes
452
- */
453
- type RiskEnforcementMode = 'log_only' | 'monitor' | 'block' | 'challenge_mfa';
454
- /**
455
- * Organization risk settings
456
- */
457
- interface RiskSettings {
458
- enforcement_mode: RiskEnforcementMode;
459
- low_threshold: number;
460
- medium_threshold: number;
461
- new_device_score: number;
462
- impossible_travel_score: number;
463
- velocity_threshold: number;
464
- velocity_score: number;
190
+ interface RiskEventsQuery {
191
+ page?: number;
192
+ limit?: number;
193
+ min_score?: number;
465
194
  }
466
195
 
467
196
  /**
@@ -3834,6 +3563,19 @@ declare class OrganizationsModule {
3834
3563
  url: string;
3835
3564
  }>;
3836
3565
  };
3566
+ /**
3567
+ * Security & Risk insights
3568
+ */
3569
+ security: {
3570
+ /**
3571
+ * Get risk events for an organization.
3572
+ * Requires 'owner' or 'admin' role.
3573
+ *
3574
+ * @param orgSlug Organization slug
3575
+ * @param params Query parameters
3576
+ */
3577
+ getRiskEvents: (orgSlug: string, params?: RiskEventsQuery) => Promise<RiskEventResponse[]>;
3578
+ };
3837
3579
  /**
3838
3580
  * BYOP (Bring Your Own Payment) credential management.
3839
3581
  * Allows organizations to configure their own billing provider credentials
@@ -5799,4 +5541,4 @@ declare class SsoApiError extends Error {
5799
5541
  isNotFound(): boolean;
5800
5542
  }
5801
5543
 
5802
- 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 SelectOrganizationResponse, 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 };
5544
+ export { type AcceptInvitationPayload, type AdminLoginUrlParams, type AnalyticsQuery, type ApiKey, type ApiKeyCreateResponse, type ApproveOrganizationPayload, type AuditLog, type AuditLogEntry, type AuditLogQueryParams, type AuditLogResponse, AuthErrorCodes, 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 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 GeoLocation, 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, type RiskAction, type RiskAssessment, type RiskEventResponse, type RiskEventsQuery, type SamlCertificate, type SamlConfig, type ScimTokenResponse, type SelectOrganizationResponse, 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
@@ -21,7 +21,6 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
21
21
  var index_exports = {};
22
22
  __export(index_exports, {
23
23
  AuthErrorCodes: () => AuthErrorCodes,
24
- AuthMethod: () => AuthMethod,
25
24
  AuthModule: () => AuthModule,
26
25
  BrowserStorage: () => BrowserStorage,
27
26
  CookieStorage: () => CookieStorage,
@@ -32,9 +31,6 @@ __export(index_exports, {
32
31
  PasskeysModule: () => PasskeysModule,
33
32
  PermissionsModule: () => PermissionsModule,
34
33
  PlatformModule: () => PlatformModule,
35
- RiskAction: () => RiskAction,
36
- RiskEventOutcome: () => RiskEventOutcome,
37
- RiskFactorType: () => RiskFactorType,
38
34
  ServiceApiModule: () => ServiceApiModule,
39
35
  ServicesModule: () => ServicesModule,
40
36
  SsoApiError: () => SsoApiError,
@@ -2152,6 +2148,25 @@ var OrganizationsModule = class {
2152
2148
  return response.data;
2153
2149
  }
2154
2150
  };
2151
+ /**
2152
+ * Security & Risk insights
2153
+ */
2154
+ this.security = {
2155
+ /**
2156
+ * Get risk events for an organization.
2157
+ * Requires 'owner' or 'admin' role.
2158
+ *
2159
+ * @param orgSlug Organization slug
2160
+ * @param params Query parameters
2161
+ */
2162
+ getRiskEvents: async (orgSlug, params) => {
2163
+ const response = await this.http.get(
2164
+ `/api/organizations/${orgSlug}/risk-events`,
2165
+ { params }
2166
+ );
2167
+ return response.data;
2168
+ }
2169
+ };
2155
2170
  // ============================================================================
2156
2171
  // BYOP - BRING YOUR OWN PAYMENT
2157
2172
  // ============================================================================
@@ -4670,50 +4685,9 @@ var SsoClient = class {
4670
4685
  return this.session.getToken();
4671
4686
  }
4672
4687
  };
4673
-
4674
- // src/types/risk.ts
4675
- var RiskAction = /* @__PURE__ */ ((RiskAction2) => {
4676
- RiskAction2["ALLOW"] = "allow";
4677
- RiskAction2["LOG_ONLY"] = "log_only";
4678
- RiskAction2["CHALLENGE_MFA"] = "challenge_mfa";
4679
- RiskAction2["BLOCK"] = "block";
4680
- return RiskAction2;
4681
- })(RiskAction || {});
4682
- var RiskFactorType = /* @__PURE__ */ ((RiskFactorType2) => {
4683
- RiskFactorType2["NEW_IP"] = "new_ip";
4684
- RiskFactorType2["HIGH_RISK_LOCATION"] = "high_risk_location";
4685
- RiskFactorType2["IMPOSSIBLE_TRAVEL"] = "impossible_travel";
4686
- RiskFactorType2["NEW_DEVICE"] = "new_device";
4687
- RiskFactorType2["FAILED_ATTEMPTS"] = "failed_attempts";
4688
- RiskFactorType2["UNUSUAL_TIME"] = "unusual_time";
4689
- RiskFactorType2["SUSPICIOUS_USER_AGENT"] = "suspicious_user_agent";
4690
- RiskFactorType2["ANONYMOUS_NETWORK"] = "anonymous_network";
4691
- RiskFactorType2["NEW_ACCOUNT"] = "new_account";
4692
- RiskFactorType2["SUSPICIOUS_HISTORY"] = "suspicious_history";
4693
- RiskFactorType2["HIGH_VELOCITY"] = "high_velocity";
4694
- RiskFactorType2["CUSTOM_RULE"] = "custom_rule";
4695
- return RiskFactorType2;
4696
- })(RiskFactorType || {});
4697
- var AuthMethod = /* @__PURE__ */ ((AuthMethod2) => {
4698
- AuthMethod2["PASSWORD"] = "password";
4699
- AuthMethod2["OAUTH"] = "oauth";
4700
- AuthMethod2["PASSKEY"] = "passkey";
4701
- AuthMethod2["MAGIC_LINK"] = "magic_link";
4702
- AuthMethod2["MFA"] = "mfa";
4703
- AuthMethod2["SAML"] = "saml";
4704
- return AuthMethod2;
4705
- })(AuthMethod || {});
4706
- var RiskEventOutcome = /* @__PURE__ */ ((RiskEventOutcome2) => {
4707
- RiskEventOutcome2["ALLOWED"] = "allowed";
4708
- RiskEventOutcome2["BLOCKED"] = "blocked";
4709
- RiskEventOutcome2["CHALLENGED"] = "challenged";
4710
- RiskEventOutcome2["LOGGED"] = "logged";
4711
- return RiskEventOutcome2;
4712
- })(RiskEventOutcome || {});
4713
4688
  // Annotate the CommonJS export names for ESM import in node:
4714
4689
  0 && (module.exports = {
4715
4690
  AuthErrorCodes,
4716
- AuthMethod,
4717
4691
  AuthModule,
4718
4692
  BrowserStorage,
4719
4693
  CookieStorage,
@@ -4724,9 +4698,6 @@ var RiskEventOutcome = /* @__PURE__ */ ((RiskEventOutcome2) => {
4724
4698
  PasskeysModule,
4725
4699
  PermissionsModule,
4726
4700
  PlatformModule,
4727
- RiskAction,
4728
- RiskEventOutcome,
4729
- RiskFactorType,
4730
4701
  ServiceApiModule,
4731
4702
  ServicesModule,
4732
4703
  SsoApiError,
package/dist/index.mjs CHANGED
@@ -2107,6 +2107,25 @@ var OrganizationsModule = class {
2107
2107
  return response.data;
2108
2108
  }
2109
2109
  };
2110
+ /**
2111
+ * Security & Risk insights
2112
+ */
2113
+ this.security = {
2114
+ /**
2115
+ * Get risk events for an organization.
2116
+ * Requires 'owner' or 'admin' role.
2117
+ *
2118
+ * @param orgSlug Organization slug
2119
+ * @param params Query parameters
2120
+ */
2121
+ getRiskEvents: async (orgSlug, params) => {
2122
+ const response = await this.http.get(
2123
+ `/api/organizations/${orgSlug}/risk-events`,
2124
+ { params }
2125
+ );
2126
+ return response.data;
2127
+ }
2128
+ };
2110
2129
  // ============================================================================
2111
2130
  // BYOP - BRING YOUR OWN PAYMENT
2112
2131
  // ============================================================================
@@ -4625,49 +4644,8 @@ var SsoClient = class {
4625
4644
  return this.session.getToken();
4626
4645
  }
4627
4646
  };
4628
-
4629
- // src/types/risk.ts
4630
- var RiskAction = /* @__PURE__ */ ((RiskAction2) => {
4631
- RiskAction2["ALLOW"] = "allow";
4632
- RiskAction2["LOG_ONLY"] = "log_only";
4633
- RiskAction2["CHALLENGE_MFA"] = "challenge_mfa";
4634
- RiskAction2["BLOCK"] = "block";
4635
- return RiskAction2;
4636
- })(RiskAction || {});
4637
- var RiskFactorType = /* @__PURE__ */ ((RiskFactorType2) => {
4638
- RiskFactorType2["NEW_IP"] = "new_ip";
4639
- RiskFactorType2["HIGH_RISK_LOCATION"] = "high_risk_location";
4640
- RiskFactorType2["IMPOSSIBLE_TRAVEL"] = "impossible_travel";
4641
- RiskFactorType2["NEW_DEVICE"] = "new_device";
4642
- RiskFactorType2["FAILED_ATTEMPTS"] = "failed_attempts";
4643
- RiskFactorType2["UNUSUAL_TIME"] = "unusual_time";
4644
- RiskFactorType2["SUSPICIOUS_USER_AGENT"] = "suspicious_user_agent";
4645
- RiskFactorType2["ANONYMOUS_NETWORK"] = "anonymous_network";
4646
- RiskFactorType2["NEW_ACCOUNT"] = "new_account";
4647
- RiskFactorType2["SUSPICIOUS_HISTORY"] = "suspicious_history";
4648
- RiskFactorType2["HIGH_VELOCITY"] = "high_velocity";
4649
- RiskFactorType2["CUSTOM_RULE"] = "custom_rule";
4650
- return RiskFactorType2;
4651
- })(RiskFactorType || {});
4652
- var AuthMethod = /* @__PURE__ */ ((AuthMethod2) => {
4653
- AuthMethod2["PASSWORD"] = "password";
4654
- AuthMethod2["OAUTH"] = "oauth";
4655
- AuthMethod2["PASSKEY"] = "passkey";
4656
- AuthMethod2["MAGIC_LINK"] = "magic_link";
4657
- AuthMethod2["MFA"] = "mfa";
4658
- AuthMethod2["SAML"] = "saml";
4659
- return AuthMethod2;
4660
- })(AuthMethod || {});
4661
- var RiskEventOutcome = /* @__PURE__ */ ((RiskEventOutcome2) => {
4662
- RiskEventOutcome2["ALLOWED"] = "allowed";
4663
- RiskEventOutcome2["BLOCKED"] = "blocked";
4664
- RiskEventOutcome2["CHALLENGED"] = "challenged";
4665
- RiskEventOutcome2["LOGGED"] = "logged";
4666
- return RiskEventOutcome2;
4667
- })(RiskEventOutcome || {});
4668
4647
  export {
4669
4648
  AuthErrorCodes,
4670
- AuthMethod,
4671
4649
  AuthModule,
4672
4650
  BrowserStorage,
4673
4651
  CookieStorage,
@@ -4678,9 +4656,6 @@ export {
4678
4656
  PasskeysModule,
4679
4657
  PermissionsModule,
4680
4658
  PlatformModule,
4681
- RiskAction,
4682
- RiskEventOutcome,
4683
- RiskFactorType,
4684
4659
  ServiceApiModule,
4685
4660
  ServicesModule,
4686
4661
  SsoApiError,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drmhse/sso-sdk",
3
- "version": "0.3.8",
3
+ "version": "0.3.9",
4
4
  "description": "Zero-dependency TypeScript SDK for AuthOS, the multi-tenant authentication platform",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",