2
0
mirror of https://github.com/esiur/esiur-js.git synced 2026-04-04 05:58:22 +00:00
This commit is contained in:
2024-06-22 16:12:35 +03:00
parent c0e31662b7
commit 408d2237f4
8 changed files with 390 additions and 90 deletions

View File

@@ -30,6 +30,7 @@
import IIPAuthPacketCommand from "./IIPAuthPacketCommand.js";
import IIPAuthPacketAction from "./IIPAuthPacketAction.js";
import AuthenticationMethod from "../../Security/Authority/AuthenticationMethod.js";
import TransmissionType from '../../Data/TransmissionType.js';
export default class IIPAuthPacket
{
@@ -52,6 +53,7 @@ export default class IIPAuthPacket
challenge = null;
asymetricEncryptionKey = null;
sessionId = null;
accountId = null;
dataType = null;
@@ -300,7 +302,7 @@ export default class IIPAuthPacket
} else if (this.event == IIPAuthPacketEvent.IndicationEstablished) {
if (this.#notEnough(offset, ends, 1))
if (this.#notEnough(offset, ends, 2))
return -this.#dataLengthNeeded;
let sessionLength = data[offset++];
@@ -311,6 +313,19 @@ export default class IIPAuthPacket
this.sessionId = data.clip(offset, sessionLength);
offset += sessionLength;
if (this.#notEnough(offset, ends, 1))
return -this.#dataLengthNeeded;
let accountLength = data[offset++];
if (this.#notEnough(offset, ends, accountLength))
return -this.#dataLengthNeeded;
this.accountId = data.clip(offset, accountLength);
offset += accountLength;
} else if (this.event == IIPAuthPacketEvent.IAuthPlain ||
this.event == IIPAuthPacketEvent.IAuthHashed ||

View File

@@ -1,22 +1,24 @@
import { UInt8 } from "../../Data/ExtendedTypes.js";
// IIPAuthPacketHeader
export default {
Version: 0,
Domain: 1,
SupportedAuthentications: 2,
SupportedHashAlgorithms: 3,
SupportedCiphers: 4,
SupportedCompression: 5,
SupportedPersonalAuth: 6,
Nonce: 7,
Username: 8,
TokenIndex: 9,
CertificateId: 10,
CachedCertificates: 11,
CipherType: 12,
CipherKey: 13,
SoftwareIdentity: 14,
Referrer: 15,
Time: 16,
Certificate: 17,
IPv4: 18
Version: new UInt8(0),
Domain: new UInt8(1),
SupportedAuthentications: new UInt8(2),
SupportedHashAlgorithms: new UInt8(3),
SupportedCiphers: new UInt8(4),
SupportedCompression: new UInt8(5),
SupportedPersonalAuth: new UInt8(6),
Nonce: new UInt8(7),
Username: new UInt8(8),
TokenIndex: new UInt8(9),
CertificateId: new UInt8(10),
CachedCertificates: new UInt8(11),
CipherType: new UInt8(12),
CipherKey: new UInt8(13),
SoftwareIdentity: new UInt8(14),
Referrer: new UInt8(15),
Time: new UInt8(16),
Certificate: new UInt8(17),
IPv4: new UInt8(18)
}