hesabe-crypt

2.0.5 • Public • Published

hesabe-crypt

Encryption library for Hesabe Payment API 2.0

NPM Version

Install

npm i -S hesabe-crypt

Dependencies

A depency for this package aes-js will also get installed automatically and usage of that is shown below.

Usage

After installing this library you may import the Hesabe Crypt class.

import hesabeCrypt from "hesabe-crypt";

You need to import aes-js also.

import aesjs from "aes-js";

You need to have a secret and an iv code to use this package.

Before starting encryption, you need to convert your secret and iv in bytes mentioned below:

let secret = 'XXXXX'        // Secret provided by Hesabe
let ivCode = 'XXXXX'        // IV provided by Hesabe
 
key = aesjs.utils.utf8.toBytes(secret);
iv = aesjs.utils.utf8.toBytes(ivKey);

You first need to initialise an intance of hesabeCrypt class and pass the key and iv while doing it.

let instance = new hesabeCrypt(key, iv);

You can now call the methods of hesabeCrypt.

let text = 'XXXXX';           // Any random text
let encrypted = instance.encryptAes(text);
 
let decrypted = instance.decryptAes(encrypted);
 

Package Sidebar

Install

npm i hesabe-crypt

Weekly Downloads

24

Version

2.0.5

License

ISC

Unpacked Size

3.2 kB

Total Files

4

Last publish

Collaborators

  • fkhan.hesabe