Exemplo n.º 1
0
        private static async Task <Stream> CreateRawStreamAsync(Cid id,
                                                                IBlockApi blockService,
                                                                CancellationToken cancel)
        {
            var block = await blockService.GetAsync(id, cancel).ConfigureAwait(false);

            return(block.DataStream);
        }
Exemplo n.º 2
0
        static async Task <Stream> CreateRawStreamAsync(
            Cid id,
            IBlockApi blockService,
            KeyChain keyChain,
            CancellationToken cancel)
        {
            var block = await blockService.GetAsync(id, cancel);

            return(block.DataStream);
        }
Exemplo n.º 3
0
        private static async Task <Stream> CreateCmsStreamAsync(Cid id,
                                                                IBlockApi blockService,
                                                                IKeyApi keyChain,
                                                                CancellationToken cancel)
        {
            var block = await blockService.GetAsync(id, cancel).ConfigureAwait(false);

            var plain = await keyChain.ReadProtectedDataAsync(block.DataBytes, cancel).ConfigureAwait(false);

            return(new MemoryStream(plain, false));
        }
Exemplo n.º 4
0
        public async Task <IDagNode> GetAsync(Cid id, CancellationToken cancel = default)
        {
            var block = await _blockApi.GetAsync(id, cancel).ConfigureAwait(false);

            return(new DagNode(block.DataStream));
        }