2
0
mirror of https://github.com/esiur/esiur-js.git synced 2026-04-03 21:48:21 +00:00
This commit is contained in:
2020-11-15 04:26:20 +03:00
parent a00b366d30
commit ec143272ae
20 changed files with 263 additions and 9499 deletions

View File

@@ -29,7 +29,7 @@
import IIPAuthPacketCommand from "./IIPAuthPacketCommand.js";
import IIPAuthPacketAction from "./IIPAuthPacketAction.js";
import IIPAuthPacketMethod from "./IIPAuthPacketMethod.js";
import AuthenticationMethod from "../../Security/Authority/AuthenticationMethod.js";
export default class IIPAuthPacket
{
@@ -138,9 +138,9 @@ export default class IIPAuthPacket
offset += domainLength;
if (this.remoteMethod == IIPAuthPacketMethod.Credentials)
if (this.remoteMethod == AuthenticationMethod.Credentials)
{
if (this.localMethod == IIPAuthPacketMethod.None)
if (this.localMethod == AuthenticationMethod.None)
{
if (this.notEnough(offset, ends, 33))
return -this.dataLengthNeeded;
@@ -160,6 +160,21 @@ export default class IIPAuthPacket
offset += length;
}
}
else if (this.remoteMethod == AuthenticationMethod.Token)
{
if (this.localMethod == AuthenticationMethod.None)
{
if (this.notEnough(offset, ends, 40))
return -this.dataLengthNeeded;
this.remoteNonce = data.clip(offset, 32);
offset += 32;
this.remoteTokenIndex = data.getUint64(offset);
offset += 8;
}
}
if (encrypt)
{
@@ -188,9 +203,10 @@ export default class IIPAuthPacket
return -this.dataLengthNeeded;
if (this.remoteMethod == IIPAuthPacketMethod.Credentials)
if (this.remoteMethod == AuthenticationMethod.Credentials
|| this.remoteMethod == AuthenticationMethod.Token)
{
if (this.localMethod == IIPAuthPacketMethod.None)
if (this.localMethod == AuthenticationMethod.None)
{
if (this.notEnough(offset, ends, 32))
return -this.dataLengthNeeded;

View File

@@ -1,7 +0,0 @@
export default //const IIPAuthPacketMethod =
{
None: 0,
Certificate: 1,
Credentials: 2,
Token: 3
};