postex-auth-sdk-stage 2.2.0 → 2.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -6
- package/dist/auth.d.ts +4 -6
- package/dist/postex-auth-sdk-stage.es.js +368 -365
- package/dist/postex-auth-sdk-stage.iife.js +1 -1
- package/dist/postex-auth-sdk-stage.umd.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -101,7 +101,7 @@ Accepts either a direct email string or an identifier object.
|
|
|
101
101
|
|
|
102
102
|
```typescript
|
|
103
103
|
async getStatus(
|
|
104
|
-
identifier: string | { email?: string; mobileNumber?: string }
|
|
104
|
+
identifier: string | { email?: string; mobileNumber?: string; username?: string }
|
|
105
105
|
): Promise<AuthStatusResponse>
|
|
106
106
|
```
|
|
107
107
|
|
|
@@ -110,6 +110,7 @@ async getStatus(
|
|
|
110
110
|
- `auth.getStatus('user@example.com')`
|
|
111
111
|
- `auth.getStatus({ email: 'user@example.com' })`
|
|
112
112
|
- `auth.getStatus({ mobileNumber: '03011266254' })`
|
|
113
|
+
- `auth.getStatus({ username: 'user123' })`
|
|
113
114
|
|
|
114
115
|
**Returns:**
|
|
115
116
|
|
|
@@ -126,10 +127,17 @@ Start the authentication process. Returns either a WebAuthn challenge or confirm
|
|
|
126
127
|
|
|
127
128
|
```typescript
|
|
128
129
|
async initiateAuth(
|
|
129
|
-
identifier: string | { email?: string; mobileNumber?: string }
|
|
130
|
+
identifier: string | { email?: string; mobileNumber?: string; username?: string }
|
|
130
131
|
): Promise<InitiateAuthResponse>
|
|
131
132
|
```
|
|
132
133
|
|
|
134
|
+
**Supported input forms:**
|
|
135
|
+
|
|
136
|
+
- `auth.initiateAuth('user@example.com')`
|
|
137
|
+
- `auth.initiateAuth({ email: 'user@example.com' })`
|
|
138
|
+
- `auth.initiateAuth({ mobileNumber: '03011266254' })`
|
|
139
|
+
- `auth.initiateAuth({ username: 'user123' })`
|
|
140
|
+
|
|
133
141
|
**Returns:**
|
|
134
142
|
|
|
135
143
|
- `status`: `'webauthn_challenge'` | `'otp_sent'`
|
|
@@ -140,11 +148,11 @@ async initiateAuth(
|
|
|
140
148
|
#### initiateOTP()
|
|
141
149
|
|
|
142
150
|
Start OTP authentication directly via `/otp/initiate`.
|
|
143
|
-
Requires at least one identifier: `email` or `
|
|
151
|
+
Requires at least one identifier: `email`, `mobileNumber`, or `username`.
|
|
144
152
|
|
|
145
153
|
```typescript
|
|
146
154
|
async initiateOTP(
|
|
147
|
-
identifier: string | { email?: string; mobileNumber?: string }
|
|
155
|
+
identifier: string | { email?: string; mobileNumber?: string; username?: string }
|
|
148
156
|
): Promise<{
|
|
149
157
|
message?: string;
|
|
150
158
|
}>
|
|
@@ -153,11 +161,12 @@ async initiateOTP(
|
|
|
153
161
|
**Supported input forms:**
|
|
154
162
|
- `auth.initiateOTP({ email: 'user@example.com' })`
|
|
155
163
|
- `auth.initiateOTP({ mobileNumber: '03011266254' })`
|
|
156
|
-
- `auth.initiateOTP({
|
|
164
|
+
- `auth.initiateOTP({ username: 'user123' })`
|
|
157
165
|
|
|
158
166
|
**Validation:**
|
|
159
167
|
|
|
160
|
-
- Throws an error when
|
|
168
|
+
- Throws an error when `email`, `mobileNumber`, and `username` are all missing/empty.
|
|
169
|
+
- `username` is trimmed, must be 64 characters or fewer, and must not contain control characters.
|
|
161
170
|
|
|
162
171
|
---
|
|
163
172
|
|
package/dist/auth.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ type AuthEntity = "xstak" | "postex" | "callcourier" | "postexglobal" | "postexs
|
|
|
2
2
|
type AuthIdentifierInput = string | {
|
|
3
3
|
email?: string;
|
|
4
4
|
mobileNumber?: string;
|
|
5
|
+
username?: string;
|
|
5
6
|
realm?: string;
|
|
6
7
|
};
|
|
7
8
|
interface RealmOptions {
|
|
@@ -36,7 +37,6 @@ interface InitiateAuthResponse {
|
|
|
36
37
|
}
|
|
37
38
|
interface OTPVerifyResponse {
|
|
38
39
|
access_token: string;
|
|
39
|
-
id_token: string;
|
|
40
40
|
refresh_token: string;
|
|
41
41
|
expires_in: number;
|
|
42
42
|
token_type: string;
|
|
@@ -88,7 +88,6 @@ interface PasskeyStatusResponse {
|
|
|
88
88
|
interface AuthResponse {
|
|
89
89
|
access_token: string;
|
|
90
90
|
refresh_token: string;
|
|
91
|
-
id_token?: string;
|
|
92
91
|
email: string;
|
|
93
92
|
name: string;
|
|
94
93
|
expiresIn?: number;
|
|
@@ -98,7 +97,6 @@ interface AuthResponse {
|
|
|
98
97
|
/** Response from POST /auth/refresh */
|
|
99
98
|
interface RefreshTokenResponse {
|
|
100
99
|
access_token: string;
|
|
101
|
-
id_token?: string;
|
|
102
100
|
token_type: string;
|
|
103
101
|
expires_in: number;
|
|
104
102
|
}
|
|
@@ -129,6 +127,7 @@ export declare class AuthSDK {
|
|
|
129
127
|
private assertNoControlChars;
|
|
130
128
|
private validateEmail;
|
|
131
129
|
private validateMobileNumber;
|
|
130
|
+
private validateUsername;
|
|
132
131
|
private validateOTP;
|
|
133
132
|
private validateMagicLinkToken;
|
|
134
133
|
private validateRealm;
|
|
@@ -156,8 +155,8 @@ export declare class AuthSDK {
|
|
|
156
155
|
*/
|
|
157
156
|
initiateAuth(identifier: AuthIdentifierInput, options?: RealmOptions): Promise<InitiateAuthResponse>;
|
|
158
157
|
/**
|
|
159
|
-
* POST /otp/initiate - Direct OTP initiation using email
|
|
160
|
-
* Requires at least one identifier: email or
|
|
158
|
+
* POST /otp/initiate - Direct OTP initiation using email, mobile number, or username.
|
|
159
|
+
* Requires at least one identifier: email, mobileNumber, or username.
|
|
161
160
|
*/
|
|
162
161
|
initiateOTP(identifier: AuthIdentifierInput, options?: RealmOptions): Promise<OTPInitiateResponse>;
|
|
163
162
|
/**
|
|
@@ -237,7 +236,6 @@ export declare class AuthSDK {
|
|
|
237
236
|
storeTokens(tokens: {
|
|
238
237
|
accessToken: string;
|
|
239
238
|
refreshToken?: string;
|
|
240
|
-
idToken?: string;
|
|
241
239
|
expiresIn?: number;
|
|
242
240
|
tokenType?: string;
|
|
243
241
|
}): Promise<void>;
|