async Task <MDataInfo> GetNewMd() { using (var permissionsHandle = await _session.MDataPermissions.NewAsync().ConfigureAwait(false)) { using (var appSignPkH = await _session.Crypto.AppPubSignKeyAsync().ConfigureAwait(false)) { await _session.MDataPermissions.InsertAsync(permissionsHandle, appSignPkH, _networkOps.GetFullPermissions()).ConfigureAwait(false); } var md = await _session.MDataInfoActions.RandomPublicAsync(16001).ConfigureAwait(false); await _session.MData.PutAsync(md, permissionsHandle, NativeHandle.Zero).ConfigureAwait(false); // <---------------------------------------------- Commit ------------------------ return(md); } }
async Task <(byte[], ulong)> MdLocator(Session session, bool pub = false) { var networkOps = new Network.NetworkDataOps(session); using (var permissionsHandle = await session.MDataPermissions.NewAsync()) { using (var appSignPkH = await session.Crypto.AppPubSignKeyAsync()) { await session.MDataPermissions.InsertAsync(permissionsHandle, appSignPkH, networkOps.GetFullPermissions()); } var md = pub ? await session.MDataInfoActions.RandomPublicAsync(16001) : await session.MDataInfoActions.RandomPrivateAsync(16001); await session.MData.PutAsync(md, permissionsHandle, NativeHandle.Zero); // <---------------------------------------------- Commit ------------------------ return(md.Name, md.TypeTag); } }