establish static method
Establishes a session from root. thisNodeIsLow must be true on the
side whose node id sorts first, so the two sides pick opposite send /
receive chains.
Implementation
static RatchetSession establish({
required List<int> root,
required bool thisNodeIsLow,
required Cipher Function(List<int> key) cipherFactory,
}) {
final low =
hkdfSha256(root, const [], _ascii('passnote-ratchet-chain-low'), 32);
final high =
hkdfSha256(root, const [], _ascii('passnote-ratchet-chain-high'), 32);
return RatchetSession._(
_Chain(thisNodeIsLow ? low : high),
_Chain(thisNodeIsLow ? high : low),
cipherFactory,
);
}