예제 #1
0
        private string RegistryAddress;  // defaults to null


        ////////////////////////////////////////////////////////


        public FlabberManager()
        {
            // get token
            MyLoginManager = new LoginManager();
            Token          = MyLoginManager.GetToken();

            // check user
            MyDriveManager = new DriveManager(Token);
            Me             = MyDriveManager.GetMe().GetAwaiter().GetResult();
            if (!MyLoginManager.IsAllowed(Me))
            {
                throw new Exception("User not allowed");
            }

            MyEthManager = new EthManager();
        }
예제 #2
0
        // generates a new verification receipt for the file with the given ID
        // returns the verification result of the new receipt
        public async Task <string> VerifyFile(string fileId)
        {
            if (RegistryAddress != null)
            {
                // get file hash and metadata hash
                string fileHash = await MyDriveManager.GetFileHash(RegistryAddress, fileId);

                string metadataHash = await MyDriveManager.GetMetadataHash(RegistryAddress, fileId);

                // get name of current user
                string user = await MyDriveManager.GetMe();

                // make new receipt contract
                return(await MyEthManager.NewReceipt(RegistryAddress, fileId, fileHash, metadataHash, user));
            }

            throw new Exception("No file registry chosen");
        }