Files
desktop/app/providers/ProtocolProvider/protocol/packets/packet.read.ts
rosetta 83f38dc63f 'init'
2026-01-30 05:01:05 +02:00

52 lines
1.3 KiB
TypeScript

import Packet from "../packet";
import Stream from "../stream";
export class PacketRead extends Packet {
private privateKey : string = "";
private fromPublicKey: string = "";
private toPublicKey: string = "";
public getPacketId(): number {
return 0x07;
}
public _receive(stream: Stream): void {
this.privateKey = stream.readString();
this.fromPublicKey = stream.readString();
this.toPublicKey = stream.readString();
}
public _send(): Stream {
const stream = new Stream();
stream.writeInt16(this.getPacketId());
stream.writeString(this.privateKey);
stream.writeString(this.fromPublicKey);
stream.writeString(this.toPublicKey);
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(privateKey: string): void {
this.privateKey = privateKey;
}
public getPrivateKey(): string {
return this.privateKey;
}
}