mirror of
https://github.com/esiur/esiur-dart.git
synced 2025-05-06 12:02:57 +00:00
generateDC
This commit is contained in:
parent
b849c42fd8
commit
ea7764402b
@ -1,5 +1,7 @@
|
|||||||
import 'dart:math';
|
import 'dart:math';
|
||||||
|
|
||||||
|
import '../Data/DC.dart';
|
||||||
|
|
||||||
class Global {
|
class Global {
|
||||||
static String generateCode(
|
static String generateCode(
|
||||||
[int length = 16,
|
[int length = 16,
|
||||||
@ -10,4 +12,11 @@ class Global {
|
|||||||
return String.fromCharCodes(Iterable.generate(
|
return String.fromCharCodes(Iterable.generate(
|
||||||
length, (_) => chars.codeUnitAt(rand.nextInt(chars.length))));
|
length, (_) => chars.codeUnitAt(rand.nextInt(chars.length))));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static DC generateDC(int length) {
|
||||||
|
var rand = Random();
|
||||||
|
var rt = DC(length);
|
||||||
|
for (var i = 0; i < length; i++) rt.setInt8(i, rand.nextInt(255));
|
||||||
|
return rt;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -302,8 +302,7 @@ class DistributedConnection extends NetworkConnection implements IStore {
|
|||||||
_session.remoteMethod = AuthenticationMethod.None;
|
_session.remoteMethod = AuthenticationMethod.None;
|
||||||
|
|
||||||
_session.localHeaders[IIPAuthPacketHeader.Domain] = domain;
|
_session.localHeaders[IIPAuthPacketHeader.Domain] = domain;
|
||||||
_session.localHeaders[IIPAuthPacketHeader.Nonce] =
|
_session.localHeaders[IIPAuthPacketHeader.Nonce] = Global.generateDC(32);
|
||||||
Global.generateCode(32);
|
|
||||||
|
|
||||||
if (method == AuthenticationMethod.Credentials) {
|
if (method == AuthenticationMethod.Credentials) {
|
||||||
_session.localHeaders[IIPAuthPacketHeader.Username] = username;
|
_session.localHeaders[IIPAuthPacketHeader.Username] = username;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user