I'm trying to hash my passwords for login on my Ionic 3 app. I found some tutorial about jsencrypt but it doesn't work and i don't really understand how it work...
Here what i did :
npm install --save jsencrypt
import { Component } from '@angular/core';
import { NavController } from 'ionic-angular';
import { ApiDatabaseService } from '../../providers/api-database-service';
import Encrypt from 'jsencrypt';
import { Injectable } from '@angular/core';
@Component({
selector: 'page-Login',
templateUrl: 'Login.html'
})
@Injectable()
export class LoginPage {
private prem: string = `my_key`;
Users:any = []; // Here there is all my users
constructor(public navCtrl: NavController, public serviceOne: ApiDatabaseService) {
this.serviceOne.getDataUser().subscribe( // I'm calling my api to acces to my database
data => this.Users = data
);
}
public create(name: string): string { // Here the password should be encrypt
let encrypt = new Encrypt.JSEncrypt();
encrypt.setPublicKey(this.pem);
return encrypt.encrypt(name);
};
}
And i have this error :
Typescript Error
Property 'pem' does not exist on type 'LoginPage'.
Also, for Ionic 2 there is many documentation like this : https://docs.ionic.io/services/auth/. But nothing for Ionic 3, why ?