lib/utils/xml-utils.js
function setProtectedValues(node, protectSaltGenerator) {
    traverse(node, function(node) {
        if (strToBoolean(node.getAttribute(XmlNames.Attr.Protected))) {
            try {
                var value = ByteUtils.arrayToBuffer(ByteUtils.base64ToBytes(node.textContent));
                if (value.byteLength) {
                    var salt = protectSaltGenerator.getSalt(value.byteLength);
                    node.protectedValue = new ProtectedValue(value, salt);
                }
            } catch (e) {
                throw new KdbxError(Consts.ErrorCodes.FileCorrupt, 'bad protected value at line ' +
                node.lineNumber + ': ' + e);
            }
        }
    });
}
function setProtectedValues(node, protectSaltGenerator) {
    traverse(node, function(node) {
        if (strToBoolean(node.getAttribute(XmlNames.Attr.Protected))) {
            try {
                var value = ByteUtils.arrayToBuffer(ByteUtils.base64ToBytes(node.textContent));
                if (value.byteLength) {
                    var salt = protectSaltGenerator.getSalt(value.byteLength);
                    node.protectedValue = new ProtectedValue(value, salt);
                }
            } catch (e) {
                throw new KdbxError(Consts.ErrorCodes.FileCorrupt, 'bad protected value at line ' +
                node.lineNumber + ': ' + e);
            }
        }
    });
}
function setProtectedValues ( node , protectSaltGenerator ) { traverse ( node , function ( node ) { if ( strToBoolean ( node . getAttribute ( XmlNames . Attr . Protected ) ) ) { try { var value = ByteUtils . arrayToBuffer ( ByteUtils . base64ToBytes ( node . textContent ) ) ; if ( value . byteLength ) { var salt = protectSaltGenerator . getSalt ( value . byteLength ) ; node . protectedValue = new ProtectedValue ( value , salt ) ; } } catch ( e ) { throw new KdbxError ( Consts . ErrorCodes . FileCorrupt , 'bad protected value at line ' + node . lineNumber + ': ' + e ) ; } } } ) ; }
Reads protected values for all nodes in tree
@param {Node} node
@param {ProtectSaltGenerator} protectSaltGenerator
Reads protected values for all nodes in tree