nl_tokens: Derived key info
pl_tokens: function deriveFromPassword ( pbkdf2Gen , password , salt , rounds , generateHMAC = true ) { if ( ! password ) { return Promise . reject ( new Error ( "Failed deriving key: Password must be provided" ) ) ; } if ( ! salt ) { return Promise . reject ( new Error ( "Failed deriving key: Salt must be provided" ) ) ; } if ( ! rounds || rounds <= 0 ) { return Promise . reject ( <mask> Error ( "Failed deriving key: Rounds must be greater than 0" ) ) ; } const bits = generateHMAC ? ( PASSWORD_KEY_SIZE + HMAC_KEY_SIZE ) * 8 : PASSWORD_KEY_SIZE * 8 ; return pbkdf2Gen ( password , salt , rounds , bits ) . then ( derivedKeyData => derivedKeyData . toString ( "hex" ) ) . then ( function ( derivedKeyHex ) { const dkhLength = derivedKeyHex . length ; const keyBuffer = generateHMAC ? new Buffer ( derivedKeyHex . substr ( 0 , dkhLength / 2 ) , "hex" ) : new Buffer ( derivedKeyHex , "hex" ) ; const output = { salt : salt , key : keyBuffer , rounds : rounds } ; if ( generateHMAC ) { output . hmac = new Buffer ( derivedKeyHex . substr ( dkhLength / 2 , dkhLength / 2 ) , "hex" ) ; } return output ; } ) ; }