77 lines
1.8 KiB
TypeScript
77 lines
1.8 KiB
TypeScript
import Packet from "../packet";
|
|
import Stream from "../stream";
|
|
|
|
export class PacketAvatar extends Packet {
|
|
|
|
private privateKey : string = "";
|
|
private fromPublicKey: string = "";
|
|
private toPublicKey: string = "";
|
|
private blob: string = "";
|
|
|
|
private chachaKey: string = "";
|
|
|
|
|
|
public getPacketId(): number {
|
|
return 0x0C;
|
|
}
|
|
|
|
public _receive(stream: Stream): void {
|
|
this.privateKey = stream.readString();
|
|
this.fromPublicKey = stream.readString();
|
|
this.toPublicKey = stream.readString();
|
|
this.chachaKey = stream.readString();
|
|
this.blob = stream.readString();
|
|
}
|
|
|
|
public _send(): Promise<Stream> | Stream {
|
|
const stream = new Stream();
|
|
stream.writeInt16(this.getPacketId());
|
|
stream.writeString(this.privateKey);
|
|
stream.writeString(this.fromPublicKey);
|
|
stream.writeString(this.toPublicKey);
|
|
stream.writeString(this.chachaKey);
|
|
stream.writeString(this.blob);
|
|
return stream;
|
|
}
|
|
|
|
public setFromPublicKey(fromPublicKey: string): void {
|
|
this.fromPublicKey = fromPublicKey;
|
|
}
|
|
|
|
public setToPublicKey(toPublicKey: string): void {
|
|
this.toPublicKey = toPublicKey;
|
|
}
|
|
|
|
public getFromPublicKey(): string {
|
|
return this.fromPublicKey;
|
|
}
|
|
|
|
public getToPublicKey(): string {
|
|
return this.toPublicKey;
|
|
}
|
|
|
|
public setPrivateKey(hash: string): void {
|
|
this.privateKey = hash;
|
|
}
|
|
|
|
public getPrivateKey(): string {
|
|
return this.privateKey;
|
|
}
|
|
|
|
public setBlob(blob: string): void {
|
|
this.blob = blob;
|
|
}
|
|
|
|
public getBlob(): string {
|
|
return this.blob;
|
|
}
|
|
|
|
public setChachaKey(key: string): void {
|
|
this.chachaKey = key;
|
|
}
|
|
|
|
public getChachaKey(): string {
|
|
return this.chachaKey;
|
|
}
|
|
|
|
} |