SecuredConnection constructor

SecuredConnection(
  1. TransportConn _connection,
  2. SecretKey _encryptionKey,
  3. SecretKey _decryptionKey, {
  4. PeerId? establishedRemotePeer,
  5. PublicKey? establishedRemotePublicKey,
  6. required String securityProtocolId,
  7. int initialSendNonce = 0,
  8. int initialRecvNonce = 0,
})

Implementation

SecuredConnection(
  this._connection,
  this._encryptionKey,
  this._decryptionKey, {
  this.establishedRemotePeer,
  this.establishedRemotePublicKey,
  required this.securityProtocolId, // Make it required
  int initialSendNonce = 0,
  int initialRecvNonce = 0,
})  : _sendNonce = initialSendNonce,
      _recvNonce = initialRecvNonce {
  // ADDED LOGGING
  _log.finer(
      'SecuredConnection Constructor: Peer ${establishedRemotePeer?.toString() ?? 'unknown'}, initialSendNonce=$initialSendNonce, initialRecvNonce=$initialRecvNonce');
  _log.finer('  - _encryptionKey.hashCode: ${_encryptionKey.hashCode}');
  _encryptionKey
      .extractBytes()
      .then((bytes) => _log.finer('  - _encryptionKey.bytes: $bytes'));
  _log.finer('  - _decryptionKey.hashCode: ${_decryptionKey.hashCode}');
  _decryptionKey
      .extractBytes()
      .then((bytes) => _log.finer('  - _decryptionKey.bytes: $bytes'));
}