postex-auth-sdk-stage 1.3.2 → 2.0.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/auth.d.ts +15 -17
- package/dist/postex-auth-sdk-stage.es.js +219 -209
- package/dist/postex-auth-sdk-stage.es.js.map +1 -1
- package/dist/postex-auth-sdk-stage.iife.js +1 -1
- package/dist/postex-auth-sdk-stage.iife.js.map +1 -1
- package/dist/postex-auth-sdk-stage.umd.js +1 -1
- package/dist/postex-auth-sdk-stage.umd.js.map +1 -1
- package/package.json +6 -6
package/dist/auth.d.ts
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
type AuthEntity = "xstak" | "postex" | "callcourier" | "postexglobal" | "postexsa";
|
|
2
|
+
type AuthIdentifierInput = string | {
|
|
3
|
+
email?: string;
|
|
4
|
+
mobileNumber?: string;
|
|
5
|
+
realm?: string;
|
|
6
|
+
};
|
|
7
|
+
interface RealmOptions {
|
|
8
|
+
realm?: string;
|
|
9
|
+
}
|
|
2
10
|
interface AuthSDKConfig {
|
|
3
11
|
apiKey?: string;
|
|
4
12
|
appId?: AuthEntity;
|
|
@@ -66,10 +74,7 @@ interface PasskeyRegistrationChallenge {
|
|
|
66
74
|
timeout?: number;
|
|
67
75
|
attestation?: AttestationConveyancePreference;
|
|
68
76
|
/** Existing credential IDs to exclude (prevents duplicate registration) */
|
|
69
|
-
excludeCredentials?:
|
|
70
|
-
id: string;
|
|
71
|
-
type: "public-key";
|
|
72
|
-
}>;
|
|
77
|
+
excludeCredentials?: string[];
|
|
73
78
|
}
|
|
74
79
|
interface PasskeyRegisterResponse {
|
|
75
80
|
registered: boolean;
|
|
@@ -109,6 +114,8 @@ export declare class AuthSDK {
|
|
|
109
114
|
constructor(config: AuthSDKConfig);
|
|
110
115
|
private getBaseUrl;
|
|
111
116
|
private normalizeAuthIdentifier;
|
|
117
|
+
private extractRealm;
|
|
118
|
+
private buildAuthRequestBody;
|
|
112
119
|
private buildUrl;
|
|
113
120
|
private request;
|
|
114
121
|
/**
|
|
@@ -122,26 +129,17 @@ export declare class AuthSDK {
|
|
|
122
129
|
* GET /auth/status - Check if client has trusted device session and what auth method is available.
|
|
123
130
|
* Returns no_session | session_found | webauthn_ready per PostEx Auth BFF spec.
|
|
124
131
|
*/
|
|
125
|
-
getStatus(identifier:
|
|
126
|
-
email?: string;
|
|
127
|
-
mobileNumber?: string;
|
|
128
|
-
}): Promise<AuthStatusResponse>;
|
|
132
|
+
getStatus(identifier: AuthIdentifierInput, options?: RealmOptions): Promise<AuthStatusResponse>;
|
|
129
133
|
/**
|
|
130
134
|
* POST /auth/initiate - Unified entry: returns webauthn_challenge or otp_sent.
|
|
131
135
|
* Sets auth_session cookie when otp_sent.
|
|
132
136
|
*/
|
|
133
|
-
initiateAuth(identifier:
|
|
134
|
-
email?: string;
|
|
135
|
-
mobileNumber?: string;
|
|
136
|
-
}): Promise<InitiateAuthResponse>;
|
|
137
|
+
initiateAuth(identifier: AuthIdentifierInput, options?: RealmOptions): Promise<InitiateAuthResponse>;
|
|
137
138
|
/**
|
|
138
139
|
* POST /otp/initiate - Direct OTP initiation using email or mobile number.
|
|
139
140
|
* Requires at least one identifier: email or mobileNumber.
|
|
140
141
|
*/
|
|
141
|
-
initiateOTP(identifier:
|
|
142
|
-
email?: string;
|
|
143
|
-
mobileNumber?: string;
|
|
144
|
-
}): Promise<OTPInitiateResponse>;
|
|
142
|
+
initiateOTP(identifier: AuthIdentifierInput, options?: RealmOptions): Promise<OTPInitiateResponse>;
|
|
145
143
|
/**
|
|
146
144
|
* POST /otp/verify - Verifies the OTP code entered by the user.
|
|
147
145
|
* Stores tokens from the response.
|
|
@@ -232,7 +230,7 @@ export declare class AuthSDK {
|
|
|
232
230
|
* Requires trusted device cookie (td). Refresh token is stored server-side.
|
|
233
231
|
* Rate limit: 10 requests per minute.
|
|
234
232
|
*/
|
|
235
|
-
refreshToken(): Promise<RefreshTokenResponse>;
|
|
233
|
+
refreshToken(options?: RealmOptions): Promise<RefreshTokenResponse>;
|
|
236
234
|
/**
|
|
237
235
|
* POST /auth/logout - Logout from the current device.
|
|
238
236
|
* Revokes the current token and trusted device, then clears local tokens.
|