#28 - CompleteDiffieHandshakeEvent added

This commit is contained in:
oobjectt 2022-12-25 19:28:30 +01:00
parent 26741b78a7
commit dcd6927079
6 changed files with 57 additions and 1 deletions

File diff suppressed because one or more lines are too long

View File

@ -414,4 +414,5 @@ export class IncomingHeader
public static SHOW_ENFORCE_ROOM_CATEGORY = 3896;
public static CUSTOM_USER_NOTIFICATION = 909;
public static NEW_USER_EXPERIENCE_GIFT_OFFER = 3575;
public static HANDSHAKE_COMPLETE_DIFFIE = 3885;
}

View File

@ -0,0 +1,16 @@
import { IMessageEvent } from '../../../../../api';
import { MessageEvent } from '../../../../../events';
import { CompleteDiffieHandshakeParser } from '../../parser';
export class CompleteDiffieHandshakeEvent extends MessageEvent implements IMessageEvent
{
constructor(callBack: Function)
{
super(callBack, CompleteDiffieHandshakeParser);
}
public getParser(): CompleteDiffieHandshakeParser
{
return this.parser as CompleteDiffieHandshakeParser;
}
}

View File

@ -1 +1,2 @@
export * from './CompleteDiffieHandshakeEvent';
export * from './NoobnessLevelMessageEvent';

View File

@ -0,0 +1,36 @@
import { IMessageDataWrapper, IMessageParser } from '../../../../../api';
export class CompleteDiffieHandshakeParser implements IMessageParser
{
private _encryptedPublicKey: string = null;
private _serverClientEncryption: boolean = false;
public flush(): boolean
{
return true;
}
public parse(wrapper: IMessageDataWrapper): boolean
{
if(!wrapper) return false;
this._encryptedPublicKey = wrapper.readString();
if(wrapper.bytesAvailable)
{
this._serverClientEncryption = wrapper.readBoolean();
}
return true;
}
public get encryptedPublicKey(): string
{
return this._encryptedPublicKey;
}
public get serverClientEncryption(): boolean
{
return this._serverClientEncryption;
}
}

View File

@ -1 +1,2 @@
export * from './CompleteDiffieHandshakeParser';
export * from './NoobnessLevelMessageParser';