@delopay/sdk 0.3.3 → 0.5.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 +79 -26
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +95 -19
- package/dist/index.d.ts +95 -19
- package/dist/index.js +79 -26
- 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
|
}
|
|
@@ -1741,6 +1771,22 @@ declare class AdminPortal {
|
|
|
1741
1771
|
analytics(params: AdminAnalyticsRequest): Promise<PlatformAnalyticsResponse>;
|
|
1742
1772
|
overviewStats(): Promise<OverviewStatsResponse>;
|
|
1743
1773
|
paymentAnalytics(params: PaymentAnalyticsRequest): Promise<PaymentAnalyticsResponse>;
|
|
1774
|
+
/**
|
|
1775
|
+
* Retrieve a merchant account via the admin portal. Unlike
|
|
1776
|
+
* `merchantAccounts.retrieve`, this route accepts an admin JWT (or admin API
|
|
1777
|
+
* key) and does not require the JWT to be scoped to the target merchant.
|
|
1778
|
+
*/
|
|
1779
|
+
retrieveAccount(merchantId: string): Promise<MerchantAccountResponse>;
|
|
1780
|
+
/**
|
|
1781
|
+
* Update a merchant account via the admin portal. Authenticated via admin JWT
|
|
1782
|
+
* or admin API key.
|
|
1783
|
+
*/
|
|
1784
|
+
updateAccount(merchantId: string, params: MerchantAccountUpdateRequest): Promise<MerchantAccountResponse>;
|
|
1785
|
+
/**
|
|
1786
|
+
* Delete a merchant account via the admin portal. Authenticated via admin JWT
|
|
1787
|
+
* or admin API key.
|
|
1788
|
+
*/
|
|
1789
|
+
deleteAccount(merchantId: string): Promise<MerchantAccountResponse>;
|
|
1744
1790
|
}
|
|
1745
1791
|
|
|
1746
1792
|
/** Create and manage API keys for a merchant account. */
|
|
@@ -2985,22 +3031,26 @@ declare class Users {
|
|
|
2985
3031
|
rotatePassword(params: ResetPasswordRequest): Promise<UserResponse>;
|
|
2986
3032
|
forgotPassword(params: ForgotPasswordRequest): Promise<Record<string, unknown>>;
|
|
2987
3033
|
/**
|
|
2988
|
-
*
|
|
2989
|
-
*
|
|
2990
|
-
* The email link delivers an `EmailToken`, but `/user/reset_password` is
|
|
2991
|
-
* gated by `SinglePurposeJWTAuth` which expects a different JWT type
|
|
2992
|
-
* (`SinglePurposeToken`). The SDK hides this two-step dance:
|
|
3034
|
+
* Commit a password reset.
|
|
2993
3035
|
*
|
|
2994
|
-
*
|
|
2995
|
-
*
|
|
2996
|
-
*
|
|
2997
|
-
*
|
|
2998
|
-
*
|
|
2999
|
-
*
|
|
3000
|
-
*
|
|
3001
|
-
*
|
|
3036
|
+
* The caller is responsible for obtaining a `SinglePurposeToken` with
|
|
3037
|
+
* `purpose: reset_password` via the email-token exchange + TOTP flow
|
|
3038
|
+
* (see `fromEmail`, `beginTotp`, `updateTotp`/`verifyTotp`,
|
|
3039
|
+
* `generateRecoveryCodes`, `terminate2fa`) and setting it on the client
|
|
3040
|
+
* via `setJwtToken` before calling this method. `body.token` must still
|
|
3041
|
+
* be the original `EmailToken` from the reset-link URL — the handler
|
|
3042
|
+
* decodes it a second time to find the user
|
|
3043
|
+
* (`delopay-backend/crates/router/src/core/user.rs:687`).
|
|
3002
3044
|
*/
|
|
3003
3045
|
resetPassword(params: ResetPasswordRequest): Promise<Record<string, unknown>>;
|
|
3046
|
+
/**
|
|
3047
|
+
* Exchange an email-link token (`EmailToken`) for a single-purpose JWT
|
|
3048
|
+
* that drives the next step of the flow (TOTP, verify email, accept
|
|
3049
|
+
* invitation, etc.). No authentication required.
|
|
3050
|
+
*
|
|
3051
|
+
* The `token_type` in the response tells you which step to run next.
|
|
3052
|
+
*/
|
|
3053
|
+
fromEmail(params: FromEmailRequest): Promise<TokenResponse>;
|
|
3004
3054
|
verifyEmail(params: Record<string, unknown>): Promise<AuthResponse>;
|
|
3005
3055
|
sendVerificationEmail(params: ForgotPasswordRequest): Promise<Record<string, unknown>>;
|
|
3006
3056
|
createMerchant(params: Record<string, unknown>): Promise<AuthResponse>;
|
|
@@ -3010,8 +3060,23 @@ declare class Users {
|
|
|
3010
3060
|
listProfiles(): Promise<Record<string, unknown>[]>;
|
|
3011
3061
|
inviteUsers(params: InviteUsersRequest[]): Promise<InviteUsersResponse[]>;
|
|
3012
3062
|
acceptInvitation(params: Record<string, unknown>): Promise<AuthResponse>;
|
|
3063
|
+
/**
|
|
3064
|
+
* Start TOTP setup (or no-op if already set).
|
|
3065
|
+
*
|
|
3066
|
+
* Returns the QR-code payload when the user has no TOTP configured yet;
|
|
3067
|
+
* returns `{ secret: null }` when the user is already set up (caller
|
|
3068
|
+
* should then prompt for a 6-digit code and call `verifyTotp`).
|
|
3069
|
+
*
|
|
3070
|
+
* Requires `Authorization: Bearer <SPT{purpose:totp}>`.
|
|
3071
|
+
*/
|
|
3013
3072
|
beginTotp(): Promise<TotpResponse>;
|
|
3014
|
-
|
|
3073
|
+
/**
|
|
3074
|
+
* Verify a 6-digit TOTP code for a user whose TOTP is already set up.
|
|
3075
|
+
* Marks the code as used in Redis so subsequent flow steps can advance.
|
|
3076
|
+
*
|
|
3077
|
+
* Requires `Authorization: Bearer <SPT{purpose:totp}>`.
|
|
3078
|
+
*/
|
|
3079
|
+
verifyTotp(params: VerifyTotpRequest): Promise<Record<string, unknown>>;
|
|
3015
3080
|
resetTotp(): Promise<Record<string, unknown>>;
|
|
3016
3081
|
generateRecoveryCodes(): Promise<RecoveryCodesResponse>;
|
|
3017
3082
|
verifyRecoveryCode(params: Record<string, unknown>): Promise<AuthResponse>;
|
|
@@ -3036,10 +3101,21 @@ declare class Users {
|
|
|
3036
3101
|
check2faStatus(): Promise<Record<string, unknown>>;
|
|
3037
3102
|
/** Check 2FA status (v2). `GET /user/2fa/v2` */
|
|
3038
3103
|
check2faStatusV2(): Promise<Record<string, unknown>>;
|
|
3039
|
-
/**
|
|
3040
|
-
|
|
3041
|
-
|
|
3042
|
-
|
|
3104
|
+
/**
|
|
3105
|
+
* Finish first-time TOTP setup: commit the secret generated by `beginTotp`
|
|
3106
|
+
* against a 6-digit code from the user's authenticator app.
|
|
3107
|
+
*
|
|
3108
|
+
* `PUT /user/2fa/totp/verify`. Requires `Authorization: Bearer <SPT{purpose:totp}>`.
|
|
3109
|
+
*/
|
|
3110
|
+
updateTotp(params: VerifyTotpRequest): Promise<Record<string, unknown>>;
|
|
3111
|
+
/**
|
|
3112
|
+
* Complete the TOTP step and advance to the next flow stage (e.g.
|
|
3113
|
+
* `reset_password`). Returns a fresh single-purpose token with the
|
|
3114
|
+
* next `token_type`.
|
|
3115
|
+
*
|
|
3116
|
+
* `GET /user/2fa/terminate`. Requires `Authorization: Bearer <SPT{purpose:totp}>`.
|
|
3117
|
+
*/
|
|
3118
|
+
terminate2fa(query?: Terminate2faQueryParams): Promise<TokenResponse>;
|
|
3043
3119
|
/** Create auth method. `POST /user/auth` */
|
|
3044
3120
|
createAuthMethod(params: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
3045
3121
|
/** Update auth method. `PUT /user/auth` */
|
|
@@ -3545,4 +3621,4 @@ declare const Webhooks: {
|
|
|
3545
3621
|
verify(rawBody: string, signatureHeader: string, secret: string, options?: VerifyOptions): Promise<WebhookEvent>;
|
|
3546
3622
|
};
|
|
3547
3623
|
|
|
3548
|
-
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 };
|
|
3624
|
+
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
|
}
|
|
@@ -1741,6 +1771,22 @@ declare class AdminPortal {
|
|
|
1741
1771
|
analytics(params: AdminAnalyticsRequest): Promise<PlatformAnalyticsResponse>;
|
|
1742
1772
|
overviewStats(): Promise<OverviewStatsResponse>;
|
|
1743
1773
|
paymentAnalytics(params: PaymentAnalyticsRequest): Promise<PaymentAnalyticsResponse>;
|
|
1774
|
+
/**
|
|
1775
|
+
* Retrieve a merchant account via the admin portal. Unlike
|
|
1776
|
+
* `merchantAccounts.retrieve`, this route accepts an admin JWT (or admin API
|
|
1777
|
+
* key) and does not require the JWT to be scoped to the target merchant.
|
|
1778
|
+
*/
|
|
1779
|
+
retrieveAccount(merchantId: string): Promise<MerchantAccountResponse>;
|
|
1780
|
+
/**
|
|
1781
|
+
* Update a merchant account via the admin portal. Authenticated via admin JWT
|
|
1782
|
+
* or admin API key.
|
|
1783
|
+
*/
|
|
1784
|
+
updateAccount(merchantId: string, params: MerchantAccountUpdateRequest): Promise<MerchantAccountResponse>;
|
|
1785
|
+
/**
|
|
1786
|
+
* Delete a merchant account via the admin portal. Authenticated via admin JWT
|
|
1787
|
+
* or admin API key.
|
|
1788
|
+
*/
|
|
1789
|
+
deleteAccount(merchantId: string): Promise<MerchantAccountResponse>;
|
|
1744
1790
|
}
|
|
1745
1791
|
|
|
1746
1792
|
/** Create and manage API keys for a merchant account. */
|
|
@@ -2985,22 +3031,26 @@ declare class Users {
|
|
|
2985
3031
|
rotatePassword(params: ResetPasswordRequest): Promise<UserResponse>;
|
|
2986
3032
|
forgotPassword(params: ForgotPasswordRequest): Promise<Record<string, unknown>>;
|
|
2987
3033
|
/**
|
|
2988
|
-
*
|
|
2989
|
-
*
|
|
2990
|
-
* The email link delivers an `EmailToken`, but `/user/reset_password` is
|
|
2991
|
-
* gated by `SinglePurposeJWTAuth` which expects a different JWT type
|
|
2992
|
-
* (`SinglePurposeToken`). The SDK hides this two-step dance:
|
|
3034
|
+
* Commit a password reset.
|
|
2993
3035
|
*
|
|
2994
|
-
*
|
|
2995
|
-
*
|
|
2996
|
-
*
|
|
2997
|
-
*
|
|
2998
|
-
*
|
|
2999
|
-
*
|
|
3000
|
-
*
|
|
3001
|
-
*
|
|
3036
|
+
* The caller is responsible for obtaining a `SinglePurposeToken` with
|
|
3037
|
+
* `purpose: reset_password` via the email-token exchange + TOTP flow
|
|
3038
|
+
* (see `fromEmail`, `beginTotp`, `updateTotp`/`verifyTotp`,
|
|
3039
|
+
* `generateRecoveryCodes`, `terminate2fa`) and setting it on the client
|
|
3040
|
+
* via `setJwtToken` before calling this method. `body.token` must still
|
|
3041
|
+
* be the original `EmailToken` from the reset-link URL — the handler
|
|
3042
|
+
* decodes it a second time to find the user
|
|
3043
|
+
* (`delopay-backend/crates/router/src/core/user.rs:687`).
|
|
3002
3044
|
*/
|
|
3003
3045
|
resetPassword(params: ResetPasswordRequest): Promise<Record<string, unknown>>;
|
|
3046
|
+
/**
|
|
3047
|
+
* Exchange an email-link token (`EmailToken`) for a single-purpose JWT
|
|
3048
|
+
* that drives the next step of the flow (TOTP, verify email, accept
|
|
3049
|
+
* invitation, etc.). No authentication required.
|
|
3050
|
+
*
|
|
3051
|
+
* The `token_type` in the response tells you which step to run next.
|
|
3052
|
+
*/
|
|
3053
|
+
fromEmail(params: FromEmailRequest): Promise<TokenResponse>;
|
|
3004
3054
|
verifyEmail(params: Record<string, unknown>): Promise<AuthResponse>;
|
|
3005
3055
|
sendVerificationEmail(params: ForgotPasswordRequest): Promise<Record<string, unknown>>;
|
|
3006
3056
|
createMerchant(params: Record<string, unknown>): Promise<AuthResponse>;
|
|
@@ -3010,8 +3060,23 @@ declare class Users {
|
|
|
3010
3060
|
listProfiles(): Promise<Record<string, unknown>[]>;
|
|
3011
3061
|
inviteUsers(params: InviteUsersRequest[]): Promise<InviteUsersResponse[]>;
|
|
3012
3062
|
acceptInvitation(params: Record<string, unknown>): Promise<AuthResponse>;
|
|
3063
|
+
/**
|
|
3064
|
+
* Start TOTP setup (or no-op if already set).
|
|
3065
|
+
*
|
|
3066
|
+
* Returns the QR-code payload when the user has no TOTP configured yet;
|
|
3067
|
+
* returns `{ secret: null }` when the user is already set up (caller
|
|
3068
|
+
* should then prompt for a 6-digit code and call `verifyTotp`).
|
|
3069
|
+
*
|
|
3070
|
+
* Requires `Authorization: Bearer <SPT{purpose:totp}>`.
|
|
3071
|
+
*/
|
|
3013
3072
|
beginTotp(): Promise<TotpResponse>;
|
|
3014
|
-
|
|
3073
|
+
/**
|
|
3074
|
+
* Verify a 6-digit TOTP code for a user whose TOTP is already set up.
|
|
3075
|
+
* Marks the code as used in Redis so subsequent flow steps can advance.
|
|
3076
|
+
*
|
|
3077
|
+
* Requires `Authorization: Bearer <SPT{purpose:totp}>`.
|
|
3078
|
+
*/
|
|
3079
|
+
verifyTotp(params: VerifyTotpRequest): Promise<Record<string, unknown>>;
|
|
3015
3080
|
resetTotp(): Promise<Record<string, unknown>>;
|
|
3016
3081
|
generateRecoveryCodes(): Promise<RecoveryCodesResponse>;
|
|
3017
3082
|
verifyRecoveryCode(params: Record<string, unknown>): Promise<AuthResponse>;
|
|
@@ -3036,10 +3101,21 @@ declare class Users {
|
|
|
3036
3101
|
check2faStatus(): Promise<Record<string, unknown>>;
|
|
3037
3102
|
/** Check 2FA status (v2). `GET /user/2fa/v2` */
|
|
3038
3103
|
check2faStatusV2(): Promise<Record<string, unknown>>;
|
|
3039
|
-
/**
|
|
3040
|
-
|
|
3041
|
-
|
|
3042
|
-
|
|
3104
|
+
/**
|
|
3105
|
+
* Finish first-time TOTP setup: commit the secret generated by `beginTotp`
|
|
3106
|
+
* against a 6-digit code from the user's authenticator app.
|
|
3107
|
+
*
|
|
3108
|
+
* `PUT /user/2fa/totp/verify`. Requires `Authorization: Bearer <SPT{purpose:totp}>`.
|
|
3109
|
+
*/
|
|
3110
|
+
updateTotp(params: VerifyTotpRequest): Promise<Record<string, unknown>>;
|
|
3111
|
+
/**
|
|
3112
|
+
* Complete the TOTP step and advance to the next flow stage (e.g.
|
|
3113
|
+
* `reset_password`). Returns a fresh single-purpose token with the
|
|
3114
|
+
* next `token_type`.
|
|
3115
|
+
*
|
|
3116
|
+
* `GET /user/2fa/terminate`. Requires `Authorization: Bearer <SPT{purpose:totp}>`.
|
|
3117
|
+
*/
|
|
3118
|
+
terminate2fa(query?: Terminate2faQueryParams): Promise<TokenResponse>;
|
|
3043
3119
|
/** Create auth method. `POST /user/auth` */
|
|
3044
3120
|
createAuthMethod(params: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
3045
3121
|
/** Update auth method. `PUT /user/auth` */
|
|
@@ -3545,4 +3621,4 @@ declare const Webhooks: {
|
|
|
3545
3621
|
verify(rawBody: string, signatureHeader: string, secret: string, options?: VerifyOptions): Promise<WebhookEvent>;
|
|
3546
3622
|
};
|
|
3547
3623
|
|
|
3548
|
-
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 };
|
|
3624
|
+
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
|
@@ -96,6 +96,30 @@ var AdminPortal = class {
|
|
|
96
96
|
query: params
|
|
97
97
|
});
|
|
98
98
|
}
|
|
99
|
+
/**
|
|
100
|
+
* Retrieve a merchant account via the admin portal. Unlike
|
|
101
|
+
* `merchantAccounts.retrieve`, this route accepts an admin JWT (or admin API
|
|
102
|
+
* key) and does not require the JWT to be scoped to the target merchant.
|
|
103
|
+
*/
|
|
104
|
+
async retrieveAccount(merchantId) {
|
|
105
|
+
return this.request("GET", `/admin-portal/accounts/${encodeURIComponent(merchantId)}`);
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Update a merchant account via the admin portal. Authenticated via admin JWT
|
|
109
|
+
* or admin API key.
|
|
110
|
+
*/
|
|
111
|
+
async updateAccount(merchantId, params) {
|
|
112
|
+
return this.request("POST", `/admin-portal/accounts/${encodeURIComponent(merchantId)}`, {
|
|
113
|
+
body: params
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Delete a merchant account via the admin portal. Authenticated via admin JWT
|
|
118
|
+
* or admin API key.
|
|
119
|
+
*/
|
|
120
|
+
async deleteAccount(merchantId) {
|
|
121
|
+
return this.request("DELETE", `/admin-portal/accounts/${encodeURIComponent(merchantId)}`);
|
|
122
|
+
}
|
|
99
123
|
};
|
|
100
124
|
|
|
101
125
|
// src/resources/apiKeys.ts
|
|
@@ -2030,31 +2054,29 @@ var Users = class {
|
|
|
2030
2054
|
return this.request("POST", "/user/forgot_password", { body: params });
|
|
2031
2055
|
}
|
|
2032
2056
|
/**
|
|
2033
|
-
*
|
|
2034
|
-
*
|
|
2035
|
-
* The email link delivers an `EmailToken`, but `/user/reset_password` is
|
|
2036
|
-
* gated by `SinglePurposeJWTAuth` which expects a different JWT type
|
|
2037
|
-
* (`SinglePurposeToken`). The SDK hides this two-step dance:
|
|
2057
|
+
* Commit a password reset.
|
|
2038
2058
|
*
|
|
2039
|
-
*
|
|
2040
|
-
*
|
|
2041
|
-
*
|
|
2042
|
-
*
|
|
2043
|
-
*
|
|
2044
|
-
*
|
|
2045
|
-
*
|
|
2046
|
-
*
|
|
2059
|
+
* The caller is responsible for obtaining a `SinglePurposeToken` with
|
|
2060
|
+
* `purpose: reset_password` via the email-token exchange + TOTP flow
|
|
2061
|
+
* (see `fromEmail`, `beginTotp`, `updateTotp`/`verifyTotp`,
|
|
2062
|
+
* `generateRecoveryCodes`, `terminate2fa`) and setting it on the client
|
|
2063
|
+
* via `setJwtToken` before calling this method. `body.token` must still
|
|
2064
|
+
* be the original `EmailToken` from the reset-link URL — the handler
|
|
2065
|
+
* decodes it a second time to find the user
|
|
2066
|
+
* (`delopay-backend/crates/router/src/core/user.rs:687`).
|
|
2047
2067
|
*/
|
|
2048
2068
|
async resetPassword(params) {
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2069
|
+
return this.request("POST", "/user/reset_password", { body: params });
|
|
2070
|
+
}
|
|
2071
|
+
/**
|
|
2072
|
+
* Exchange an email-link token (`EmailToken`) for a single-purpose JWT
|
|
2073
|
+
* that drives the next step of the flow (TOTP, verify email, accept
|
|
2074
|
+
* invitation, etc.). No authentication required.
|
|
2075
|
+
*
|
|
2076
|
+
* The `token_type` in the response tells you which step to run next.
|
|
2077
|
+
*/
|
|
2078
|
+
async fromEmail(params) {
|
|
2079
|
+
return this.request("POST", "/user/from_email", { body: params });
|
|
2058
2080
|
}
|
|
2059
2081
|
async verifyEmail(params) {
|
|
2060
2082
|
return this.request("POST", "/user/verify_email", { body: params });
|
|
@@ -2083,9 +2105,24 @@ var Users = class {
|
|
|
2083
2105
|
async acceptInvitation(params) {
|
|
2084
2106
|
return this.request("POST", "/user/user/invite/accept", { body: params });
|
|
2085
2107
|
}
|
|
2108
|
+
/**
|
|
2109
|
+
* Start TOTP setup (or no-op if already set).
|
|
2110
|
+
*
|
|
2111
|
+
* Returns the QR-code payload when the user has no TOTP configured yet;
|
|
2112
|
+
* returns `{ secret: null }` when the user is already set up (caller
|
|
2113
|
+
* should then prompt for a 6-digit code and call `verifyTotp`).
|
|
2114
|
+
*
|
|
2115
|
+
* Requires `Authorization: Bearer <SPT{purpose:totp}>`.
|
|
2116
|
+
*/
|
|
2086
2117
|
async beginTotp() {
|
|
2087
2118
|
return this.request("GET", "/user/2fa/totp/begin");
|
|
2088
2119
|
}
|
|
2120
|
+
/**
|
|
2121
|
+
* Verify a 6-digit TOTP code for a user whose TOTP is already set up.
|
|
2122
|
+
* Marks the code as used in Redis so subsequent flow steps can advance.
|
|
2123
|
+
*
|
|
2124
|
+
* Requires `Authorization: Bearer <SPT{purpose:totp}>`.
|
|
2125
|
+
*/
|
|
2089
2126
|
async verifyTotp(params) {
|
|
2090
2127
|
return this.request("POST", "/user/2fa/totp/verify", { body: params });
|
|
2091
2128
|
}
|
|
@@ -2152,13 +2189,29 @@ var Users = class {
|
|
|
2152
2189
|
async check2faStatusV2() {
|
|
2153
2190
|
return this.request("GET", "/user/2fa/v2");
|
|
2154
2191
|
}
|
|
2155
|
-
/**
|
|
2192
|
+
/**
|
|
2193
|
+
* Finish first-time TOTP setup: commit the secret generated by `beginTotp`
|
|
2194
|
+
* against a 6-digit code from the user's authenticator app.
|
|
2195
|
+
*
|
|
2196
|
+
* `PUT /user/2fa/totp/verify`. Requires `Authorization: Bearer <SPT{purpose:totp}>`.
|
|
2197
|
+
*/
|
|
2156
2198
|
async updateTotp(params) {
|
|
2157
2199
|
return this.request("PUT", "/user/2fa/totp/verify", { body: params });
|
|
2158
2200
|
}
|
|
2159
|
-
/**
|
|
2160
|
-
|
|
2161
|
-
|
|
2201
|
+
/**
|
|
2202
|
+
* Complete the TOTP step and advance to the next flow stage (e.g.
|
|
2203
|
+
* `reset_password`). Returns a fresh single-purpose token with the
|
|
2204
|
+
* next `token_type`.
|
|
2205
|
+
*
|
|
2206
|
+
* `GET /user/2fa/terminate`. Requires `Authorization: Bearer <SPT{purpose:totp}>`.
|
|
2207
|
+
*/
|
|
2208
|
+
async terminate2fa(query) {
|
|
2209
|
+
if (query === void 0) {
|
|
2210
|
+
return this.request("GET", "/user/2fa/terminate");
|
|
2211
|
+
}
|
|
2212
|
+
return this.request("GET", "/user/2fa/terminate", {
|
|
2213
|
+
query
|
|
2214
|
+
});
|
|
2162
2215
|
}
|
|
2163
2216
|
/** Create auth method. `POST /user/auth` */
|
|
2164
2217
|
async createAuthMethod(params) {
|