MFA support

This commit is contained in:
Casper Warden
2022-05-06 12:20:50 +01:00
parent e658e459f3
commit f49acfec35
9 changed files with 178 additions and 58 deletions

17
lib/classes/LoginError.ts Normal file
View File

@@ -0,0 +1,17 @@
export class LoginError extends Error
{
public reason: string;
public message_id: string;
public constructor(err: {
login: 'false',
reason: string,
message: string,
message_id: string
})
{
super(err.message);
this.reason = err.reason;
this.message_id = err.message_id;
}
}

View File

@@ -5,4 +5,6 @@ export class LoginParameters
password: string;
start = 'last';
url = 'https://login.agni.lindenlab.com/cgi-bin/login.cgi';
token?: string;
mfa_hash?: string;
}

View File

@@ -37,6 +37,7 @@ export class LoginResponse
'moonTextureID'?: UUID,
} = {};
searchToken: string;
mfaHash?: string;
clientEvents: ClientEvents;
private static toRegionHandle(x_global: number, y_global: number): Long
@@ -121,7 +122,6 @@ export class LoginResponse
this.clientEvents = clientEvents;
this.agent = new Agent(this.clientEvents);
this.region = new Region(this.agent, this.clientEvents, options);
if (json['agent_id'])
{
this.agent.agentID = new UUID(json['agent_id']);
@@ -218,6 +218,9 @@ export class LoginResponse
}
}
break;
case 'mfa_hash':
this.mfaHash = String(val);
break;
case 'search_token':
this.searchToken = String(val);
break;