iron-crypto-pkg
v1.0.63
Published
JavaScript library of crypto standards.
Downloads
472
Readme
iron-crypto-pkg
JavaScript library of crypto standards.
Node.js (Install)
Requirements:
- Node.js
- npm (Node.js package manager)
npm install iron-crypto-pkgUsage
AES Encryption Using CBC
import { encryptCBC } from 'iron-crypto-pkg';
async encryption() {
let encryptedValue: string = await encryptCBC('Encrypted value which you want to encrypt', 'secret key 123', 'secret iv 123');
console.log(encryptedValue);
}AES Decryption Using CBC
import { decryptCBC } from 'iron-crypto-pkg';
async decryption() {
let decryptedValue: string = await decryptCBC('Encrypted value which you want to decrypt', 'secret key 123', 'secret iv 123');
console.log(decryptedValue);
}SHA 512 Hash
import { sha512Hash } from 'iron-crypto-pkg';
async convertHash() {
let hash: string = await sha512Hash('Value for which you want to create a SHA512 hash');
console.log(hash);
}Get Session Headers
import { getSessionHeaders } from 'iron-crypto-pkg';
async getSessionHeaders() {
let headers: any = await getSessionHeaders('secret key 123', 'secret iv 123');
console.log(headers);
}AES Encryption Using GCM
This will generate dynamic IV for AES encryption and attach the IV and its length with encryption data.
import { encryptGCM } from 'iron-crypto-pkg';
async encryption() {
let encryptedValue: string = await encryptGCM('Encrypted value which you want to encrypt', 'encryption key 123');
console.log(encryptedValue);
}AES Decryption Using GCM
This will fetch the IV from the encrypted value and decrypt it using the fetched IV.
import { decryptGCM } from 'iron-crypto-pkg';
async decryption() {
let decryptedValue: string = await decryptGCM('Encrypted value which you want to decrypt', 'encryption key 123');
console.log(decryptedValue);
}import { generateSessionHeaders } from 'iron-crypto-pkg';
async generateSessionHeaders() {
let headers: any = await generateSessionHeaders('secret key 123', 'domain name', 'encryption key');
console.log(headers);
}