2016-02-06 24 views
1

我不熟悉CommonJS的概念,所以我的策略是根本錯誤..使用加密JS(CommonJS的)鈦

我想用CryptoJS.HMAC()和CryptoJS.SHA256鈦

我已經從here下載了CryptoJS v3.1.2.zip。

然後複製Resources/CryptJS /下的所有文件。

然後我在core.js

return C; 
}(Math)); 

module.export = CryptoJS; //add this line 
現在

在我app.js

var CryptoJS = require('./CryptoJS/components/core'); 

CryptoJS.HMAC(CryptoJS.SHA256, dateStamp, testKey, { asBytes: true}); 

添加最後一行但它顯示了

undefined is not a function錯誤,當我打電話CryptoJS.HMAC ()

我可以幫忙嗎?

回答

0

嘗試添加sexport,所以就變成:

module.exports = CryptoJS; //add this line