addReceiverChain method

void addReceiverChain(
  1. ECPublicKey senderRatchetKey,
  2. ChainKey chainKey
)

Implementation

void addReceiverChain(ECPublicKey senderRatchetKey, ChainKey chainKey) {
  final chainKeyStructure = SessionStructureChainChainKey.create()
    ..key = chainKey.key;

  final chain = SessionStructureChain.create()
    ..chainKey = chainKeyStructure
    ..senderRatchetKey = senderRatchetKey.serialize();

  _sessionStructure.receiverChains.add(chain);

  if (_sessionStructure.receiverChains.length > 5) {
    _sessionStructure.receiverChains.removeAt(0);
  }
}