@delopay/sdk 0.3.2 → 0.4.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 +55 -16
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +79 -14
- package/dist/index.d.ts +79 -14
- package/dist/index.js +55 -16
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1100,6 +1100,36 @@ interface TotpResponse {
|
|
|
1100
1100
|
interface RecoveryCodesResponse {
|
|
1101
1101
|
recovery_codes: string[];
|
|
1102
1102
|
}
|
|
1103
|
+
/** Request shape for exchanging an email-link token for a single-purpose token. */
|
|
1104
|
+
interface FromEmailRequest {
|
|
1105
|
+
/** The JWT delivered in the password-reset / verify-email / invite link. */
|
|
1106
|
+
token: string;
|
|
1107
|
+
}
|
|
1108
|
+
/**
|
|
1109
|
+
* Purpose of a single-purpose JWT. The backend decides which purpose to issue
|
|
1110
|
+
* next based on the user's current state (e.g. TOTP not set → `totp`, TOTP
|
|
1111
|
+
* verified → `reset_password`).
|
|
1112
|
+
*/
|
|
1113
|
+
type TokenPurpose = 'totp' | 'reset_password' | 'sso' | 'auth_select' | 'merchant_select' | 'accept_invitation_from_email' | 'force_set_password' | 'verify_email' | string;
|
|
1114
|
+
/** Response shape from endpoints that issue a new single-purpose token. */
|
|
1115
|
+
interface TokenResponse {
|
|
1116
|
+
/** Signed JWT — pass as `Authorization: Bearer <token>` on the next call. */
|
|
1117
|
+
token: string;
|
|
1118
|
+
/** Kind of token — tells the client which step to perform next. */
|
|
1119
|
+
token_type: TokenPurpose;
|
|
1120
|
+
}
|
|
1121
|
+
/** Body for `POST|PUT /user/2fa/totp/verify` — 6-digit code from authenticator app. */
|
|
1122
|
+
interface VerifyTotpRequest {
|
|
1123
|
+
totp: string;
|
|
1124
|
+
}
|
|
1125
|
+
/** Optional query params for `GET /user/2fa/terminate`. */
|
|
1126
|
+
interface Terminate2faQueryParams {
|
|
1127
|
+
/**
|
|
1128
|
+
* Skip the TOTP requirement entirely. Only honored when the backend has
|
|
1129
|
+
* `force_two_factor_auth = false`. Use sparingly — it weakens security.
|
|
1130
|
+
*/
|
|
1131
|
+
skip_two_factor_auth?: boolean;
|
|
1132
|
+
}
|
|
1103
1133
|
interface PhoneOtpRequest {
|
|
1104
1134
|
phone_number: string;
|
|
1105
1135
|
}
|
|
@@ -2985,17 +3015,26 @@ declare class Users {
|
|
|
2985
3015
|
rotatePassword(params: ResetPasswordRequest): Promise<UserResponse>;
|
|
2986
3016
|
forgotPassword(params: ForgotPasswordRequest): Promise<Record<string, unknown>>;
|
|
2987
3017
|
/**
|
|
2988
|
-
*
|
|
2989
|
-
* forgot-password email.
|
|
3018
|
+
* Commit a password reset.
|
|
2990
3019
|
*
|
|
2991
|
-
* The
|
|
2992
|
-
* `
|
|
2993
|
-
*
|
|
2994
|
-
*
|
|
2995
|
-
* `
|
|
2996
|
-
* the
|
|
3020
|
+
* The caller is responsible for obtaining a `SinglePurposeToken` with
|
|
3021
|
+
* `purpose: reset_password` via the email-token exchange + TOTP flow
|
|
3022
|
+
* (see `fromEmail`, `beginTotp`, `updateTotp`/`verifyTotp`,
|
|
3023
|
+
* `generateRecoveryCodes`, `terminate2fa`) and setting it on the client
|
|
3024
|
+
* via `setJwtToken` before calling this method. `body.token` must still
|
|
3025
|
+
* be the original `EmailToken` from the reset-link URL — the handler
|
|
3026
|
+
* decodes it a second time to find the user
|
|
3027
|
+
* (`delopay-backend/crates/router/src/core/user.rs:687`).
|
|
2997
3028
|
*/
|
|
2998
3029
|
resetPassword(params: ResetPasswordRequest): Promise<Record<string, unknown>>;
|
|
3030
|
+
/**
|
|
3031
|
+
* Exchange an email-link token (`EmailToken`) for a single-purpose JWT
|
|
3032
|
+
* that drives the next step of the flow (TOTP, verify email, accept
|
|
3033
|
+
* invitation, etc.). No authentication required.
|
|
3034
|
+
*
|
|
3035
|
+
* The `token_type` in the response tells you which step to run next.
|
|
3036
|
+
*/
|
|
3037
|
+
fromEmail(params: FromEmailRequest): Promise<TokenResponse>;
|
|
2999
3038
|
verifyEmail(params: Record<string, unknown>): Promise<AuthResponse>;
|
|
3000
3039
|
sendVerificationEmail(params: ForgotPasswordRequest): Promise<Record<string, unknown>>;
|
|
3001
3040
|
createMerchant(params: Record<string, unknown>): Promise<AuthResponse>;
|
|
@@ -3005,8 +3044,23 @@ declare class Users {
|
|
|
3005
3044
|
listProfiles(): Promise<Record<string, unknown>[]>;
|
|
3006
3045
|
inviteUsers(params: InviteUsersRequest[]): Promise<InviteUsersResponse[]>;
|
|
3007
3046
|
acceptInvitation(params: Record<string, unknown>): Promise<AuthResponse>;
|
|
3047
|
+
/**
|
|
3048
|
+
* Start TOTP setup (or no-op if already set).
|
|
3049
|
+
*
|
|
3050
|
+
* Returns the QR-code payload when the user has no TOTP configured yet;
|
|
3051
|
+
* returns `{ secret: null }` when the user is already set up (caller
|
|
3052
|
+
* should then prompt for a 6-digit code and call `verifyTotp`).
|
|
3053
|
+
*
|
|
3054
|
+
* Requires `Authorization: Bearer <SPT{purpose:totp}>`.
|
|
3055
|
+
*/
|
|
3008
3056
|
beginTotp(): Promise<TotpResponse>;
|
|
3009
|
-
|
|
3057
|
+
/**
|
|
3058
|
+
* Verify a 6-digit TOTP code for a user whose TOTP is already set up.
|
|
3059
|
+
* Marks the code as used in Redis so subsequent flow steps can advance.
|
|
3060
|
+
*
|
|
3061
|
+
* Requires `Authorization: Bearer <SPT{purpose:totp}>`.
|
|
3062
|
+
*/
|
|
3063
|
+
verifyTotp(params: VerifyTotpRequest): Promise<Record<string, unknown>>;
|
|
3010
3064
|
resetTotp(): Promise<Record<string, unknown>>;
|
|
3011
3065
|
generateRecoveryCodes(): Promise<RecoveryCodesResponse>;
|
|
3012
3066
|
verifyRecoveryCode(params: Record<string, unknown>): Promise<AuthResponse>;
|
|
@@ -3031,10 +3085,21 @@ declare class Users {
|
|
|
3031
3085
|
check2faStatus(): Promise<Record<string, unknown>>;
|
|
3032
3086
|
/** Check 2FA status (v2). `GET /user/2fa/v2` */
|
|
3033
3087
|
check2faStatusV2(): Promise<Record<string, unknown>>;
|
|
3034
|
-
/**
|
|
3035
|
-
|
|
3036
|
-
|
|
3037
|
-
|
|
3088
|
+
/**
|
|
3089
|
+
* Finish first-time TOTP setup: commit the secret generated by `beginTotp`
|
|
3090
|
+
* against a 6-digit code from the user's authenticator app.
|
|
3091
|
+
*
|
|
3092
|
+
* `PUT /user/2fa/totp/verify`. Requires `Authorization: Bearer <SPT{purpose:totp}>`.
|
|
3093
|
+
*/
|
|
3094
|
+
updateTotp(params: VerifyTotpRequest): Promise<Record<string, unknown>>;
|
|
3095
|
+
/**
|
|
3096
|
+
* Complete the TOTP step and advance to the next flow stage (e.g.
|
|
3097
|
+
* `reset_password`). Returns a fresh single-purpose token with the
|
|
3098
|
+
* next `token_type`.
|
|
3099
|
+
*
|
|
3100
|
+
* `GET /user/2fa/terminate`. Requires `Authorization: Bearer <SPT{purpose:totp}>`.
|
|
3101
|
+
*/
|
|
3102
|
+
terminate2fa(query?: Terminate2faQueryParams): Promise<TokenResponse>;
|
|
3038
3103
|
/** Create auth method. `POST /user/auth` */
|
|
3039
3104
|
createAuthMethod(params: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
3040
3105
|
/** Update auth method. `PUT /user/auth` */
|
|
@@ -3540,4 +3605,4 @@ declare const Webhooks: {
|
|
|
3540
3605
|
verify(rawBody: string, signatureHeader: string, secret: string, options?: VerifyOptions): Promise<WebhookEvent>;
|
|
3541
3606
|
};
|
|
3542
3607
|
|
|
3543
|
-
export { type Address, type AddressDetails, type AdminAdjustmentRequest, type AdminAdjustmentResponse, type AdminAnalyticsRequest, type AdminCustomerDetail, type AdminCustomerListParams, type AdminCustomerListResponse, type AdminSignInRequest, type AdminTransactionListParams, type AdminTransactionListResponse, type AllocationListResponse, type AllocationResponse, type AllocationTransferRequest, type AllocationTransferResponse, Analytics, AnalyticsDashboard, type ApiKeyCreateRequest, type ApiKeyCreateResponse, type ApiKeyExpiration, type ApiKeyResponse, type ApiKeyRevokeResponse, type ApiKeyUpdateRequest, type ApplePayVerificationRequest, type ApplePayVerificationResponse, type ApplePayVerifiedDomainsResponse, type AuditLogListParams, type AuditLogListResponse, type AuditLogResponse, type AuthResponse, type AuthenticationCreateRequest, type AuthenticationResponse, type AuthenticationStatus, type AuthenticationType, type AuthorizeResponse, type AutoRechargeConfig, type AutoRechargeUpdateRequest, type BillingCompleteSetupRequest, type BillingProfileResponse, type BillingSetupRequest, type BillingSetupResponse, type BlocklistAddRequest, type BlocklistDataKind, type BlocklistResponse, Cache, type CaptureMethod, type CardDetail, type CardDetailFromLocker, type CardIssuerCreateRequest, type CardIssuerListResponse, type CardIssuerResponse, type CardIssuerUpdateRequest, Cards, type ChangePasswordRequest, Configs, type ConnectorCreateRequest, type ConnectorListResponse, type ConnectorResponse, type ConnectorType, type ConnectorUpdateRequest, type CreateInternalUserRequest, type CreateTenantUserRequest, type Currency, type CustomerCreateRequest, type CustomerListParams, type CustomerPaymentMethodsListParams, type CustomerPaymentMethodsListResponse, type CustomerResponse, type CustomerSummary, type CustomerUpdateRequest, type CustomerUser, type DashboardMetadataResponse, Delopay, DelopayAuthenticationError, DelopayError, type DelopayLogger, type DelopayOptions, type DisputeEvidenceRequest, type DisputeListParams, type DisputeResponse, type DisputeStage, type DisputeStatus, type EphemeralKeyCreateRequest, type EphemeralKeyCreateResponse, type EventClass, type EventDeliveryAttemptResponse, type EventDetailResponse, type EventListParams, type EventListResponse, type EventResponse, type EventType, Export, FeatureMatrix, type FeeOwner, type FeeScheduleCreateRequest, type FeeScheduleResponse, type FeeScheduleUpdateRequest, type FeeType, Files, Forex, type ForgotPasswordRequest, type GatewayConnectRequest, type GatewayResponse, type GsmDecision, type GsmRuleCreateRequest, type GsmRuleResponse, type GsmRuleUpdateRequest, type IntentStatus, type InviteUsersRequest, type InviteUsersResponse, type LedgerEntry, type LedgerListParams, type LedgerResponse, type MandateListParams, type MandateResponse, type MandateRevokedResponse, type MandateStatus, type MandateType, type MerchantAccountCreateRequest, type MerchantAccountResponse, type MerchantAccountType, type MerchantAccountUpdateRequest, type MerchantOverviewResponse, type MerchantOverviewStat, type OnboardMerchantRequest, type OnboardMerchantResponse, type OverviewStat, type OverviewStatsResponse, type PaymentAnalyticsRequest, type PaymentAnalyticsResponse, type PaymentCancelRequest, type PaymentCaptureRequest, type PaymentConfirmRequest, type PaymentCreateRequest, type PaymentLinkListParams, type PaymentLinkListResponse, type PaymentLinkResponse, type PaymentListParams, type PaymentListResponse, type PaymentMethod, type PaymentMethodCreateRequest, type PaymentMethodDeleteResponse, type PaymentMethodListParams, type PaymentMethodResponse, type PaymentMethodType, type PaymentMethodUpdateRequest, type PaymentResponse, type PaymentStat, type PaymentUpdateRequest, type PayoutCreateRequest, type PayoutListParams, type PayoutListResponse, type PayoutResponse, type PayoutStatus, type PayoutType, type PayoutUpdateRequest, type PhoneDetails, type PhoneOtpRequest, type PhoneOtpResponse, type PhoneOtpVerifyRequest, type PhoneOtpVerifyResponse, type PlatformAnalyticsResponse, type PollStatus, type PollStatusResponse, type ProfileAcquirerCreateRequest, type ProfileAcquirerResponse, type ProfileAcquirerUpdateRequest, type ProfileCreateRequest, type ProfileResponse, type ProfileUpdateRequest, type ProjectCreateRequest, type ProjectResponse, type ProjectStats, type ProjectStatsResponse, type ProjectUpdateRequest, type RecoveryCodesResponse, type RefundCreateRequest, type RefundListParams, type RefundListResponse, type RefundResponse, type RefundStatus, type RefundType, type RefundUpdateRequest, type RegionCreateRequest, type RegionResponse, type RegionUpdateRequest, Regions, type RelayRequest, type RelayResponse, type RelayStatus, type RelayType, type RequestFn, type RequestOptions, type ResetPasswordRequest, type RoutingConfigCreateRequest, type RoutingConfigResponse, type ShopCreateRequest, type ShopResponse, type ShopStats, type ShopUpdateRequest, type SignInRequest, type SignUpRequest, type SignUpWithMerchantIdRequest, type SignUpWithMerchantRequest, type SignupToggleRequest, type SignupToggleResponse, type StripeConnectAccountRequest, type StripeConnectAccountResponse, type StripeConnectLinkRequest, type StripeConnectLinkResponse, type SubscriptionCreateRequest, type SubscriptionListParams, type SubscriptionListResponse, type SubscriptionResponse, type SubscriptionUpdateRequest, Subscriptions, type SwitchMerchantRequest, type SwitchProfileRequest, type ThreeDSDecision, type ThreeDsRuleExecuteRequest, type ThreeDsRuleResponse, type TopupRequest, type TopupResponse, type TotpResponse, type TransactionType, type UpdateUserDetailsRequest, type UserResponse, type VerifyOptions, type WebhookDeliveryAttempt, type WebhookEvent, Webhooks };
|
|
3608
|
+
export { type Address, type AddressDetails, type AdminAdjustmentRequest, type AdminAdjustmentResponse, type AdminAnalyticsRequest, type AdminCustomerDetail, type AdminCustomerListParams, type AdminCustomerListResponse, type AdminSignInRequest, type AdminTransactionListParams, type AdminTransactionListResponse, type AllocationListResponse, type AllocationResponse, type AllocationTransferRequest, type AllocationTransferResponse, Analytics, AnalyticsDashboard, type ApiKeyCreateRequest, type ApiKeyCreateResponse, type ApiKeyExpiration, type ApiKeyResponse, type ApiKeyRevokeResponse, type ApiKeyUpdateRequest, type ApplePayVerificationRequest, type ApplePayVerificationResponse, type ApplePayVerifiedDomainsResponse, type AuditLogListParams, type AuditLogListResponse, type AuditLogResponse, type AuthResponse, type AuthenticationCreateRequest, type AuthenticationResponse, type AuthenticationStatus, type AuthenticationType, type AuthorizeResponse, type AutoRechargeConfig, type AutoRechargeUpdateRequest, type BillingCompleteSetupRequest, type BillingProfileResponse, type BillingSetupRequest, type BillingSetupResponse, type BlocklistAddRequest, type BlocklistDataKind, type BlocklistResponse, Cache, type CaptureMethod, type CardDetail, type CardDetailFromLocker, type CardIssuerCreateRequest, type CardIssuerListResponse, type CardIssuerResponse, type CardIssuerUpdateRequest, Cards, type ChangePasswordRequest, Configs, type ConnectorCreateRequest, type ConnectorListResponse, type ConnectorResponse, type ConnectorType, type ConnectorUpdateRequest, type CreateInternalUserRequest, type CreateTenantUserRequest, type Currency, type CustomerCreateRequest, type CustomerListParams, type CustomerPaymentMethodsListParams, type CustomerPaymentMethodsListResponse, type CustomerResponse, type CustomerSummary, type CustomerUpdateRequest, type CustomerUser, type DashboardMetadataResponse, Delopay, DelopayAuthenticationError, DelopayError, type DelopayLogger, type DelopayOptions, type DisputeEvidenceRequest, type DisputeListParams, type DisputeResponse, type DisputeStage, type DisputeStatus, type EphemeralKeyCreateRequest, type EphemeralKeyCreateResponse, type EventClass, type EventDeliveryAttemptResponse, type EventDetailResponse, type EventListParams, type EventListResponse, type EventResponse, type EventType, Export, FeatureMatrix, type FeeOwner, type FeeScheduleCreateRequest, type FeeScheduleResponse, type FeeScheduleUpdateRequest, type FeeType, Files, Forex, type ForgotPasswordRequest, type FromEmailRequest, type GatewayConnectRequest, type GatewayResponse, type GsmDecision, type GsmRuleCreateRequest, type GsmRuleResponse, type GsmRuleUpdateRequest, type IntentStatus, type InviteUsersRequest, type InviteUsersResponse, type LedgerEntry, type LedgerListParams, type LedgerResponse, type MandateListParams, type MandateResponse, type MandateRevokedResponse, type MandateStatus, type MandateType, type MerchantAccountCreateRequest, type MerchantAccountResponse, type MerchantAccountType, type MerchantAccountUpdateRequest, type MerchantOverviewResponse, type MerchantOverviewStat, type OnboardMerchantRequest, type OnboardMerchantResponse, type OverviewStat, type OverviewStatsResponse, type PaymentAnalyticsRequest, type PaymentAnalyticsResponse, type PaymentCancelRequest, type PaymentCaptureRequest, type PaymentConfirmRequest, type PaymentCreateRequest, type PaymentLinkListParams, type PaymentLinkListResponse, type PaymentLinkResponse, type PaymentListParams, type PaymentListResponse, type PaymentMethod, type PaymentMethodCreateRequest, type PaymentMethodDeleteResponse, type PaymentMethodListParams, type PaymentMethodResponse, type PaymentMethodType, type PaymentMethodUpdateRequest, type PaymentResponse, type PaymentStat, type PaymentUpdateRequest, type PayoutCreateRequest, type PayoutListParams, type PayoutListResponse, type PayoutResponse, type PayoutStatus, type PayoutType, type PayoutUpdateRequest, type PhoneDetails, type PhoneOtpRequest, type PhoneOtpResponse, type PhoneOtpVerifyRequest, type PhoneOtpVerifyResponse, type PlatformAnalyticsResponse, type PollStatus, type PollStatusResponse, type ProfileAcquirerCreateRequest, type ProfileAcquirerResponse, type ProfileAcquirerUpdateRequest, type ProfileCreateRequest, type ProfileResponse, type ProfileUpdateRequest, type ProjectCreateRequest, type ProjectResponse, type ProjectStats, type ProjectStatsResponse, type ProjectUpdateRequest, type RecoveryCodesResponse, type RefundCreateRequest, type RefundListParams, type RefundListResponse, type RefundResponse, type RefundStatus, type RefundType, type RefundUpdateRequest, type RegionCreateRequest, type RegionResponse, type RegionUpdateRequest, Regions, type RelayRequest, type RelayResponse, type RelayStatus, type RelayType, type RequestFn, type RequestOptions, type ResetPasswordRequest, type RoutingConfigCreateRequest, type RoutingConfigResponse, type ShopCreateRequest, type ShopResponse, type ShopStats, type ShopUpdateRequest, type SignInRequest, type SignUpRequest, type SignUpWithMerchantIdRequest, type SignUpWithMerchantRequest, type SignupToggleRequest, type SignupToggleResponse, type StripeConnectAccountRequest, type StripeConnectAccountResponse, type StripeConnectLinkRequest, type StripeConnectLinkResponse, type SubscriptionCreateRequest, type SubscriptionListParams, type SubscriptionListResponse, type SubscriptionResponse, type SubscriptionUpdateRequest, Subscriptions, type SwitchMerchantRequest, type SwitchProfileRequest, type Terminate2faQueryParams, type ThreeDSDecision, type ThreeDsRuleExecuteRequest, type ThreeDsRuleResponse, type TokenPurpose, type TokenResponse, type TopupRequest, type TopupResponse, type TotpResponse, type TransactionType, type UpdateUserDetailsRequest, type UserResponse, type VerifyOptions, type VerifyTotpRequest, type WebhookDeliveryAttempt, type WebhookEvent, Webhooks };
|
package/dist/index.d.ts
CHANGED
|
@@ -1100,6 +1100,36 @@ interface TotpResponse {
|
|
|
1100
1100
|
interface RecoveryCodesResponse {
|
|
1101
1101
|
recovery_codes: string[];
|
|
1102
1102
|
}
|
|
1103
|
+
/** Request shape for exchanging an email-link token for a single-purpose token. */
|
|
1104
|
+
interface FromEmailRequest {
|
|
1105
|
+
/** The JWT delivered in the password-reset / verify-email / invite link. */
|
|
1106
|
+
token: string;
|
|
1107
|
+
}
|
|
1108
|
+
/**
|
|
1109
|
+
* Purpose of a single-purpose JWT. The backend decides which purpose to issue
|
|
1110
|
+
* next based on the user's current state (e.g. TOTP not set → `totp`, TOTP
|
|
1111
|
+
* verified → `reset_password`).
|
|
1112
|
+
*/
|
|
1113
|
+
type TokenPurpose = 'totp' | 'reset_password' | 'sso' | 'auth_select' | 'merchant_select' | 'accept_invitation_from_email' | 'force_set_password' | 'verify_email' | string;
|
|
1114
|
+
/** Response shape from endpoints that issue a new single-purpose token. */
|
|
1115
|
+
interface TokenResponse {
|
|
1116
|
+
/** Signed JWT — pass as `Authorization: Bearer <token>` on the next call. */
|
|
1117
|
+
token: string;
|
|
1118
|
+
/** Kind of token — tells the client which step to perform next. */
|
|
1119
|
+
token_type: TokenPurpose;
|
|
1120
|
+
}
|
|
1121
|
+
/** Body for `POST|PUT /user/2fa/totp/verify` — 6-digit code from authenticator app. */
|
|
1122
|
+
interface VerifyTotpRequest {
|
|
1123
|
+
totp: string;
|
|
1124
|
+
}
|
|
1125
|
+
/** Optional query params for `GET /user/2fa/terminate`. */
|
|
1126
|
+
interface Terminate2faQueryParams {
|
|
1127
|
+
/**
|
|
1128
|
+
* Skip the TOTP requirement entirely. Only honored when the backend has
|
|
1129
|
+
* `force_two_factor_auth = false`. Use sparingly — it weakens security.
|
|
1130
|
+
*/
|
|
1131
|
+
skip_two_factor_auth?: boolean;
|
|
1132
|
+
}
|
|
1103
1133
|
interface PhoneOtpRequest {
|
|
1104
1134
|
phone_number: string;
|
|
1105
1135
|
}
|
|
@@ -2985,17 +3015,26 @@ declare class Users {
|
|
|
2985
3015
|
rotatePassword(params: ResetPasswordRequest): Promise<UserResponse>;
|
|
2986
3016
|
forgotPassword(params: ForgotPasswordRequest): Promise<Record<string, unknown>>;
|
|
2987
3017
|
/**
|
|
2988
|
-
*
|
|
2989
|
-
* forgot-password email.
|
|
3018
|
+
* Commit a password reset.
|
|
2990
3019
|
*
|
|
2991
|
-
* The
|
|
2992
|
-
* `
|
|
2993
|
-
*
|
|
2994
|
-
*
|
|
2995
|
-
* `
|
|
2996
|
-
* the
|
|
3020
|
+
* The caller is responsible for obtaining a `SinglePurposeToken` with
|
|
3021
|
+
* `purpose: reset_password` via the email-token exchange + TOTP flow
|
|
3022
|
+
* (see `fromEmail`, `beginTotp`, `updateTotp`/`verifyTotp`,
|
|
3023
|
+
* `generateRecoveryCodes`, `terminate2fa`) and setting it on the client
|
|
3024
|
+
* via `setJwtToken` before calling this method. `body.token` must still
|
|
3025
|
+
* be the original `EmailToken` from the reset-link URL — the handler
|
|
3026
|
+
* decodes it a second time to find the user
|
|
3027
|
+
* (`delopay-backend/crates/router/src/core/user.rs:687`).
|
|
2997
3028
|
*/
|
|
2998
3029
|
resetPassword(params: ResetPasswordRequest): Promise<Record<string, unknown>>;
|
|
3030
|
+
/**
|
|
3031
|
+
* Exchange an email-link token (`EmailToken`) for a single-purpose JWT
|
|
3032
|
+
* that drives the next step of the flow (TOTP, verify email, accept
|
|
3033
|
+
* invitation, etc.). No authentication required.
|
|
3034
|
+
*
|
|
3035
|
+
* The `token_type` in the response tells you which step to run next.
|
|
3036
|
+
*/
|
|
3037
|
+
fromEmail(params: FromEmailRequest): Promise<TokenResponse>;
|
|
2999
3038
|
verifyEmail(params: Record<string, unknown>): Promise<AuthResponse>;
|
|
3000
3039
|
sendVerificationEmail(params: ForgotPasswordRequest): Promise<Record<string, unknown>>;
|
|
3001
3040
|
createMerchant(params: Record<string, unknown>): Promise<AuthResponse>;
|
|
@@ -3005,8 +3044,23 @@ declare class Users {
|
|
|
3005
3044
|
listProfiles(): Promise<Record<string, unknown>[]>;
|
|
3006
3045
|
inviteUsers(params: InviteUsersRequest[]): Promise<InviteUsersResponse[]>;
|
|
3007
3046
|
acceptInvitation(params: Record<string, unknown>): Promise<AuthResponse>;
|
|
3047
|
+
/**
|
|
3048
|
+
* Start TOTP setup (or no-op if already set).
|
|
3049
|
+
*
|
|
3050
|
+
* Returns the QR-code payload when the user has no TOTP configured yet;
|
|
3051
|
+
* returns `{ secret: null }` when the user is already set up (caller
|
|
3052
|
+
* should then prompt for a 6-digit code and call `verifyTotp`).
|
|
3053
|
+
*
|
|
3054
|
+
* Requires `Authorization: Bearer <SPT{purpose:totp}>`.
|
|
3055
|
+
*/
|
|
3008
3056
|
beginTotp(): Promise<TotpResponse>;
|
|
3009
|
-
|
|
3057
|
+
/**
|
|
3058
|
+
* Verify a 6-digit TOTP code for a user whose TOTP is already set up.
|
|
3059
|
+
* Marks the code as used in Redis so subsequent flow steps can advance.
|
|
3060
|
+
*
|
|
3061
|
+
* Requires `Authorization: Bearer <SPT{purpose:totp}>`.
|
|
3062
|
+
*/
|
|
3063
|
+
verifyTotp(params: VerifyTotpRequest): Promise<Record<string, unknown>>;
|
|
3010
3064
|
resetTotp(): Promise<Record<string, unknown>>;
|
|
3011
3065
|
generateRecoveryCodes(): Promise<RecoveryCodesResponse>;
|
|
3012
3066
|
verifyRecoveryCode(params: Record<string, unknown>): Promise<AuthResponse>;
|
|
@@ -3031,10 +3085,21 @@ declare class Users {
|
|
|
3031
3085
|
check2faStatus(): Promise<Record<string, unknown>>;
|
|
3032
3086
|
/** Check 2FA status (v2). `GET /user/2fa/v2` */
|
|
3033
3087
|
check2faStatusV2(): Promise<Record<string, unknown>>;
|
|
3034
|
-
/**
|
|
3035
|
-
|
|
3036
|
-
|
|
3037
|
-
|
|
3088
|
+
/**
|
|
3089
|
+
* Finish first-time TOTP setup: commit the secret generated by `beginTotp`
|
|
3090
|
+
* against a 6-digit code from the user's authenticator app.
|
|
3091
|
+
*
|
|
3092
|
+
* `PUT /user/2fa/totp/verify`. Requires `Authorization: Bearer <SPT{purpose:totp}>`.
|
|
3093
|
+
*/
|
|
3094
|
+
updateTotp(params: VerifyTotpRequest): Promise<Record<string, unknown>>;
|
|
3095
|
+
/**
|
|
3096
|
+
* Complete the TOTP step and advance to the next flow stage (e.g.
|
|
3097
|
+
* `reset_password`). Returns a fresh single-purpose token with the
|
|
3098
|
+
* next `token_type`.
|
|
3099
|
+
*
|
|
3100
|
+
* `GET /user/2fa/terminate`. Requires `Authorization: Bearer <SPT{purpose:totp}>`.
|
|
3101
|
+
*/
|
|
3102
|
+
terminate2fa(query?: Terminate2faQueryParams): Promise<TokenResponse>;
|
|
3038
3103
|
/** Create auth method. `POST /user/auth` */
|
|
3039
3104
|
createAuthMethod(params: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
3040
3105
|
/** Update auth method. `PUT /user/auth` */
|
|
@@ -3540,4 +3605,4 @@ declare const Webhooks: {
|
|
|
3540
3605
|
verify(rawBody: string, signatureHeader: string, secret: string, options?: VerifyOptions): Promise<WebhookEvent>;
|
|
3541
3606
|
};
|
|
3542
3607
|
|
|
3543
|
-
export { type Address, type AddressDetails, type AdminAdjustmentRequest, type AdminAdjustmentResponse, type AdminAnalyticsRequest, type AdminCustomerDetail, type AdminCustomerListParams, type AdminCustomerListResponse, type AdminSignInRequest, type AdminTransactionListParams, type AdminTransactionListResponse, type AllocationListResponse, type AllocationResponse, type AllocationTransferRequest, type AllocationTransferResponse, Analytics, AnalyticsDashboard, type ApiKeyCreateRequest, type ApiKeyCreateResponse, type ApiKeyExpiration, type ApiKeyResponse, type ApiKeyRevokeResponse, type ApiKeyUpdateRequest, type ApplePayVerificationRequest, type ApplePayVerificationResponse, type ApplePayVerifiedDomainsResponse, type AuditLogListParams, type AuditLogListResponse, type AuditLogResponse, type AuthResponse, type AuthenticationCreateRequest, type AuthenticationResponse, type AuthenticationStatus, type AuthenticationType, type AuthorizeResponse, type AutoRechargeConfig, type AutoRechargeUpdateRequest, type BillingCompleteSetupRequest, type BillingProfileResponse, type BillingSetupRequest, type BillingSetupResponse, type BlocklistAddRequest, type BlocklistDataKind, type BlocklistResponse, Cache, type CaptureMethod, type CardDetail, type CardDetailFromLocker, type CardIssuerCreateRequest, type CardIssuerListResponse, type CardIssuerResponse, type CardIssuerUpdateRequest, Cards, type ChangePasswordRequest, Configs, type ConnectorCreateRequest, type ConnectorListResponse, type ConnectorResponse, type ConnectorType, type ConnectorUpdateRequest, type CreateInternalUserRequest, type CreateTenantUserRequest, type Currency, type CustomerCreateRequest, type CustomerListParams, type CustomerPaymentMethodsListParams, type CustomerPaymentMethodsListResponse, type CustomerResponse, type CustomerSummary, type CustomerUpdateRequest, type CustomerUser, type DashboardMetadataResponse, Delopay, DelopayAuthenticationError, DelopayError, type DelopayLogger, type DelopayOptions, type DisputeEvidenceRequest, type DisputeListParams, type DisputeResponse, type DisputeStage, type DisputeStatus, type EphemeralKeyCreateRequest, type EphemeralKeyCreateResponse, type EventClass, type EventDeliveryAttemptResponse, type EventDetailResponse, type EventListParams, type EventListResponse, type EventResponse, type EventType, Export, FeatureMatrix, type FeeOwner, type FeeScheduleCreateRequest, type FeeScheduleResponse, type FeeScheduleUpdateRequest, type FeeType, Files, Forex, type ForgotPasswordRequest, type GatewayConnectRequest, type GatewayResponse, type GsmDecision, type GsmRuleCreateRequest, type GsmRuleResponse, type GsmRuleUpdateRequest, type IntentStatus, type InviteUsersRequest, type InviteUsersResponse, type LedgerEntry, type LedgerListParams, type LedgerResponse, type MandateListParams, type MandateResponse, type MandateRevokedResponse, type MandateStatus, type MandateType, type MerchantAccountCreateRequest, type MerchantAccountResponse, type MerchantAccountType, type MerchantAccountUpdateRequest, type MerchantOverviewResponse, type MerchantOverviewStat, type OnboardMerchantRequest, type OnboardMerchantResponse, type OverviewStat, type OverviewStatsResponse, type PaymentAnalyticsRequest, type PaymentAnalyticsResponse, type PaymentCancelRequest, type PaymentCaptureRequest, type PaymentConfirmRequest, type PaymentCreateRequest, type PaymentLinkListParams, type PaymentLinkListResponse, type PaymentLinkResponse, type PaymentListParams, type PaymentListResponse, type PaymentMethod, type PaymentMethodCreateRequest, type PaymentMethodDeleteResponse, type PaymentMethodListParams, type PaymentMethodResponse, type PaymentMethodType, type PaymentMethodUpdateRequest, type PaymentResponse, type PaymentStat, type PaymentUpdateRequest, type PayoutCreateRequest, type PayoutListParams, type PayoutListResponse, type PayoutResponse, type PayoutStatus, type PayoutType, type PayoutUpdateRequest, type PhoneDetails, type PhoneOtpRequest, type PhoneOtpResponse, type PhoneOtpVerifyRequest, type PhoneOtpVerifyResponse, type PlatformAnalyticsResponse, type PollStatus, type PollStatusResponse, type ProfileAcquirerCreateRequest, type ProfileAcquirerResponse, type ProfileAcquirerUpdateRequest, type ProfileCreateRequest, type ProfileResponse, type ProfileUpdateRequest, type ProjectCreateRequest, type ProjectResponse, type ProjectStats, type ProjectStatsResponse, type ProjectUpdateRequest, type RecoveryCodesResponse, type RefundCreateRequest, type RefundListParams, type RefundListResponse, type RefundResponse, type RefundStatus, type RefundType, type RefundUpdateRequest, type RegionCreateRequest, type RegionResponse, type RegionUpdateRequest, Regions, type RelayRequest, type RelayResponse, type RelayStatus, type RelayType, type RequestFn, type RequestOptions, type ResetPasswordRequest, type RoutingConfigCreateRequest, type RoutingConfigResponse, type ShopCreateRequest, type ShopResponse, type ShopStats, type ShopUpdateRequest, type SignInRequest, type SignUpRequest, type SignUpWithMerchantIdRequest, type SignUpWithMerchantRequest, type SignupToggleRequest, type SignupToggleResponse, type StripeConnectAccountRequest, type StripeConnectAccountResponse, type StripeConnectLinkRequest, type StripeConnectLinkResponse, type SubscriptionCreateRequest, type SubscriptionListParams, type SubscriptionListResponse, type SubscriptionResponse, type SubscriptionUpdateRequest, Subscriptions, type SwitchMerchantRequest, type SwitchProfileRequest, type ThreeDSDecision, type ThreeDsRuleExecuteRequest, type ThreeDsRuleResponse, type TopupRequest, type TopupResponse, type TotpResponse, type TransactionType, type UpdateUserDetailsRequest, type UserResponse, type VerifyOptions, type WebhookDeliveryAttempt, type WebhookEvent, Webhooks };
|
|
3608
|
+
export { type Address, type AddressDetails, type AdminAdjustmentRequest, type AdminAdjustmentResponse, type AdminAnalyticsRequest, type AdminCustomerDetail, type AdminCustomerListParams, type AdminCustomerListResponse, type AdminSignInRequest, type AdminTransactionListParams, type AdminTransactionListResponse, type AllocationListResponse, type AllocationResponse, type AllocationTransferRequest, type AllocationTransferResponse, Analytics, AnalyticsDashboard, type ApiKeyCreateRequest, type ApiKeyCreateResponse, type ApiKeyExpiration, type ApiKeyResponse, type ApiKeyRevokeResponse, type ApiKeyUpdateRequest, type ApplePayVerificationRequest, type ApplePayVerificationResponse, type ApplePayVerifiedDomainsResponse, type AuditLogListParams, type AuditLogListResponse, type AuditLogResponse, type AuthResponse, type AuthenticationCreateRequest, type AuthenticationResponse, type AuthenticationStatus, type AuthenticationType, type AuthorizeResponse, type AutoRechargeConfig, type AutoRechargeUpdateRequest, type BillingCompleteSetupRequest, type BillingProfileResponse, type BillingSetupRequest, type BillingSetupResponse, type BlocklistAddRequest, type BlocklistDataKind, type BlocklistResponse, Cache, type CaptureMethod, type CardDetail, type CardDetailFromLocker, type CardIssuerCreateRequest, type CardIssuerListResponse, type CardIssuerResponse, type CardIssuerUpdateRequest, Cards, type ChangePasswordRequest, Configs, type ConnectorCreateRequest, type ConnectorListResponse, type ConnectorResponse, type ConnectorType, type ConnectorUpdateRequest, type CreateInternalUserRequest, type CreateTenantUserRequest, type Currency, type CustomerCreateRequest, type CustomerListParams, type CustomerPaymentMethodsListParams, type CustomerPaymentMethodsListResponse, type CustomerResponse, type CustomerSummary, type CustomerUpdateRequest, type CustomerUser, type DashboardMetadataResponse, Delopay, DelopayAuthenticationError, DelopayError, type DelopayLogger, type DelopayOptions, type DisputeEvidenceRequest, type DisputeListParams, type DisputeResponse, type DisputeStage, type DisputeStatus, type EphemeralKeyCreateRequest, type EphemeralKeyCreateResponse, type EventClass, type EventDeliveryAttemptResponse, type EventDetailResponse, type EventListParams, type EventListResponse, type EventResponse, type EventType, Export, FeatureMatrix, type FeeOwner, type FeeScheduleCreateRequest, type FeeScheduleResponse, type FeeScheduleUpdateRequest, type FeeType, Files, Forex, type ForgotPasswordRequest, type FromEmailRequest, type GatewayConnectRequest, type GatewayResponse, type GsmDecision, type GsmRuleCreateRequest, type GsmRuleResponse, type GsmRuleUpdateRequest, type IntentStatus, type InviteUsersRequest, type InviteUsersResponse, type LedgerEntry, type LedgerListParams, type LedgerResponse, type MandateListParams, type MandateResponse, type MandateRevokedResponse, type MandateStatus, type MandateType, type MerchantAccountCreateRequest, type MerchantAccountResponse, type MerchantAccountType, type MerchantAccountUpdateRequest, type MerchantOverviewResponse, type MerchantOverviewStat, type OnboardMerchantRequest, type OnboardMerchantResponse, type OverviewStat, type OverviewStatsResponse, type PaymentAnalyticsRequest, type PaymentAnalyticsResponse, type PaymentCancelRequest, type PaymentCaptureRequest, type PaymentConfirmRequest, type PaymentCreateRequest, type PaymentLinkListParams, type PaymentLinkListResponse, type PaymentLinkResponse, type PaymentListParams, type PaymentListResponse, type PaymentMethod, type PaymentMethodCreateRequest, type PaymentMethodDeleteResponse, type PaymentMethodListParams, type PaymentMethodResponse, type PaymentMethodType, type PaymentMethodUpdateRequest, type PaymentResponse, type PaymentStat, type PaymentUpdateRequest, type PayoutCreateRequest, type PayoutListParams, type PayoutListResponse, type PayoutResponse, type PayoutStatus, type PayoutType, type PayoutUpdateRequest, type PhoneDetails, type PhoneOtpRequest, type PhoneOtpResponse, type PhoneOtpVerifyRequest, type PhoneOtpVerifyResponse, type PlatformAnalyticsResponse, type PollStatus, type PollStatusResponse, type ProfileAcquirerCreateRequest, type ProfileAcquirerResponse, type ProfileAcquirerUpdateRequest, type ProfileCreateRequest, type ProfileResponse, type ProfileUpdateRequest, type ProjectCreateRequest, type ProjectResponse, type ProjectStats, type ProjectStatsResponse, type ProjectUpdateRequest, type RecoveryCodesResponse, type RefundCreateRequest, type RefundListParams, type RefundListResponse, type RefundResponse, type RefundStatus, type RefundType, type RefundUpdateRequest, type RegionCreateRequest, type RegionResponse, type RegionUpdateRequest, Regions, type RelayRequest, type RelayResponse, type RelayStatus, type RelayType, type RequestFn, type RequestOptions, type ResetPasswordRequest, type RoutingConfigCreateRequest, type RoutingConfigResponse, type ShopCreateRequest, type ShopResponse, type ShopStats, type ShopUpdateRequest, type SignInRequest, type SignUpRequest, type SignUpWithMerchantIdRequest, type SignUpWithMerchantRequest, type SignupToggleRequest, type SignupToggleResponse, type StripeConnectAccountRequest, type StripeConnectAccountResponse, type StripeConnectLinkRequest, type StripeConnectLinkResponse, type SubscriptionCreateRequest, type SubscriptionListParams, type SubscriptionListResponse, type SubscriptionResponse, type SubscriptionUpdateRequest, Subscriptions, type SwitchMerchantRequest, type SwitchProfileRequest, type Terminate2faQueryParams, type ThreeDSDecision, type ThreeDsRuleExecuteRequest, type ThreeDsRuleResponse, type TokenPurpose, type TokenResponse, type TopupRequest, type TopupResponse, type TotpResponse, type TransactionType, type UpdateUserDetailsRequest, type UserResponse, type VerifyOptions, type VerifyTotpRequest, type WebhookDeliveryAttempt, type WebhookEvent, Webhooks };
|
package/dist/index.js
CHANGED
|
@@ -2030,21 +2030,29 @@ var Users = class {
|
|
|
2030
2030
|
return this.request("POST", "/user/forgot_password", { body: params });
|
|
2031
2031
|
}
|
|
2032
2032
|
/**
|
|
2033
|
-
*
|
|
2034
|
-
* forgot-password email.
|
|
2033
|
+
* Commit a password reset.
|
|
2035
2034
|
*
|
|
2036
|
-
* The
|
|
2037
|
-
* `
|
|
2038
|
-
*
|
|
2039
|
-
*
|
|
2040
|
-
* `
|
|
2041
|
-
* the
|
|
2035
|
+
* The caller is responsible for obtaining a `SinglePurposeToken` with
|
|
2036
|
+
* `purpose: reset_password` via the email-token exchange + TOTP flow
|
|
2037
|
+
* (see `fromEmail`, `beginTotp`, `updateTotp`/`verifyTotp`,
|
|
2038
|
+
* `generateRecoveryCodes`, `terminate2fa`) and setting it on the client
|
|
2039
|
+
* via `setJwtToken` before calling this method. `body.token` must still
|
|
2040
|
+
* be the original `EmailToken` from the reset-link URL — the handler
|
|
2041
|
+
* decodes it a second time to find the user
|
|
2042
|
+
* (`delopay-backend/crates/router/src/core/user.rs:687`).
|
|
2042
2043
|
*/
|
|
2043
2044
|
async resetPassword(params) {
|
|
2044
|
-
return this.request("POST", "/user/reset_password", {
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2045
|
+
return this.request("POST", "/user/reset_password", { body: params });
|
|
2046
|
+
}
|
|
2047
|
+
/**
|
|
2048
|
+
* Exchange an email-link token (`EmailToken`) for a single-purpose JWT
|
|
2049
|
+
* that drives the next step of the flow (TOTP, verify email, accept
|
|
2050
|
+
* invitation, etc.). No authentication required.
|
|
2051
|
+
*
|
|
2052
|
+
* The `token_type` in the response tells you which step to run next.
|
|
2053
|
+
*/
|
|
2054
|
+
async fromEmail(params) {
|
|
2055
|
+
return this.request("POST", "/user/from_email", { body: params });
|
|
2048
2056
|
}
|
|
2049
2057
|
async verifyEmail(params) {
|
|
2050
2058
|
return this.request("POST", "/user/verify_email", { body: params });
|
|
@@ -2073,9 +2081,24 @@ var Users = class {
|
|
|
2073
2081
|
async acceptInvitation(params) {
|
|
2074
2082
|
return this.request("POST", "/user/user/invite/accept", { body: params });
|
|
2075
2083
|
}
|
|
2084
|
+
/**
|
|
2085
|
+
* Start TOTP setup (or no-op if already set).
|
|
2086
|
+
*
|
|
2087
|
+
* Returns the QR-code payload when the user has no TOTP configured yet;
|
|
2088
|
+
* returns `{ secret: null }` when the user is already set up (caller
|
|
2089
|
+
* should then prompt for a 6-digit code and call `verifyTotp`).
|
|
2090
|
+
*
|
|
2091
|
+
* Requires `Authorization: Bearer <SPT{purpose:totp}>`.
|
|
2092
|
+
*/
|
|
2076
2093
|
async beginTotp() {
|
|
2077
2094
|
return this.request("GET", "/user/2fa/totp/begin");
|
|
2078
2095
|
}
|
|
2096
|
+
/**
|
|
2097
|
+
* Verify a 6-digit TOTP code for a user whose TOTP is already set up.
|
|
2098
|
+
* Marks the code as used in Redis so subsequent flow steps can advance.
|
|
2099
|
+
*
|
|
2100
|
+
* Requires `Authorization: Bearer <SPT{purpose:totp}>`.
|
|
2101
|
+
*/
|
|
2079
2102
|
async verifyTotp(params) {
|
|
2080
2103
|
return this.request("POST", "/user/2fa/totp/verify", { body: params });
|
|
2081
2104
|
}
|
|
@@ -2142,13 +2165,29 @@ var Users = class {
|
|
|
2142
2165
|
async check2faStatusV2() {
|
|
2143
2166
|
return this.request("GET", "/user/2fa/v2");
|
|
2144
2167
|
}
|
|
2145
|
-
/**
|
|
2168
|
+
/**
|
|
2169
|
+
* Finish first-time TOTP setup: commit the secret generated by `beginTotp`
|
|
2170
|
+
* against a 6-digit code from the user's authenticator app.
|
|
2171
|
+
*
|
|
2172
|
+
* `PUT /user/2fa/totp/verify`. Requires `Authorization: Bearer <SPT{purpose:totp}>`.
|
|
2173
|
+
*/
|
|
2146
2174
|
async updateTotp(params) {
|
|
2147
2175
|
return this.request("PUT", "/user/2fa/totp/verify", { body: params });
|
|
2148
2176
|
}
|
|
2149
|
-
/**
|
|
2150
|
-
|
|
2151
|
-
|
|
2177
|
+
/**
|
|
2178
|
+
* Complete the TOTP step and advance to the next flow stage (e.g.
|
|
2179
|
+
* `reset_password`). Returns a fresh single-purpose token with the
|
|
2180
|
+
* next `token_type`.
|
|
2181
|
+
*
|
|
2182
|
+
* `GET /user/2fa/terminate`. Requires `Authorization: Bearer <SPT{purpose:totp}>`.
|
|
2183
|
+
*/
|
|
2184
|
+
async terminate2fa(query) {
|
|
2185
|
+
if (query === void 0) {
|
|
2186
|
+
return this.request("GET", "/user/2fa/terminate");
|
|
2187
|
+
}
|
|
2188
|
+
return this.request("GET", "/user/2fa/terminate", {
|
|
2189
|
+
query
|
|
2190
|
+
});
|
|
2152
2191
|
}
|
|
2153
2192
|
/** Create auth method. `POST /user/auth` */
|
|
2154
2193
|
async createAuthMethod(params) {
|