contract/business/NotarizeOps.js
/**
     * Check if READER is inside Recipients List
     * @param {BeanDataBlock} blockData Data block with the set of process information.
     */
Check if READER is inside Recipients List
@param {BeanDataBlock} blockData Data block with the set of process information.
Check if READER is inside Recipients List @param { BeanDataBlock } blockData Data block with the set of process information .
async validateRegistryReader(blockData) {
        let issuerVerify = await this.validateIssuerBlock(blockData);
        if (issuerVerify == false) {
            let msgError = 'Issuer data is invalid inside block';
            logWrite(`[validateRegistryReader, A] Message: ${msgError}`);
            throw msgError;
        }
        logWrite('[validateRegistryReader] Issuer data is valid inside block');
        let validatedStatus = BeanDataBlock.getBlockState().VALIDATED;
        let revokedStatus = BeanDataBlock.getBlockState().REVOKED;
        var status = blockData.status;
        if ((status == validatedStatus) || (status == revokedStatus)) {
            let validatorVerify = await this.validateValidatorBlock(blockData);
            if (validatorVerify == false) {
                let msgError = 'Validator data is invalid inside block';
                logWrite(`[validateRegistryReader, B] Message: ${msgError}`);
                throw msgError;
            }
            logWrite('[validateRegistryReader] Validator data is valid inside block');
        }
        let readerInfo = blockData.reader;
        var reader = BeanUser.createBeanUser(readerInfo);
        let recipientsArray = blockData.recipients;
        let readerNotFound = true;
        for (var i = 0, size = recipientsArray.length; i < size; i++) {
            let recipient = BeanUser.createBeanUser(recipientsArray[i]);
            if ((recipient.publicId == reader.publicId) && (recipient.email == reader.email)) {
                reader.setPassword(recipient.password);
                reader.setInitVector(recipient.initVector);
                i = size;
                readerNotFound = false;
            }
        }
        if (readerNotFound) {
            let msgError = 'Reader is not in the Recipients List';
            logWrite(`[validateRegistryReader, C] Message: ${msgError}`);
            throw msgError;
        }
        blockData.setReader(reader);
        logWrite('[validateRegistryReader] Reader Is Inside Recipients List');
        return blockData;
    }
async validateRegistryReader ( blockData ) { let issuerVerify = await this . validateIssuerBlock ( blockData ) ; if ( issuerVerify == false ) { let msgError = 'Issuer data is invalid inside block' ; logWrite ( ` ${ msgError } ` ) ; throw msgError ; } logWrite ( '[validateRegistryReader] Issuer data is valid inside block' ) ; let validatedStatus = BeanDataBlock . getBlockState ( ) . VALIDATED ; let revokedStatus = BeanDataBlock . getBlockState ( ) . REVOKED ; var status = blockData . status ; if ( ( status == validatedStatus ) || ( status == revokedStatus ) ) { let validatorVerify = await this . validateValidatorBlock ( blockData ) ; if ( validatorVerify == false ) { let msgError = 'Validator data is invalid inside block' ; logWrite ( ` ${ msgError } ` ) ; throw msgError ; } logWrite ( '[validateRegistryReader] Validator data is valid inside block' ) ; } let readerInfo = blockData . reader ; var reader = BeanUser . createBeanUser ( readerInfo ) ; let recipientsArray = blockData . recipients ; let readerNotFound = true ; for ( var i = 0 , size = recipientsArray . length ; i < size ; i ++ ) { let recipient = BeanUser . createBeanUser ( recipientsArray [ i ] ) ; if ( ( recipient . publicId == reader . publicId ) && ( recipient . email == reader . email ) ) { reader . setPassword ( recipient . password ) ; reader . setInitVector ( recipient . initVector ) ; i = size ; readerNotFound = false ; } } if ( readerNotFound ) { let msgError = 'Reader is not in the Recipients List' ; logWrite ( ` ${ msgError } ` ) ; throw msgError ; } blockData . setReader ( reader ) ; logWrite ( '[validateRegistryReader] Reader Is Inside Recipients List' ) ; return blockData ; }
Check if READER is inside Recipients List
 @param {BeanDataBlock} blockData Data block with the set of process information.
Check if READER is inside Recipients List @param { BeanDataBlock } blockData Data block with the set of process information .
//stop here; //stop here; // Recupera objeto que encapsula informações do Reader // Separa o objeto do READER do restante do bloco // Obter usuario Recipient // Verifica se o Reader encontra-se no array // Encontrou o READER // Então adiciona no READER as informações para DESCRIPTOGRAFIA // stop here // Retorna com o READER para o bloco de dados