0.4.0 • Published 3 years ago
@fnx-components/crypto v0.4.0
FnxCrypto Service
A service library for encrypting and decrypting values in your angular project. This library was generated with Angular CLI
Installing
In your Angular project run
npm i --save @fnx-components/crypto
Getting Started
After installing it you need to inject the FnxCryptoService in your controller
import { FnxCryptoService } from '@fnx-components/crypto';
constructor(
...
private readonly fnxCryptoService: FnxCryptoService
) { }
then you can start encrypting and decrypting your values
// Your secret key
const secretKey = 'lANQBCf8TdBWhMHJm-IBlQ';
// Encrypt value
const encryptedValue = this.fnxCryptoService.encrypt(`Roads? Where We're Going We Don't Need Roads`, secretKey);
// Decrypted value
const encryptedValue = 'U2FsdGVkX1+HPC4KY6T9tY5dFnqc9sEVcuTXizTEfdZzdZsOq9d708EzDT0SDtepcExTy3N3BeBxaf8YpQe1Kw==';
const decryptedValue = this.fnxCryptoService.decrypt(encryptedValue, secretKey);