0
如何在ionic2打字稿文件中加密密碼。我引用了下面的鏈接並將pbkdf2模塊導入到ionic2應用程序中。 enter link description here在ionic2中使用pbkdf2-sha256加密密碼
但我得到了像錯誤webpack_require。我(...)是不是一個function.can誰能幫我解決了這個...
import { Component } from '@angular/core';
import { NavController, NavParams } from 'ionic-angular';
import { pbkdf2 } from '../../../node_modules/pbkdf2-sha256/lib/pbkdf2.js';
/*
Generated class for the Firstpage page.
See http://ionicframework.com/docs/v2/components/#navigation for more info on
Ionic pages and navigation.
*/
@Component({
selector: 'page-firstpage',
templateUrl: 'firstpage.html'
})
export class FirstpagePage {
\t key : any = "passwd";
\t salt :any ="salt";
\t res :any ;
constructor(public navCtrl: NavController, public navParams: NavParams) {}
ionViewDidLoad() {
console.log('ionViewDidLoad FirstpagePage');
}
encrypt(){
console.log("-----");
\t this.res = pbkdf2(this.key, this.salt, 1, 64);
\t console.log(this.res.toString('hex'))
}
}