Ionic 3 - Use jsencrypt
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 ?
angularjs typescript ionic-framework ionic3
add a comment |
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 ?
angularjs typescript ionic-framework ionic3
prem,pem-- typo?
– Saravana
Jul 5 '17 at 9:29
That's true ...
– TuxxyDOS
Jul 5 '17 at 9:30
Do you know how it this function work ?
– TuxxyDOS
Jul 5 '17 at 9:31
1
Please check this : stackoverflow.com/questions/44887294/rsa-library-with-angular/…
– Yatin patel
Jul 7 '17 at 10:07
add a comment |
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 ?
angularjs typescript ionic-framework ionic3
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 ?
angularjs typescript ionic-framework ionic3
angularjs typescript ionic-framework ionic3
asked Jul 5 '17 at 9:25
TuxxyDOS
80111
80111
prem,pem-- typo?
– Saravana
Jul 5 '17 at 9:29
That's true ...
– TuxxyDOS
Jul 5 '17 at 9:30
Do you know how it this function work ?
– TuxxyDOS
Jul 5 '17 at 9:31
1
Please check this : stackoverflow.com/questions/44887294/rsa-library-with-angular/…
– Yatin patel
Jul 7 '17 at 10:07
add a comment |
prem,pem-- typo?
– Saravana
Jul 5 '17 at 9:29
That's true ...
– TuxxyDOS
Jul 5 '17 at 9:30
Do you know how it this function work ?
– TuxxyDOS
Jul 5 '17 at 9:31
1
Please check this : stackoverflow.com/questions/44887294/rsa-library-with-angular/…
– Yatin patel
Jul 7 '17 at 10:07
prem, pem -- typo?– Saravana
Jul 5 '17 at 9:29
prem, pem -- typo?– Saravana
Jul 5 '17 at 9:29
That's true ...
– TuxxyDOS
Jul 5 '17 at 9:30
That's true ...
– TuxxyDOS
Jul 5 '17 at 9:30
Do you know how it this function work ?
– TuxxyDOS
Jul 5 '17 at 9:31
Do you know how it this function work ?
– TuxxyDOS
Jul 5 '17 at 9:31
1
1
Please check this : stackoverflow.com/questions/44887294/rsa-library-with-angular/…
– Yatin patel
Jul 7 '17 at 10:07
Please check this : stackoverflow.com/questions/44887294/rsa-library-with-angular/…
– Yatin patel
Jul 7 '17 at 10:07
add a comment |
4 Answers
4
active
oldest
votes
When using the Ionic service your app sends your plain password to the Ionic with service when creating and logging into your account. The auth service will handling all the encryption.
Also, there are no separate docs for Ionic 3 as it is essential the same as Ionic 2 except for some new features and big fixes. There are a few breaking changes but not many. It's not a full rewrite like there was going from Ionic 1 -> Ionic 2 and they are now using semantic versioning so major releases will be more regular similar to Angular.
add a comment |
Change the line
encrypt.setPublicKey(this.pem);
To
encrypt.setPublicKey(this.prem);
add a comment |
change
private prem: string = `my_key`;
to
`private pre: string = `my_key`;
add a comment |
change the line
private prem: string = `my_key`;
to
private pem: string = `my_key`;
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f44922157%2fionic-3-use-jsencrypt%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
4 Answers
4
active
oldest
votes
4 Answers
4
active
oldest
votes
active
oldest
votes
active
oldest
votes
When using the Ionic service your app sends your plain password to the Ionic with service when creating and logging into your account. The auth service will handling all the encryption.
Also, there are no separate docs for Ionic 3 as it is essential the same as Ionic 2 except for some new features and big fixes. There are a few breaking changes but not many. It's not a full rewrite like there was going from Ionic 1 -> Ionic 2 and they are now using semantic versioning so major releases will be more regular similar to Angular.
add a comment |
When using the Ionic service your app sends your plain password to the Ionic with service when creating and logging into your account. The auth service will handling all the encryption.
Also, there are no separate docs for Ionic 3 as it is essential the same as Ionic 2 except for some new features and big fixes. There are a few breaking changes but not many. It's not a full rewrite like there was going from Ionic 1 -> Ionic 2 and they are now using semantic versioning so major releases will be more regular similar to Angular.
add a comment |
When using the Ionic service your app sends your plain password to the Ionic with service when creating and logging into your account. The auth service will handling all the encryption.
Also, there are no separate docs for Ionic 3 as it is essential the same as Ionic 2 except for some new features and big fixes. There are a few breaking changes but not many. It's not a full rewrite like there was going from Ionic 1 -> Ionic 2 and they are now using semantic versioning so major releases will be more regular similar to Angular.
When using the Ionic service your app sends your plain password to the Ionic with service when creating and logging into your account. The auth service will handling all the encryption.
Also, there are no separate docs for Ionic 3 as it is essential the same as Ionic 2 except for some new features and big fixes. There are a few breaking changes but not many. It's not a full rewrite like there was going from Ionic 1 -> Ionic 2 and they are now using semantic versioning so major releases will be more regular similar to Angular.
edited Jul 9 '17 at 15:46
answered Jul 9 '17 at 1:17
Jack
75911018
75911018
add a comment |
add a comment |
Change the line
encrypt.setPublicKey(this.pem);
To
encrypt.setPublicKey(this.prem);
add a comment |
Change the line
encrypt.setPublicKey(this.pem);
To
encrypt.setPublicKey(this.prem);
add a comment |
Change the line
encrypt.setPublicKey(this.pem);
To
encrypt.setPublicKey(this.prem);
Change the line
encrypt.setPublicKey(this.pem);
To
encrypt.setPublicKey(this.prem);
answered Feb 22 at 17:08
Che'-Andre Gordon
311
311
add a comment |
add a comment |
change
private prem: string = `my_key`;
to
`private pre: string = `my_key`;
add a comment |
change
private prem: string = `my_key`;
to
`private pre: string = `my_key`;
add a comment |
change
private prem: string = `my_key`;
to
`private pre: string = `my_key`;
change
private prem: string = `my_key`;
to
`private pre: string = `my_key`;
answered Jun 4 at 14:29
zouhair
867
867
add a comment |
add a comment |
change the line
private prem: string = `my_key`;
to
private pem: string = `my_key`;
add a comment |
change the line
private prem: string = `my_key`;
to
private pem: string = `my_key`;
add a comment |
change the line
private prem: string = `my_key`;
to
private pem: string = `my_key`;
change the line
private prem: string = `my_key`;
to
private pem: string = `my_key`;
answered Nov 21 at 7:16
Siundu254
114
114
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f44922157%2fionic-3-use-jsencrypt%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
prem,pem-- typo?– Saravana
Jul 5 '17 at 9:29
That's true ...
– TuxxyDOS
Jul 5 '17 at 9:30
Do you know how it this function work ?
– TuxxyDOS
Jul 5 '17 at 9:31
1
Please check this : stackoverflow.com/questions/44887294/rsa-library-with-angular/…
– Yatin patel
Jul 7 '17 at 10:07