application/ClientUtil.js
/**
     * 
     * @param {BeanDataBlock} blockData Data block with the set of process information.
     */
@param {BeanDataBlock} blockData Data block with the set of process information.
@param { BeanDataBlock } blockData Data block with the set of process information .
async validateValidatorDateTime(blockData) {
        let validator = blockData.validator;
        let dateTimeValidate = blockData.dateTimeValidate;
        var diffDateOK = false;
        diffDateOK = EccUtil.isBeginDateLowerEndDate(dateTimeValidate, new Date());
        if (!diffDateOK) {
            let msgError = 'Actual date is lower than validated date';
            logWrite(`[validateValidatorDateTime] Message: ${msgError}`);
            throw msgError;
        }
        let hashFactory = this.createHash();
        let dateTimeValidateHash = hashFactory.update(dateTimeValidate.toString()).digest(hex);
        let dateTimeSignedByValidator = blockData.dateTimeSignedByValidator;
        let verifyHashDateTimeValidate = false;
        verifyHashDateTimeValidate = EccUtil.verifyMessageSigned(dateTimeValidateHash, dateTimeSignedByValidator, validator);
        if (!verifyHashDateTimeValidate) {
            let msgError = 'Date-Time Data Incorrect. Validator Publick Key Not Validated';
            logWrite(`[validateValidatorDateTime] Message: ${msgError}`);
            throw msgError;
        }
        logWrite('[validateValidatorDateTime] Date-Time Data Ckecked');
        return verifyHashDateTimeValidate;
    }
async validateValidatorDateTime ( blockData ) { let validator = blockData . validator ; let dateTimeValidate = blockData . dateTimeValidate ; var diffDateOK = false ; diffDateOK = EccUtil . isBeginDateLowerEndDate ( dateTimeValidate , new Date ( ) ) ; if ( ! diffDateOK ) { let msgError = 'Actual date is lower than validated date' ; logWrite ( ` ${ msgError } ` ) ; throw msgError ; } let hashFactory = this . createHash ( ) ; let dateTimeValidateHash = hashFactory . update ( dateTimeValidate . toString ( ) ) . digest ( hex ) ; let dateTimeSignedByValidator = blockData . dateTimeSignedByValidator ; let verifyHashDateTimeValidate = false ; verifyHashDateTimeValidate = EccUtil . verifyMessageSigned ( dateTimeValidateHash , dateTimeSignedByValidator , validator ) ; if ( ! verifyHashDateTimeValidate ) { let msgError = 'Date-Time Data Incorrect. Validator Publick Key Not Validated' ; logWrite ( ` ${ msgError } ` ) ; throw msgError ; } logWrite ( '[validateValidatorDateTime] Date-Time Data Ckecked' ) ; return verifyHashDateTimeValidate ; }
@param {BeanDataBlock} blockData Data block with the set of process information.
@param { BeanDataBlock } blockData Data block with the set of process information .
//stop here; // A data e hora deve ser assinada pelo Validator para evitar falsificação // Recipient terá que validar essa assinatura //Data e Hora -> Validar --------------------------------------- //stop here; // Date-Time: OK ---------------------------------------