mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-10 19:28:51 +00:00
Chore: Export Cli login interface
This commit is contained in:
@@ -11,7 +11,7 @@ import SecurityClient from "./SecurityClient";
|
||||
// eslint-disable-next-line new-cap
|
||||
const client = new jsrp.client();
|
||||
|
||||
interface IsCliLoginSuccessful {
|
||||
export interface IsCliLoginSuccessful {
|
||||
mfaEnabled: boolean;
|
||||
loginResponse?: {
|
||||
email: string;
|
||||
@@ -27,18 +27,15 @@ interface IsCliLoginSuccessful {
|
||||
* @param {string} email - email of user to log in
|
||||
* @param {string} password - password of user to log in
|
||||
*/
|
||||
const attemptLogin = async (
|
||||
{
|
||||
const attemptLogin = async ({
|
||||
email,
|
||||
password,
|
||||
providerAuthToken,
|
||||
providerAuthToken
|
||||
}: {
|
||||
email: string;
|
||||
password: string;
|
||||
providerAuthToken?: string;
|
||||
}
|
||||
): Promise<IsCliLoginSuccessful> => {
|
||||
|
||||
}): Promise<IsCliLoginSuccessful> => {
|
||||
const telemetry = new Telemetry().getInstance();
|
||||
return new Promise((resolve, reject) => {
|
||||
client.init(
|
||||
@@ -52,7 +49,7 @@ const attemptLogin = async (
|
||||
const { serverPublicKey, salt } = await login1({
|
||||
email,
|
||||
clientPublicKey,
|
||||
providerAuthToken,
|
||||
providerAuthToken
|
||||
});
|
||||
|
||||
client.setSalt(salt);
|
||||
@@ -70,13 +67,11 @@ const attemptLogin = async (
|
||||
encryptedPrivateKey,
|
||||
iv,
|
||||
tag
|
||||
} = await login2(
|
||||
{
|
||||
} = await login2({
|
||||
email,
|
||||
clientProof,
|
||||
providerAuthToken,
|
||||
}
|
||||
);
|
||||
providerAuthToken
|
||||
});
|
||||
if (mfaEnabled) {
|
||||
// case: MFA is enabled
|
||||
|
||||
@@ -135,8 +130,7 @@ const attemptLogin = async (
|
||||
JTWToken: token
|
||||
},
|
||||
success: true
|
||||
})
|
||||
|
||||
});
|
||||
}
|
||||
} catch (err) {
|
||||
reject(err);
|
||||
|
||||
Reference in New Issue
Block a user