From d7f1d215dde008b33cf610e62dd1e7cc220bf408 Mon Sep 17 00:00:00 2001 From: Sai Raj <39055732+sairajzero@users.noreply.github.com> Date: Sun, 29 Sep 2019 22:04:11 +0530 Subject: [PATCH 1/3] Update README.md --- README.md | 86 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) diff --git a/README.md b/README.md index d2a77ba..1f8bd33 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,88 @@ # Standard_Operations Standard operations required for FLO Crypto, Blockchain API, Supernode WS, IndexedDB + +This template contains standard operations that can be used for the following: +1. FLO Globals +2. FLO Crypto Operations +3. FLO Blockchain API Operations +4. FLO SuperNode Websocket Operations +5. compact IndexedDB Operations + +## FLO Globals +`floGlobals` object contains the global variables and constants required for the operations. Make sure to add this object before any other scripts. +`floGlobals` contains the following properties : +1. `blockchain` : Indicates the blockchain (`"FLO"` or `"FLO_TEST"`). +2. `apiURL` : Indicates the URL for blockchain API calls. +3. `adminID` : Indicates the master admin FLO ID for the project. +4. `sendAmt` : Indicates the default flo amount to be sent while sending transactions into the blockchain +5. `fee` : Indicates the default fee amount to be deduced while sending transactions into the blockchain +6. `supernodes` : Holder for the supernode list. Can be updated in runtime while retriving data from blockchain using API. Stored in the Object format, + + { + : { + uri : + ...(otherProperties) + } + ...(Other Supernodes) + } + +## FLO Crypto Operations +`floCrypto` operations can be used to perform blockchain-cryptography methods. `floCrypto` operations are synchronized and return a value. Contains the following Operations. +#### Generate New FLO ID pair + floCrypto.generateNewID() + `generateNewID` generates a new flo ID and returns private-key, public-key and floID + +#### Calculate Public Key Hex + floCrypto.getPubKeyHex(privateKey) +`getPubKeyHex` returns public-key from given private-key +Arguments : +1. privateKey - private key in WIF format (Hex) + +#### Calculate FLO ID + floCrypto.getFloIDfromPubkeyHex(publicKey) +`getFloIDfromPubkeyHex` returns flo-ID from public-key +Arguments : +1. publicKey - public key hex value + +#### Verify Private Key + floCrypto.verifyPrivKey(privateKey, pubKey_floID, *isfloID) +`verifyPrivKey` verify the private-key for the given public-key or flo-ID +Arguments : +1. privateKey - private key in WIF format (Hex) +2. pubKey_floID - public Key or flo ID +3. isfloID - boolean value (true - compare as flo ID, false - compare as public key) (optional, default is true) + +#### Validate FLO ID + floCrypto.validateAddr(floID) +`validateAddr` check if the given Address is valid or not +Arguments : +1. floID - flo ID to validate + +#### Data Encryption + floCrypto.encryptData(data, publicKey) +`encryptData` encrypts the given data using public-key +Arguments : +1. data - data to encrypt +2. publicKey - public key of the recipient + +#### Data Decryption + floCrypto.decryptData(data, privateKey) +`decryptData` decrypts the given data using private-key +Arguments : +1. data - encrypted data to decrypt (Object that was returned from encryptData) +2. privateKey - private key of the recipient + +#### Sign Data + floCrypto.signData(data, privateKey) +`signData` signs the data using the private key +Arguments : +1. data - data to sign +2. privateKey - private key of the signer + +#### Verify Signature + floCrypto.decryptData(data, signature, publicKey) +`decryptData` verifies signatue of the data using public-key +Arguments : +1. data - data of the given signature +2. signature - signature of the data +3. publicKey - public key of the signer From e2948b1db565f8490002bbf8ff266f88f9b8315e Mon Sep 17 00:00:00 2001 From: Sai Raj <39055732+sairajzero@users.noreply.github.com> Date: Sun, 29 Sep 2019 22:07:01 +0530 Subject: [PATCH 2/3] Update README.md --- README.md | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/README.md b/README.md index 1f8bd33..0115093 100644 --- a/README.md +++ b/README.md @@ -33,21 +33,18 @@ This template contains standard operations that can be used for the following: `generateNewID` generates a new flo ID and returns private-key, public-key and floID #### Calculate Public Key Hex - floCrypto.getPubKeyHex(privateKey) `getPubKeyHex` returns public-key from given private-key -Arguments : + floCrypto.getPubKeyHex(privateKey) 1. privateKey - private key in WIF format (Hex) #### Calculate FLO ID floCrypto.getFloIDfromPubkeyHex(publicKey) `getFloIDfromPubkeyHex` returns flo-ID from public-key -Arguments : 1. publicKey - public key hex value #### Verify Private Key floCrypto.verifyPrivKey(privateKey, pubKey_floID, *isfloID) `verifyPrivKey` verify the private-key for the given public-key or flo-ID -Arguments : 1. privateKey - private key in WIF format (Hex) 2. pubKey_floID - public Key or flo ID 3. isfloID - boolean value (true - compare as flo ID, false - compare as public key) (optional, default is true) @@ -55,34 +52,29 @@ Arguments : #### Validate FLO ID floCrypto.validateAddr(floID) `validateAddr` check if the given Address is valid or not -Arguments : 1. floID - flo ID to validate #### Data Encryption floCrypto.encryptData(data, publicKey) `encryptData` encrypts the given data using public-key -Arguments : 1. data - data to encrypt 2. publicKey - public key of the recipient #### Data Decryption floCrypto.decryptData(data, privateKey) `decryptData` decrypts the given data using private-key -Arguments : 1. data - encrypted data to decrypt (Object that was returned from encryptData) 2. privateKey - private key of the recipient #### Sign Data floCrypto.signData(data, privateKey) `signData` signs the data using the private key -Arguments : 1. data - data to sign 2. privateKey - private key of the signer #### Verify Signature floCrypto.decryptData(data, signature, publicKey) `decryptData` verifies signatue of the data using public-key -Arguments : 1. data - data of the given signature 2. signature - signature of the data 3. publicKey - public key of the signer From 268ffe4197aa866deb01a3132d1692207723c37a Mon Sep 17 00:00:00 2001 From: Sai Raj <39055732+sairajzero@users.noreply.github.com> Date: Thu, 3 Oct 2019 00:20:20 +0530 Subject: [PATCH 3/3] Update index.html --- index.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/index.html b/index.html index 29d0b25..3f8a7d1 100644 --- a/index.html +++ b/index.html @@ -82,9 +82,9 @@ /* FLO Crypto Operators*/ const floCrypto = { - //p: BigInteger("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F", 16), + p: BigInteger("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F", 16), - //ecparams: EllipticCurve.getSECCurveByName("secp256k1"), + ecparams: EllipticCurve.getSECCurveByName("secp256k1"), exponent1: function () { return this.p.add(BigInteger.ONE).divide(BigInteger("4")) @@ -5933,4 +5933,4 @@ } }; - \ No newline at end of file +