2.0.5 • Published 4 years ago

hesabe-crypt v2.0.5

Weekly downloads
27
License
ISC
Repository
-
Last release
4 years ago

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);
2.0.5

4 years ago

2.0.3

4 years ago

2.0.4

4 years ago

2.0.2

4 years ago

2.0.1

4 years ago

2.0.0

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago