Beispiel #1
0
        public byte[] GetBytes(ExposureKeySetContentArgs content)
        {
            if (content == null)
            {
                throw new ArgumentNullException(nameof(content));
            }

            var result = new TemporaryExposureKeyExport
            {
                Region         = content.Region,
                BatchNum       = content.BatchNum,
                BatchSize      = content.BatchSize,
                EndTimestamp   = content.EndTimestamp,
                StartTimestamp = content.StartTimestamp,
                SignatureInfos = { content.SignatureInfos.Select(Map).ToArray() },
                Keys           = { content.Keys.Select(Map).ToArray() },
            };
            var buffer = result.ToByteArray();

            var headerBytes = Encoding.UTF8.GetBytes(content.Header);
            var stream      = new MemoryStream();

            stream.Write(headerBytes);
            stream.Write(buffer);
            return(stream.ToArray());
        }
        public byte[] GetBytes(ExposureKeySetContentArgs content)
        {
            var result = new TemporaryExposureKeyExport
            {
                Region         = content.Region,
                BatchNum       = content.BatchNum,
                BatchSize      = content.BatchSize,
                EndTimestamp   = content.EndTimestamp,
                StartTimestamp = content.StartTimestamp,
                //Header = content.Header,
                SignatureInfos = { content.SignatureInfos.Select(Map).ToArray() },
                Keys           = { content.Keys.Select(Map).ToArray() },
            };

            return(result.ToByteArray());
        }
        public byte[] GetBytes(ExposureKeySetContentArgs content)
        {
            var result = new TemporaryExposureKeyExport
            {
                Region         = content.Region,
                BatchNum       = content.BatchNum,
                BatchSize      = content.BatchSize,
                EndTimestamp   = content.EndTimestamp,
                StartTimestamp = content.StartTimestamp,
                SignatureInfos = { content.SignatureInfos.Select(Map).ToArray() },
                Keys           = { content.Keys.Select(Map).ToArray() },
                //NOT IN THE GENERATED PROTOBUF Header = content.Header,
            };
            var buffer = result.ToByteArray();

            var headerBytes = Encoding.UTF8.GetBytes(content.Header);
            var stream      = new MemoryStream();

            stream.Write(headerBytes);
            stream.Write(buffer);
            return(stream.ToArray());
        }