src/IpfsService.js
/**
    * Updates a node into the IPFS tree 
    *
    * @param   {String}     ipfsHash               ipfs tree location    
    * @param   {String}     search                 target node  
    * @param   {String}     data                   new data   
    * @returns {String}                            The location of the saved tree on IPFS
    */
Updates a node into the IPFS tree
@param   {String}     ipfsHash               ipfs tree location
@param   {String}     search                 target node
@param   {String}     data                   new data
@returns {String}                            The location of the saved tree on IPFS
Updates a node into the IPFS tree @param { String } ipfsHash ipfs tree location @param { String } search target node @param { String } data new data @returns { String } The location of the saved tree on IPFS
async updateNode(ipfsHash, search, data, publicKey) {
        const salt = String.fromCharCode.apply(null, Crypto.randomBytes(32))
        const dataPayload = { data , salt }
        const encryptedPayload = await Crypto.encrypt(publicKey, JSON.stringify(dataPayload))
        const dataHash = Crypto.sha3_256(data+salt)
        const dataIpfsHash = await this.saveObject(encryptedPayload)
        const tree = await this.getObject(ipfsHash)
        IdentityDag.updateNode(tree, search, dataIpfsHash, dataHash)
        return await this.saveObject(tree)
    }
async updateNode ( ipfsHash , search , data , publicKey ) { const salt = String . fromCharCode . apply ( null , Crypto . randomBytes ( 32 ) ) const dataPayload = { data , salt } const encryptedPayload = await Crypto . encrypt ( publicKey , JSON . stringify ( dataPayload ) ) const dataHash = Crypto . sha3_256 ( data + salt ) const dataIpfsHash = await this . saveObject ( encryptedPayload ) const tree = await this . getObject ( ipfsHash ) IdentityDag . updateNode ( tree , search , dataIpfsHash , dataHash ) return await this . saveObject ( tree ) }
Updates a node into the IPFS tree
 @param   {String}     ipfsHash               ipfs tree location
 @param   {String}     search                 target node
 @param   {String}     data                   new data
 @returns {String}                            The location of the saved tree on IPFS
Updates a node into the IPFS tree @param { String } ipfsHash ipfs tree location @param { String } search target node @param { String } data new data @returns { String } The location of the saved tree on IPFS