crypto mechanisum for encrypt and decrypt data in NBFC Data Security eco-system
npm install crypto-datajs
const encNdesc = require('crypto-data');
`
Usage #
FI DATA ENC N DESC ##
Note: all functions promised based functions so either you can use await or then to handle the response.
#### FIU Generate ECDH keys ####
`js
let ECDHkeypair= await encNdesc.enc.generateKeyMaterial(eccUrl);
/**
* eccUrl = ECC base Url [default is http://localhost:8111]
*/
`
#### FIP Encryption ####
`js
let encryptedData=await encNdesc.FIPEncryption(id, Data, fiuKeyMaterialData, eccUrl);
/**
* id= fip ID
* Data= FI Data
* fiuKeyMaterialData= his KeyMaterial
* eccUrl = ECC base Url
*/
Note : we can use all Encryption functions calling by encNdesc.enc
`
#### FIU Decryption ####
`js
let decryptedFIUData=await encNdesc.dataDecrypt(cipher,hisKeyMaterial, myScrtKey,fiuNonce, eccUrl);
/**
* cipher= encrypted Data
* fiuKeyMaterialData= his KeyMaterial
* myScrtKey= my ECDH privateKey
* fiuNonce = my random 32-byte BASE64 string
* opts = optional parameters Object
*/
Note : iv id depricated. need not pass iv as params inrenally it will took from cipher.
``