Bug fixes
- floCrypto.validateAddr: bech default=true - floCloudAPI: proxyID - commented coinjs api vars
This commit is contained in:
parent
8a211be849
commit
2b8e77b5f7
@ -221,7 +221,7 @@ In addition, we have these system variables outside FLO Globals but used globall
|
||||
`validateAddr` check if the given Address (any blockchain) is valid or not
|
||||
1. address - address to validate
|
||||
2. std - checks for legacy version (optional, default=true) (true: allow any, array: list of versions, value: one version only, false: allow none)
|
||||
3. bech - checks for bech version (optional, default=false) (true: allow any, array: list of versions, value: one version only, false: allow none) [requires additional library: [btc_api](https://ranchimall.github.io/btc-webwallet/lib_btc.js)]
|
||||
3. bech - checks for bech version (optional, default=true) (true: allow any, array: list of versions, value: one version only, false: allow none)
|
||||
* Returns : boolen (true or false)
|
||||
|
||||
#### Validate FLO ID
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
(function(EXPORTS) { //floCloudAPI v2.4.2
|
||||
(function(EXPORTS) { //floCloudAPI v2.4.2a
|
||||
/* FLO Cloud operations to send/request application data*/
|
||||
'use strict';
|
||||
const floCloudAPI = EXPORTS;
|
||||
@ -217,7 +217,7 @@
|
||||
if (_inactive.size === kBucket.list.length)
|
||||
return reject('Cloud offline');
|
||||
if (!(snID in supernodes))
|
||||
snID = kBucket.closestNode(snID);
|
||||
snID = kBucket.closestNode(proxyID(snID));
|
||||
ws_connect(snID)
|
||||
.then(node => resolve(node))
|
||||
.catch(error => {
|
||||
@ -255,7 +255,7 @@
|
||||
if (_inactive.size === kBucket.list.length)
|
||||
return reject('Cloud offline');
|
||||
if (!(snID in supernodes))
|
||||
snID = kBucket.closestNode(snID);
|
||||
snID = kBucket.closestNode(proxyID(snID));
|
||||
fetch_API(snID, data)
|
||||
.then(result => resolve(result))
|
||||
.catch(error => {
|
||||
@ -370,11 +370,11 @@
|
||||
|
||||
const filterKey = util.filterKey = function(type, options) {
|
||||
return type + (options.comment ? ':' + options.comment : '') +
|
||||
'|' + (options.group || toFloID(options.receiverID) || DEFAULT.adminID) +
|
||||
'|' + (options.group || options.receiverID || DEFAULT.adminID) +
|
||||
'|' + (options.application || DEFAULT.application);
|
||||
}
|
||||
|
||||
const toFloID = util.toFloID = function(address) {
|
||||
const proxyID = util.proxyID = function(address) {
|
||||
if (!address)
|
||||
return;
|
||||
var bytes;
|
||||
@ -390,7 +390,7 @@
|
||||
hash[0] != checksum[0] || hash[1] != checksum[1] || hash[2] != checksum[2] || hash[3] != checksum[3] ?
|
||||
bytes = undefined : bytes.shift();
|
||||
} else if (address.length == 42 || address.length == 62) { //bech encoding
|
||||
if (!(coinjs instanceof Object))
|
||||
if (typeof coinjs !== 'function')
|
||||
throw "library missing (lib_btc.js)";
|
||||
let decode = coinjs.bech32_decode(address);
|
||||
if (decode) {
|
||||
@ -519,7 +519,7 @@
|
||||
return new Promise((resolve, reject) => {
|
||||
var data = {
|
||||
senderID: user.id,
|
||||
receiverID: toFloID(options.receiverID) || DEFAULT.adminID,
|
||||
receiverID: options.receiverID || DEFAULT.adminID,
|
||||
pubKey: user.public,
|
||||
message: encodeMessage(message),
|
||||
time: Date.now(),
|
||||
@ -540,7 +540,7 @@
|
||||
const requestApplicationData = floCloudAPI.requestApplicationData = function(type, options = {}) {
|
||||
return new Promise((resolve, reject) => {
|
||||
var request = {
|
||||
receiverID: toFloID(options.receiverID) || DEFAULT.adminID,
|
||||
receiverID: options.receiverID || DEFAULT.adminID,
|
||||
senderID: options.senderID || undefined,
|
||||
application: options.application || DEFAULT.application,
|
||||
type: type,
|
||||
@ -645,7 +645,7 @@
|
||||
if (!floGlobals.subAdmins.includes(user.id))
|
||||
return reject("Only subAdmins can tag data")
|
||||
var request = {
|
||||
receiverID: toFloID(options.receiverID) || DEFAULT.adminID,
|
||||
receiverID: options.receiverID || DEFAULT.adminID,
|
||||
requestorID: user.id,
|
||||
pubKey: user.public,
|
||||
time: Date.now(),
|
||||
@ -664,7 +664,7 @@
|
||||
floCloudAPI.noteApplicationData = function(vectorClock, note, options = {}) {
|
||||
return new Promise((resolve, reject) => {
|
||||
var request = {
|
||||
receiverID: toFloID(options.receiverID) || DEFAULT.adminID,
|
||||
receiverID: options.receiverID || DEFAULT.adminID,
|
||||
requestorID: user.id,
|
||||
pubKey: user.public,
|
||||
time: Date.now(),
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
(function(EXPORTS) { //floCrypto v2.3.2a
|
||||
(function(EXPORTS) { //floCrypto v2.3.2b
|
||||
/* FLO Crypto Operators */
|
||||
'use strict';
|
||||
const floCrypto = EXPORTS;
|
||||
@ -209,7 +209,7 @@
|
||||
}
|
||||
|
||||
//Check if the given address (any blockchain) is valid or not
|
||||
floCrypto.validateAddr = function(address, std = true, bech = false) {
|
||||
floCrypto.validateAddr = function(address, std = true, bech = true) {
|
||||
if (address.length == 34) { //legacy or segwit encoding
|
||||
if (std === false)
|
||||
return false;
|
||||
|
||||
5
lib.js
5
lib.js
@ -1,4 +1,4 @@
|
||||
(function(GLOBAL) { //lib v1.3.0
|
||||
(function(GLOBAL) { //lib v1.3.0a
|
||||
'use strict';
|
||||
/* Utility Libraries required for Standard operations
|
||||
* All credits for these codes belong to their respective creators, moderators and owners.
|
||||
@ -6312,11 +6312,12 @@
|
||||
/* other vars */
|
||||
coinjs.developer = '33tht1bKDgZVxb39MnZsWa8oxHXHvUYE4G'; //bitcoin
|
||||
|
||||
/* bit(coinb.in) api vars */
|
||||
/* bit(coinb.in) api vars
|
||||
coinjs.hostname = ((document.location.hostname.split(".")[(document.location.hostname.split(".")).length - 1]) == 'onion') ? 'coinbin3ravkwb24f7rmxx6w3snkjw45jhs5lxbh3yfeg3vpt6janwqd.onion' : 'coinb.in';
|
||||
coinjs.host = ('https:' == document.location.protocol ? 'https://' : 'http://') + coinjs.hostname + '/api/';
|
||||
coinjs.uid = '1';
|
||||
coinjs.key = '12345678901234567890123456789012';
|
||||
*/
|
||||
|
||||
/* start of address functions */
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user