@bytexbyte/ike-app-api 1.0.66 → 1.0.68
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 +22 -1
- package/lib/Auth/index.js +57 -0
- package/lib/Auth/type.d.ts +13 -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, SignInPhoneBiometrics, SignInPhoneOTP } from './type';
|
|
2
|
+
import { SignInAppleMobile, SignInEmailBiometrics, SignInEmailPassword, SignInFacebookMobile, SignInGoogleAndroid, SignInGoogleIos, SignInKyc, SignInPhoneBiometrics, SignInPhoneOTP, SignInPhoneWebAuthn } from './type';
|
|
3
3
|
declare type User = {
|
|
4
4
|
id: string;
|
|
5
5
|
image: string | null;
|
|
@@ -102,6 +102,7 @@ declare class IKEAppAuthApi extends BxBApi {
|
|
|
102
102
|
signIn(provider: Parameters<SignInKyc>[0], form: Parameters<SignInKyc>[1]): Promise<Awaited<ReturnType<SignInKyc>>>;
|
|
103
103
|
signIn(provider: Parameters<SignInPhoneOTP>[0], form: Parameters<SignInPhoneOTP>[1]): Promise<Awaited<ReturnType<SignInPhoneOTP>>>;
|
|
104
104
|
signIn(provider: Parameters<SignInPhoneBiometrics>[0], form: Parameters<SignInPhoneBiometrics>[1]): Promise<Awaited<ReturnType<SignInPhoneBiometrics>>>;
|
|
105
|
+
signIn(provider: Parameters<SignInPhoneWebAuthn>[0], form: Parameters<SignInPhoneWebAuthn>[1]): Promise<Awaited<ReturnType<SignInPhoneWebAuthn>>>;
|
|
105
106
|
signOut(): Promise<any>;
|
|
106
107
|
getSession(): Promise<Session>;
|
|
107
108
|
createToken(): Promise<{
|
|
@@ -177,5 +178,25 @@ declare class IKEAppAuthApi extends BxBApi {
|
|
|
177
178
|
} | {
|
|
178
179
|
error: 'Phone number is required.';
|
|
179
180
|
}>;
|
|
181
|
+
getWebAuthnAuthenticationOptions(body: {
|
|
182
|
+
phoneNumber: string;
|
|
183
|
+
expectedRPID?: string;
|
|
184
|
+
}): Promise<any | {
|
|
185
|
+
error: 'User not found.' | 'User challenge not found.';
|
|
186
|
+
}>;
|
|
187
|
+
getWebAuthnRegistrationOptions(body: {
|
|
188
|
+
phoneNumber: string;
|
|
189
|
+
expectedRPID?: string;
|
|
190
|
+
}): Promise<any>;
|
|
191
|
+
verifyWebAuthnRegistration(body: {
|
|
192
|
+
attResp: any;
|
|
193
|
+
phoneNumber: string;
|
|
194
|
+
expectedOrigin?: string;
|
|
195
|
+
expectedRPID?: string;
|
|
196
|
+
}): Promise<{
|
|
197
|
+
success: true;
|
|
198
|
+
} | {
|
|
199
|
+
error: 'User not found.' | 'Field(s) cannot be empty.' | 'Verification failed.';
|
|
200
|
+
}>;
|
|
180
201
|
}
|
|
181
202
|
export default IKEAppAuthApi;
|
package/lib/Auth/index.js
CHANGED
|
@@ -445,6 +445,63 @@ var IKEAppAuthApi = /** @class */ (function (_super) {
|
|
|
445
445
|
});
|
|
446
446
|
});
|
|
447
447
|
};
|
|
448
|
+
IKEAppAuthApi.prototype.getWebAuthnAuthenticationOptions = function (body) {
|
|
449
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
450
|
+
var response;
|
|
451
|
+
return __generator(this, function (_a) {
|
|
452
|
+
switch (_a.label) {
|
|
453
|
+
case 0: return [4 /*yield*/, this.bxbFetch({
|
|
454
|
+
method: 'POST',
|
|
455
|
+
headers: {
|
|
456
|
+
'Content-Type': 'application/json',
|
|
457
|
+
},
|
|
458
|
+
body: JSON.stringify(body),
|
|
459
|
+
}, "webauthn/get-authentication-options")];
|
|
460
|
+
case 1:
|
|
461
|
+
response = _a.sent();
|
|
462
|
+
return [2 /*return*/, response.json()];
|
|
463
|
+
}
|
|
464
|
+
});
|
|
465
|
+
});
|
|
466
|
+
};
|
|
467
|
+
IKEAppAuthApi.prototype.getWebAuthnRegistrationOptions = function (body) {
|
|
468
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
469
|
+
var response;
|
|
470
|
+
return __generator(this, function (_a) {
|
|
471
|
+
switch (_a.label) {
|
|
472
|
+
case 0: return [4 /*yield*/, this.bxbFetch({
|
|
473
|
+
method: 'POST',
|
|
474
|
+
headers: {
|
|
475
|
+
'Content-Type': 'application/json',
|
|
476
|
+
},
|
|
477
|
+
body: JSON.stringify(body),
|
|
478
|
+
}, "webauthn/get-registration-options")];
|
|
479
|
+
case 1:
|
|
480
|
+
response = _a.sent();
|
|
481
|
+
return [2 /*return*/, response.json()];
|
|
482
|
+
}
|
|
483
|
+
});
|
|
484
|
+
});
|
|
485
|
+
};
|
|
486
|
+
IKEAppAuthApi.prototype.verifyWebAuthnRegistration = function (body) {
|
|
487
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
488
|
+
var response;
|
|
489
|
+
return __generator(this, function (_a) {
|
|
490
|
+
switch (_a.label) {
|
|
491
|
+
case 0: return [4 /*yield*/, this.bxbFetch({
|
|
492
|
+
method: 'POST',
|
|
493
|
+
headers: {
|
|
494
|
+
'Content-Type': 'application/json',
|
|
495
|
+
},
|
|
496
|
+
body: JSON.stringify(body),
|
|
497
|
+
}, "webauthn/verify-registration")];
|
|
498
|
+
case 1:
|
|
499
|
+
response = _a.sent();
|
|
500
|
+
return [2 /*return*/, response.json()];
|
|
501
|
+
}
|
|
502
|
+
});
|
|
503
|
+
});
|
|
504
|
+
};
|
|
448
505
|
return IKEAppAuthApi;
|
|
449
506
|
}(bxb_api_1.default));
|
|
450
507
|
exports.default = IKEAppAuthApi;
|
package/lib/Auth/type.d.ts
CHANGED
|
@@ -103,4 +103,16 @@ export declare type SignInPhoneBiometrics = (provider: 'phone-biometrics', form:
|
|
|
103
103
|
} | {
|
|
104
104
|
error: 'Authentication error.' | 'Field(s) cannot be empty.' | 'id not found.' | 'Sign in to turn on biometrics.' | 'New device login requires password credentials.' | 'signature error.' | 'URL not found.';
|
|
105
105
|
}>;
|
|
106
|
-
export declare type
|
|
106
|
+
export declare type SignInPhoneWebAuthn = (provider: 'phone-webauthn', form: {
|
|
107
|
+
phone: string;
|
|
108
|
+
authResp: any;
|
|
109
|
+
expectedOrigin?: string;
|
|
110
|
+
expectedRPID?: string;
|
|
111
|
+
csrfToken?: string;
|
|
112
|
+
}) => Promise<{
|
|
113
|
+
id: string;
|
|
114
|
+
idVerified: Date | null;
|
|
115
|
+
} | {
|
|
116
|
+
error: 'Authentication error.' | 'Field(s) cannot be empty.' | 'User not found.' | 'Authenticator not found.' | 'Authentication verification failed.';
|
|
117
|
+
}>;
|
|
118
|
+
export declare type SignIn = SignInEmailPassword | SignInGoogleIos | SignInGoogleAndroid | SignInFacebookMobile | SignInAppleMobile | SignInEmailBiometrics | SignInKyc | SignInPhoneOTP | SignInPhoneBiometrics | SignInPhoneWebAuthn;
|