nl_tokens: Encrypted content components
pl_tokens: function decryptCBC ( encryptedComponents , keyDerivationInfo ) { // Extract the components const encryptedContent = encryptedComponents . content ; const <mask> = new Buffer ( encryptedComponents . iv , "hex" ) ; const salt = encryptedComponents . salt ; const hmacData = encryptedComponents . auth ; // Get HMAC tool const hmacTool = crypto . createHmac ( HMAC_ALGORITHM , keyDerivationInfo . hmac ) ; // Generate the HMAC hmacTool . update ( encryptedContent ) ; hmacTool . update ( encryptedComponents . iv ) ; hmacTool . update ( salt ) ; const newHmaxHex = hmacTool . digest ( "hex" ) ; // Check hmac for tampering if ( constantTimeCompare ( hmacData , newHmaxHex ) !== true ) { throw new Error ( "Authentication failed while decrypting content" ) ; } // Decrypt const decryptTool = crypto . createDecipheriv ( ENC_ALGORITHM_CBC , keyDerivationInfo . key , iv ) ; const decryptedText = decryptTool . update ( encryptedContent , "base64" , "utf8" ) ; return Promise . resolve ( ` ${ decryptedText } ${ decryptTool . final ( "utf8" ) } ` ) ; }