update CryptoES naming
This commit is contained in:
parent
cd2e49fba0
commit
9a0f139e7b
2 changed files with 9 additions and 9 deletions
|
|
@ -11,15 +11,15 @@ import {
|
||||||
} from '@angular/fire/firestore';
|
} from '@angular/fire/firestore';
|
||||||
import { Task } from '../interfaces/task.interface';
|
import { Task } from '../interfaces/task.interface';
|
||||||
import { User } from '../interfaces/user.interface';
|
import { User } from '../interfaces/user.interface';
|
||||||
import CryptoJS from 'crypto-es';
|
import CryptoES from 'crypto-es';
|
||||||
import { CryptoJSSecretKey } from './../environments/config';
|
import { CryptoESSecretKey } from './../environments/config';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root',
|
providedIn: 'root',
|
||||||
})
|
})
|
||||||
export class FirebaseService implements OnDestroy {
|
export class FirebaseService implements OnDestroy {
|
||||||
firestore: Firestore = inject(Firestore);
|
firestore: Firestore = inject(Firestore);
|
||||||
private secretKey: string = CryptoJSSecretKey.secretKey;
|
private secretKey: string = CryptoESSecretKey.secretKey;
|
||||||
|
|
||||||
allTasks: Task[] = [];
|
allTasks: Task[] = [];
|
||||||
filteredTasks: Task[] = [];
|
filteredTasks: Task[] = [];
|
||||||
|
|
@ -133,8 +133,8 @@ export class FirebaseService implements OnDestroy {
|
||||||
getCurrentUserId() {
|
getCurrentUserId() {
|
||||||
const encryptedValue = localStorage.getItem('currentUserJOIN');
|
const encryptedValue = localStorage.getItem('currentUserJOIN');
|
||||||
if (encryptedValue) {
|
if (encryptedValue) {
|
||||||
const bytes = CryptoJS.AES.decrypt(encryptedValue, this.secretKey);
|
const bytes = CryptoES.AES.decrypt(encryptedValue, this.secretKey);
|
||||||
const decryptedValue = bytes.toString(CryptoJS.enc.Utf8);
|
const decryptedValue = bytes.toString(CryptoES.enc.Utf8);
|
||||||
return JSON.parse(decryptedValue);
|
return JSON.parse(decryptedValue);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|
|
||||||
|
|
@ -22,8 +22,8 @@ import {
|
||||||
import { SharedService } from './shared.service';
|
import { SharedService } from './shared.service';
|
||||||
import { User } from '../interfaces/user.interface';
|
import { User } from '../interfaces/user.interface';
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
import CryptoJS from 'crypto-es';
|
import CryptoES from 'crypto-es';
|
||||||
import { CryptoJSSecretKey } from './../environments/config';
|
import { CryptoESSecretKey } from './../environments/config';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root',
|
providedIn: 'root',
|
||||||
|
|
@ -34,7 +34,7 @@ export class LoginService {
|
||||||
passwordIcon: string = './../../../assets/img/login/close-eye.svg';
|
passwordIcon: string = './../../../assets/img/login/close-eye.svg';
|
||||||
errorCode: string = '';
|
errorCode: string = '';
|
||||||
|
|
||||||
private secretKey: string = CryptoJSSecretKey.secretKey;
|
private secretKey: string = CryptoESSecretKey.secretKey;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private firebaseService: FirebaseService,
|
private firebaseService: FirebaseService,
|
||||||
|
|
@ -188,7 +188,7 @@ export class LoginService {
|
||||||
}
|
}
|
||||||
|
|
||||||
getUserIdInLocalStorage(userId: string): void {
|
getUserIdInLocalStorage(userId: string): void {
|
||||||
const encryptedValue = CryptoJS.AES.encrypt(
|
const encryptedValue = CryptoES.AES.encrypt(
|
||||||
JSON.stringify(userId),
|
JSON.stringify(userId),
|
||||||
this.secretKey
|
this.secretKey
|
||||||
).toString();
|
).toString();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue