mirror of
https://github.com/esiur/esiur-dart.git
synced 2025-05-06 04:02:57 +00:00
generateDC
This commit is contained in:
parent
b849c42fd8
commit
ea7764402b
@ -1,5 +1,7 @@
|
||||
import 'dart:math';
|
||||
|
||||
import '../Data/DC.dart';
|
||||
|
||||
class Global {
|
||||
static String generateCode(
|
||||
[int length = 16,
|
||||
@ -10,4 +12,11 @@ class Global {
|
||||
return String.fromCharCodes(Iterable.generate(
|
||||
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.localHeaders[IIPAuthPacketHeader.Domain] = domain;
|
||||
_session.localHeaders[IIPAuthPacketHeader.Nonce] =
|
||||
Global.generateCode(32);
|
||||
_session.localHeaders[IIPAuthPacketHeader.Nonce] = Global.generateDC(32);
|
||||
|
||||
if (method == AuthenticationMethod.Credentials) {
|
||||
_session.localHeaders[IIPAuthPacketHeader.Username] = username;
|
||||
|
Loading…
x
Reference in New Issue
Block a user