application/docValidate.js
/**
 * Adds validator data to the block.
 * @param {BeanUser} validator User as validator role.
 * @param {BeanDataBlock} blockData Data block with the set of process information.Data block with the set of process information. 
 */
Adds validator data to the block.
@param {BeanUser} validator User as validator role.
@param {BeanDataBlock} blockData Data block with the set of process information.Data block with the set of process information.
Adds validator data to the block . @param { BeanUser } validator User as validator role . @param { BeanDataBlock } blockData Data block with the set of process information . Data block with the set of process information .
async function processToAddValidator(validator, blockData) {
    validator = await BeanUser.generateSignatureOfUserInfos(validator);
    let recipientsHash = blockData.recipientsHash;
    let recipientsHashSigned = await EccUtil.signMessage(validator, recipientsHash);
    blockData.setRecipientsHashSignedByValidator(recipientsHashSigned);
    let dateTimeValidate = new Date();
    blockData.setDateTimeValidate(dateTimeValidate.toISOString());
    let hashFactory = createHash();
    let dateTimeValidateHash = hashFactory.update(blockData.dateTimeValidate).digest(hex);
    let dateTimeSignedByValidator = await EccUtil.signMessage(validator, dateTimeValidateHash);
    blockData.setDateTimeSignedByValidator(dateTimeSignedByValidator);
    blockData.setStatus(BeanDataBlock.getBlockState().VALIDATED);
    let validatorPersona = BeanUser.createBeanUser(validator);
    validatorPersona.clearSecurityData();
    blockData.setValidator(validatorPersona);
    let merkleRootValidator = BeanDataBlock.calculateMerkleRootValidator(blockData);
    logWrite('[processToAddValidator] MerkleRootValidator = ' + merkleRootValidator);
    blockData.setMerkleRootValidator(merkleRootValidator);
    return blockData;
}
async function processToAddValidator ( validator , blockData ) { validator = await BeanUser . generateSignatureOfUserInfos ( validator ) ; let recipientsHash = blockData . recipientsHash ; let recipientsHashSigned = await EccUtil . signMessage ( validator , recipientsHash ) ; blockData . setRecipientsHashSignedByValidator ( recipientsHashSigned ) ; let dateTimeValidate = new Date ( ) ; blockData . setDateTimeValidate ( dateTimeValidate . toISOString ( ) ) ; let hashFactory = createHash ( ) ; let dateTimeValidateHash = hashFactory . update ( blockData . dateTimeValidate ) . digest ( hex ) ; let dateTimeSignedByValidator = await EccUtil . signMessage ( validator , dateTimeValidateHash ) ; blockData . setDateTimeSignedByValidator ( dateTimeSignedByValidator ) ; blockData . setStatus ( BeanDataBlock . getBlockState ( ) . VALIDATED ) ; let validatorPersona = BeanUser . createBeanUser ( validator ) ; validatorPersona . clearSecurityData ( ) ; blockData . setValidator ( validatorPersona ) ; let merkleRootValidator = BeanDataBlock . calculateMerkleRootValidator ( blockData ) ; logWrite ( '[processToAddValidator] MerkleRootValidator = ' + merkleRootValidator ) ; blockData . setMerkleRootValidator ( merkleRootValidator ) ; return blockData ; }
Adds validator data to the block.
Adds validator data to the block .
/*
     * Validator signs the hash generated from the concatenation of recipient identifiers.
     * The signature on this hash guarantees to the inspector that the recipients were chosen by Validator
     */ // Validator + Recipient will have to validate this signature on the hash // Get the system date-time to use in the information block /**
     * The date-time must be signed by the Validator to avoid tampering.
     * Reader will have to validate that signature on the date-time's hash.
     */ // Validation date-time signed by the Validator // Set status to VALIDATED // Prevents the private dataset from being inside the user's data // Calculates the hash for the merkle root in the data registered by the Validator // Validator block merkle root