@bytexbyte/ike-app-api 1.0.7 → 1.0.8
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/lib/Auth/index.d.ts +7 -11
- package/lib/Auth/index.js +5 -5
- package/lib/Auth/type.d.ts +10 -1
- package/package.json +1 -1
package/lib/Auth/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import BxBApi from '@bytexbyte/bxb-api';
|
|
2
|
-
import { SignInAppleMobile, SignInEmailBiometrics, SignInEmailPassword, SignInFacebookMobile, SignInGoogleAndroid, SignInGoogleIos, SignInKyc } from './type';
|
|
2
|
+
import { SignInAppleMobile, SignInEmailBiometrics, SignInEmailPassword, SignInFacebookMobile, SignInGoogleAndroid, SignInGoogleIos, SignInKyc, SignInPhoneOTP } from './type';
|
|
3
3
|
declare type User = {
|
|
4
4
|
id: string;
|
|
5
5
|
image: string | null;
|
|
@@ -39,18 +39,13 @@ declare class IKEAppAuthApi extends BxBApi {
|
|
|
39
39
|
verify?: undefined;
|
|
40
40
|
error: 'Field(s) cannot be empty.';
|
|
41
41
|
}>;
|
|
42
|
-
signUp(
|
|
43
|
-
email: string;
|
|
42
|
+
signUp(body: {
|
|
44
43
|
phone: string;
|
|
45
|
-
|
|
46
|
-
lastName: string;
|
|
47
|
-
password: string;
|
|
44
|
+
code: string;
|
|
48
45
|
}): Promise<{
|
|
49
46
|
id: string;
|
|
50
|
-
error?: undefined;
|
|
51
47
|
} | {
|
|
52
|
-
|
|
53
|
-
error: 'Field(s) cannot be empty.' | 'user already created.' | 'Password requires at least 8 characters.' | 'Password requires one upper case and lower case letter' | 'Password must be in ASCII characters.' | 'Password requires at least one number';
|
|
48
|
+
error: 'Field(s) cannot be empty.' | 'User already created.' | 'Invalid OTP code.';
|
|
54
49
|
}>;
|
|
55
50
|
createBiometrics(form: {
|
|
56
51
|
publicKey: string;
|
|
@@ -111,6 +106,7 @@ declare class IKEAppAuthApi extends BxBApi {
|
|
|
111
106
|
signIn(provider: Parameters<SignInAppleMobile>[0], form: Parameters<SignInAppleMobile>[1]): Promise<Awaited<ReturnType<SignInAppleMobile>>>;
|
|
112
107
|
signIn(provider: Parameters<SignInEmailBiometrics>[0], form: Parameters<SignInEmailBiometrics>[1]): Promise<Awaited<ReturnType<SignInEmailBiometrics>>>;
|
|
113
108
|
signIn(provider: Parameters<SignInKyc>[0], form: Parameters<SignInKyc>[1]): Promise<Awaited<ReturnType<SignInKyc>>>;
|
|
109
|
+
signIn(provider: Parameters<SignInPhoneOTP>[0], form: Parameters<SignInPhoneOTP>[1]): Promise<Awaited<ReturnType<SignInPhoneOTP>>>;
|
|
114
110
|
signOut(): Promise<any>;
|
|
115
111
|
getSession(): Promise<Session>;
|
|
116
112
|
createToken(): Promise<{
|
|
@@ -153,13 +149,13 @@ declare class IKEAppAuthApi extends BxBApi {
|
|
|
153
149
|
url: string;
|
|
154
150
|
error?: undefined;
|
|
155
151
|
}>;
|
|
156
|
-
|
|
152
|
+
sendOTP(body: {
|
|
157
153
|
phone: string;
|
|
158
154
|
}): Promise<{
|
|
159
155
|
success: 'ok';
|
|
160
156
|
expiredAt: Date;
|
|
161
157
|
} | {
|
|
162
|
-
error: 'Phone number is required.' | '
|
|
158
|
+
error: 'Phone number is required.' | 'OTP already exists. Please check your messages.';
|
|
163
159
|
}>;
|
|
164
160
|
}
|
|
165
161
|
export default IKEAppAuthApi;
|
package/lib/Auth/index.js
CHANGED
|
@@ -121,7 +121,7 @@ var IKEAppAuthApi = /** @class */ (function (_super) {
|
|
|
121
121
|
});
|
|
122
122
|
});
|
|
123
123
|
};
|
|
124
|
-
IKEAppAuthApi.prototype.signUp = function (
|
|
124
|
+
IKEAppAuthApi.prototype.signUp = function (body) {
|
|
125
125
|
return __awaiter(this, void 0, void 0, function () {
|
|
126
126
|
var response;
|
|
127
127
|
return __generator(this, function (_a) {
|
|
@@ -131,8 +131,8 @@ var IKEAppAuthApi = /** @class */ (function (_super) {
|
|
|
131
131
|
headers: {
|
|
132
132
|
'Content-Type': 'application/json',
|
|
133
133
|
},
|
|
134
|
-
body: JSON.stringify(
|
|
135
|
-
}, "sign-up
|
|
134
|
+
body: JSON.stringify(body),
|
|
135
|
+
}, "sign-up")];
|
|
136
136
|
case 1:
|
|
137
137
|
response = _a.sent();
|
|
138
138
|
return [2 /*return*/, response.json()];
|
|
@@ -387,7 +387,7 @@ var IKEAppAuthApi = /** @class */ (function (_super) {
|
|
|
387
387
|
});
|
|
388
388
|
});
|
|
389
389
|
};
|
|
390
|
-
IKEAppAuthApi.prototype.
|
|
390
|
+
IKEAppAuthApi.prototype.sendOTP = function (body) {
|
|
391
391
|
return __awaiter(this, void 0, void 0, function () {
|
|
392
392
|
var response;
|
|
393
393
|
return __generator(this, function (_a) {
|
|
@@ -398,7 +398,7 @@ var IKEAppAuthApi = /** @class */ (function (_super) {
|
|
|
398
398
|
'Content-Type': 'application/json',
|
|
399
399
|
},
|
|
400
400
|
body: JSON.stringify(body),
|
|
401
|
-
}, "send-
|
|
401
|
+
}, "send-otp")];
|
|
402
402
|
case 1:
|
|
403
403
|
response = _a.sent();
|
|
404
404
|
return [2 /*return*/, response.json()];
|
package/lib/Auth/type.d.ts
CHANGED
|
@@ -82,4 +82,13 @@ export declare type SignInKyc = (provider: 'kyc', form: {
|
|
|
82
82
|
id?: undefined;
|
|
83
83
|
error: 'Authentication error.' | 'Field(s) cannot be empty.' | 'KYC ID not verified.' | 'signature error.' | 'URL not found.';
|
|
84
84
|
}>;
|
|
85
|
-
export declare type
|
|
85
|
+
export declare type SignInPhoneOTP = (provider: 'phone-otp', form: {
|
|
86
|
+
phone: string;
|
|
87
|
+
code: string;
|
|
88
|
+
csrfToken?: string;
|
|
89
|
+
}) => Promise<{
|
|
90
|
+
id: string;
|
|
91
|
+
} | {
|
|
92
|
+
error: 'Authentication error.' | 'Field(s) cannot be empty.' | 'Invalid OTP code.' | 'User not found.' | 'ID not verified.';
|
|
93
|
+
}>;
|
|
94
|
+
export declare type SignIn = SignInEmailPassword | SignInGoogleIos | SignInGoogleAndroid | SignInFacebookMobile | SignInAppleMobile | SignInEmailBiometrics | SignInKyc | SignInPhoneOTP;
|