fb-crypto-sdk

1.0.8 • Public • Published

ElGamal Encryption

###Implementation

To use the ElGamal encryption, the corresponding cryptographic module can be used. To set it up, the following steps should be taken:

1. Install the module: `npm i fb-crypto-sdk`

2. Import  ElGamal encryption function from  the initial code:
    `import {processElGamalEncryption} from 'fb-crypto-sdk';`

3. Set the following parameters:
    `const serverUrl = 'https://apollowallet.org'` is an actual APOLLO server to requests sending.
    `const secretPhrase = HERE_IS_MY_SECRET` is user’s secret phrase.

4. Calculate the ElGamal encrypted passphrase:
    `const passphrase = await processElGamalEncryption(serverUrl, secretPhrase)`

Remark: Once the package is installed, the related files are located at node_modules/fb-crypto-sdk. processElGamalEncryption routine is located there, in index.js file.

###Request sending

To send a request to the Apollo server, it is necessary to insert a passphrase (passphrase value, see above) to the corresponding HTTP(S) POST request.

Alternatively, the fetch js-method can be used as follows:

fetch(serverUrl + '/apl?requestType=sendMoney&secretPhrase=' + passphrase + '&recipient=APL-ХХХ-ХХХ-ХХХ&amountATM =111111111&feeATM=100000000&deadline=1440')

The resented example creates and sends a POST request to a specified APOLLO server.

Reed-Solomon Encryption

###Implementation

To use the Reed-Solomon encryption, the corresponding cryptographic module can be used. To set it up, the following steps should be taken:

1. Install the module: `npm i fb-crypto-sdk`

2. Import Reed-Solomon encryption functions from  the initial code:
    `import {processAccountIDtoRS, processAccountRStoID} from 'fb-crypto-sdk';`

3. Usage:
    `const accountRS = processAccountIDtoRS(accountID)` where `accountID` is user's account id. This function will return account RS value like APL-XXXX-XXXX-XXXX-XXXXX
    `const accountID = processAccountRStoID(accountRS)` where `accountRS` is user's account like APL-XXXX-XXXX-XXXX-XXXXX. This function will return account id.

Readme

Keywords

none

Package Sidebar

Install

npm i fb-crypto-sdk

Weekly Downloads

1

Version

1.0.8

License

ISC

Unpacked Size

3 MB

Total Files

23

Last publish

Collaborators

  • ellina.kolisnichenko