public static KeyShareEntry Parse(MemoryCursor cursor) { var group = NamedGroup.Parse(cursor); var key = ByteVector.SliceVectorBytes(cursor, 0..ushort.MaxValue); return(new KeyShareEntry(group, key)); }
public static MemoryBuffer Slice(MemoryCursor cursor, Range range) { var payload = ExtensionLength.Slice(cursor); using (payload.SetCursor(cursor)) { return(ByteVector.SliceVectorBytes(cursor, range)); } }
public static ReadOnlyMemory <byte> Slice(ReadOnlyMemory <byte> bytes, Range range, out ReadOnlyMemory <byte> afterPayloadBytes) { var payload = ExtensionLength.Slice(bytes, out afterPayloadBytes); var vectorBytes = ByteVector.SliceVectorBytes(payload, range, out var afterVectorBytes); if (!afterVectorBytes.IsEmpty) { throw new EncodingException(); } return(vectorBytes); }