Exemplo n.º 1
0
        public bool AddPhysicianRights(string patientAddress, string physicianAddress, string physicianToAdd, string signature)
        {
            MultiChain chain    = new MultiChain();
            var        verified = chain.VerifyMessage(patientAddress, signature, physicianAddress) == "true";

            if (verified)
            {
                var        result     = chain.GetStreamItemByKey(patientAddress, authorisation);
                StreamItem streamitem = new StreamItem();

                if (result.streamitems.Any())
                {
                    streamitem = result.streamitems.Last();
                }

                var data = streamitem.data.Any() ? this.DeEncryptHexData(streamitem.data) : string.Empty;
                data += this.EncryptHexData((data.Any() ? ";" : string.Empty) + physicianAddress);
                var transactionId = chain.PublishMessage(authorisation, data);

                return(true);
            }

            return(false);
        }