@nestrx/aes-gcm
TypeScript icon, indicating that this package has built-in type declarations

0.0.4 • Public • Published

AES-GCM

The module encryption AES GCM for NestJS framework.

Installation

npm:

npm i @nestrx/aes-gcm

yan

yan add @nestrx/aes-gcm

Configure

app.module.ts

...
@Module({
	...
	imports: [
		...
		AesGcmModule.forRoot(AES_SECRET_KEY),
		...
	],
	...
})
...

your.service.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());
	}
}
...

Readme

Keywords

none

Package Sidebar

Install

npm i @nestrx/aes-gcm

Weekly Downloads

16

Version

0.0.4

License

none

Unpacked Size

11.2 kB

Total Files

15

Last publish

Collaborators

  • zinzinday