application/docIssue.js
/**
 * Adds issuer data to the block.
 * @param {BeanUser} issuer User as issuer role.
 * @param {BeanDataBlock} blockData Data block with the set of process information.
 */
Adds issuer data to the block.
@param {BeanUser} issuer User as issuer role.
@param {BeanDataBlock} blockData Data block with the set of process information.
Adds issuer data to the block . @param { BeanUser } issuer User as issuer role . @param { BeanDataBlock } blockData Data block with the set of process information .
async function processToAddIssuer(issuer, blockData) {
    issuer = await BeanUser.generateSignatureOfUserInfos(issuer);
    let recipientsHash = blockData.recipientsHash;
    let recipientsHashSigned = await EccUtil.signMessage(issuer, recipientsHash);
    blockData.setRecipientsHashSignedByIssuer(recipientsHashSigned);
    let dateTimeIssue = new Date();
    blockData.setDateTimeIssue(dateTimeIssue.toISOString());
    let hashFactory = createHash();
    let dateTimeIssueHash = hashFactory.update(blockData.dateTimeIssue).digest(hex);
    let dateTimeSignedByIssuer = await EccUtil.signMessage(issuer, dateTimeIssueHash);
    blockData.setDateTimeSignedByIssuer(dateTimeSignedByIssuer);
    blockData.setStatus(BeanDataBlock.getBlockState().ISSUED);
    let issuerPersona = BeanUser.createBeanUser(issuer);
    issuerPersona.clearSecurityData();
    blockData.setIssuer(issuerPersona);
    let merkleRootIssuer = BeanDataBlock.calculateMerkleRootIssuer(blockData);
    logWrite('[processToAddIssuer] MerkleRootIssuer = ' + merkleRootIssuer);
    blockData.setMerkleRootIssuer(merkleRootIssuer);
    return blockData;
}
async function processToAddIssuer ( issuer , blockData ) { issuer = await BeanUser . generateSignatureOfUserInfos ( issuer ) ; let recipientsHash = blockData . recipientsHash ; let recipientsHashSigned = await EccUtil . signMessage ( issuer , recipientsHash ) ; blockData . setRecipientsHashSignedByIssuer ( recipientsHashSigned ) ; let dateTimeIssue = new Date ( ) ; blockData . setDateTimeIssue ( dateTimeIssue . toISOString ( ) ) ; let hashFactory = createHash ( ) ; let dateTimeIssueHash = hashFactory . update ( blockData . dateTimeIssue ) . digest ( hex ) ; let dateTimeSignedByIssuer = await EccUtil . signMessage ( issuer , dateTimeIssueHash ) ; blockData . setDateTimeSignedByIssuer ( dateTimeSignedByIssuer ) ; blockData . setStatus ( BeanDataBlock . getBlockState ( ) . ISSUED ) ; let issuerPersona = BeanUser . createBeanUser ( issuer ) ; issuerPersona . clearSecurityData ( ) ; blockData . setIssuer ( issuerPersona ) ; let merkleRootIssuer = BeanDataBlock . calculateMerkleRootIssuer ( blockData ) ; logWrite ( '[processToAddIssuer] MerkleRootIssuer = ' + merkleRootIssuer ) ; blockData . setMerkleRootIssuer ( merkleRootIssuer ) ; return blockData ; }
Adds issuer data to the block.
Adds issuer data to the block .
/*
     * Issuer signs the hash generated from the concatenation of Recipient identifiers
     * The signature on this hash guarantees to Validator that the recipients were chosen by Issuer
     */ // Validator + Recipient will have to validate this signature on the hash // Get the system date-time to use in the information block /*
    * The date and time must be signed by Issuer to avoid forgery.
    * Recipient will have to validate this signature over the date hash.
    */ // Validation date-time signed // Set status to ISSUED // Prevents the private dataset from being inside the user's data // Calculates the hash for the Issuer's merkle root // Issuer's block merkle root