Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nestrx/aes-gcm
The module encryption AES GCM for NestJS framework.
https://github.com/nestrx/aes-gcm
aes-encryption aes-gcm md5 nestjs
Last synced: 7 days ago
JSON representation
The module encryption AES GCM for NestJS framework.
- Host: GitHub
- URL: https://github.com/nestrx/aes-gcm
- Owner: nestrx
- License: mit
- Created: 2019-04-05T19:22:06.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-04-06T04:47:46.000Z (over 5 years ago)
- Last Synced: 2024-10-06T16:05:29.517Z (about 1 month ago)
- Topics: aes-encryption, aes-gcm, md5, nestjs
- Language: TypeScript
- Size: 6.84 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# AES-GCM
The module encryption AES GCM for [NestJS framework](https://nestjs.com/).## Installation
npm:
```bash
npm i @nestrx/aes-gcm
```
yan
```bash
yan add @nestrx/aes-gcm
```## Configure
app.module.ts
```ts
...
@Module({
...
imports: [
...
AesGcmModule.forRoot(AES_SECRET_KEY),
...
],
...
})
...
```your.service.ts
```ts
...
@Injectable()
export class YourService{
constructor(public readonly aes: AesGcmService){
}
encrypt(text: string): string{
return this.aes.encrypt(text);
}
decryption(encrypted: string): string{
return this.aes.decrypt(encrypted);
}
md5(text: string): string{
return this.aes.md5(text);
}
// Generate AES_SECRET_KEY or the random string base64
generate(){
console.log(this.aes.generateRandomKey());
}
}
...
```