public static byte[] SaveStateAsByteArray(this MicroRatchetContext mr) { if (mr == null) { throw new ArgumentNullException(nameof(mr)); } using var ms = new MemoryStream(); mr.SaveState(ms); return(ms.ToArray()); }
public static byte[] Send(this MicroRatchetContext mrc, byte[] payload, int offset, int length) => mrc.Send(new ArraySegment <byte>(payload, offset, length));
public static byte[] Send(this MicroRatchetContext mrc, byte[] payload) => mrc.Send(new ArraySegment <byte>(payload));