@fileverse-dev/formulajs 4.4.11-mod-90 → 4.4.11-mod-91
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/browser/formula.js +132 -24
- package/lib/browser/formula.min.js +2 -2
- package/lib/browser/formula.min.js.map +1 -1
- package/lib/cjs/index.cjs +163 -8
- package/lib/esm/crypto-constants.mjs +143 -1
- package/lib/esm/index.mjs +163 -8
- package/package.json +2 -1
package/lib/cjs/index.cjs
CHANGED
|
@@ -18475,22 +18475,177 @@ async function SMARTCONTRACT() {
|
|
|
18475
18475
|
}
|
|
18476
18476
|
}
|
|
18477
18477
|
|
|
18478
|
-
|
|
18479
|
-
|
|
18480
|
-
|
|
18481
|
-
|
|
18478
|
+
var src = {};
|
|
18479
|
+
|
|
18480
|
+
var lib = {exports: {}};
|
|
18481
|
+
|
|
18482
|
+
/**
|
|
18483
|
+
* The code was extracted from:
|
|
18484
|
+
* https://github.com/davidchambers/Base64.js
|
|
18485
|
+
*/
|
|
18486
|
+
|
|
18487
|
+
var atob$1;
|
|
18488
|
+
var hasRequiredAtob;
|
|
18489
|
+
|
|
18490
|
+
function requireAtob () {
|
|
18491
|
+
if (hasRequiredAtob) return atob$1;
|
|
18492
|
+
hasRequiredAtob = 1;
|
|
18493
|
+
var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
|
|
18494
|
+
|
|
18495
|
+
function InvalidCharacterError(message) {
|
|
18496
|
+
this.message = message;
|
|
18497
|
+
}
|
|
18498
|
+
|
|
18499
|
+
InvalidCharacterError.prototype = new Error();
|
|
18500
|
+
InvalidCharacterError.prototype.name = 'InvalidCharacterError';
|
|
18501
|
+
|
|
18502
|
+
function polyfill (input) {
|
|
18503
|
+
var str = String(input).replace(/=+$/, '');
|
|
18504
|
+
if (str.length % 4 == 1) {
|
|
18505
|
+
throw new InvalidCharacterError("'atob' failed: The string to be decoded is not correctly encoded.");
|
|
18506
|
+
}
|
|
18507
|
+
for (
|
|
18508
|
+
// initialize result and counters
|
|
18509
|
+
var bc = 0, bs, buffer, idx = 0, output = '';
|
|
18510
|
+
// get next character
|
|
18511
|
+
buffer = str.charAt(idx++);
|
|
18512
|
+
// character found in table? initialize bit storage and add its ascii value;
|
|
18513
|
+
~buffer && (bs = bc % 4 ? bs * 64 + buffer : buffer,
|
|
18514
|
+
// and if not first of each 4 characters,
|
|
18515
|
+
// convert the first 8 bits to one ascii character
|
|
18516
|
+
bc++ % 4) ? output += String.fromCharCode(255 & bs >> (-2 * bc & 6)) : 0
|
|
18517
|
+
) {
|
|
18518
|
+
// try to find character in table (0-63, not found => -1)
|
|
18519
|
+
buffer = chars.indexOf(buffer);
|
|
18520
|
+
}
|
|
18521
|
+
return output;
|
|
18522
|
+
}
|
|
18523
|
+
|
|
18524
|
+
|
|
18525
|
+
atob$1 = typeof window !== 'undefined' && window.atob && window.atob.bind(window) || polyfill;
|
|
18526
|
+
return atob$1;
|
|
18527
|
+
}
|
|
18528
|
+
|
|
18529
|
+
var base64_url_decode;
|
|
18530
|
+
var hasRequiredBase64_url_decode;
|
|
18531
|
+
|
|
18532
|
+
function requireBase64_url_decode () {
|
|
18533
|
+
if (hasRequiredBase64_url_decode) return base64_url_decode;
|
|
18534
|
+
hasRequiredBase64_url_decode = 1;
|
|
18535
|
+
var atob = requireAtob();
|
|
18536
|
+
|
|
18537
|
+
function b64DecodeUnicode(str) {
|
|
18538
|
+
return decodeURIComponent(atob(str).replace(/(.)/g, function (m, p) {
|
|
18539
|
+
var code = p.charCodeAt(0).toString(16).toUpperCase();
|
|
18540
|
+
if (code.length < 2) {
|
|
18541
|
+
code = '0' + code;
|
|
18542
|
+
}
|
|
18543
|
+
return '%' + code;
|
|
18544
|
+
}));
|
|
18545
|
+
}
|
|
18546
|
+
|
|
18547
|
+
base64_url_decode = function(str) {
|
|
18548
|
+
var output = str.replace(/-/g, "+").replace(/_/g, "/");
|
|
18549
|
+
switch (output.length % 4) {
|
|
18550
|
+
case 0:
|
|
18551
|
+
break;
|
|
18552
|
+
case 2:
|
|
18553
|
+
output += "==";
|
|
18554
|
+
break;
|
|
18555
|
+
case 3:
|
|
18556
|
+
output += "=";
|
|
18557
|
+
break;
|
|
18558
|
+
default:
|
|
18559
|
+
throw "Illegal base64url string!";
|
|
18560
|
+
}
|
|
18561
|
+
|
|
18562
|
+
try{
|
|
18563
|
+
return b64DecodeUnicode(output);
|
|
18564
|
+
} catch (err) {
|
|
18565
|
+
return atob(output);
|
|
18566
|
+
}
|
|
18567
|
+
};
|
|
18568
|
+
return base64_url_decode;
|
|
18569
|
+
}
|
|
18570
|
+
|
|
18571
|
+
var hasRequiredLib;
|
|
18572
|
+
|
|
18573
|
+
function requireLib () {
|
|
18574
|
+
if (hasRequiredLib) return lib.exports;
|
|
18575
|
+
hasRequiredLib = 1;
|
|
18576
|
+
|
|
18577
|
+
var base64_url_decode = requireBase64_url_decode();
|
|
18578
|
+
|
|
18579
|
+
function InvalidTokenError(message) {
|
|
18580
|
+
this.message = message;
|
|
18581
|
+
}
|
|
18582
|
+
|
|
18583
|
+
InvalidTokenError.prototype = new Error();
|
|
18584
|
+
InvalidTokenError.prototype.name = 'InvalidTokenError';
|
|
18585
|
+
|
|
18586
|
+
lib.exports = function (token,options) {
|
|
18587
|
+
if (typeof token !== 'string') {
|
|
18588
|
+
throw new InvalidTokenError('Invalid token specified');
|
|
18589
|
+
}
|
|
18590
|
+
|
|
18591
|
+
options = options || {};
|
|
18592
|
+
var pos = options.header === true ? 0 : 1;
|
|
18593
|
+
try {
|
|
18594
|
+
return JSON.parse(base64_url_decode(token.split('.')[pos]));
|
|
18595
|
+
} catch (e) {
|
|
18596
|
+
throw new InvalidTokenError('Invalid token specified: ' + e.message);
|
|
18597
|
+
}
|
|
18598
|
+
};
|
|
18599
|
+
|
|
18600
|
+
lib.exports.InvalidTokenError = InvalidTokenError;
|
|
18601
|
+
return lib.exports;
|
|
18602
|
+
}
|
|
18603
|
+
|
|
18604
|
+
/**
|
|
18605
|
+
* @author Charles Markovich
|
|
18606
|
+
* @summary Check if JWT is expired
|
|
18607
|
+
* @description A global validator utility to share validation rules across all apps for a given project.
|
|
18608
|
+
* @public
|
|
18609
|
+
*/
|
|
18610
|
+
|
|
18611
|
+
var hasRequiredSrc;
|
|
18612
|
+
|
|
18613
|
+
function requireSrc () {
|
|
18614
|
+
if (hasRequiredSrc) return src;
|
|
18615
|
+
hasRequiredSrc = 1;
|
|
18616
|
+
var jwtDecode = requireLib();
|
|
18617
|
+
|
|
18618
|
+
const isJwtExpired = (token) => {
|
|
18619
|
+
if (typeof(token) !== 'string' || !token) throw new Error('Invalid token provided');
|
|
18620
|
+
|
|
18621
|
+
let isJwtExpired = false;
|
|
18622
|
+
const { exp } = jwtDecode(token);
|
|
18623
|
+
const currentTime = new Date().getTime() / 1000;
|
|
18624
|
+
|
|
18625
|
+
if (currentTime > exp) isJwtExpired = true;
|
|
18626
|
+
|
|
18627
|
+
return isJwtExpired;
|
|
18628
|
+
};
|
|
18629
|
+
|
|
18630
|
+
src.isJwtExpired = isJwtExpired;
|
|
18631
|
+
return src;
|
|
18632
|
+
}
|
|
18633
|
+
|
|
18634
|
+
var srcExports = requireSrc();
|
|
18635
|
+
|
|
18636
|
+
function isExpired(access) {
|
|
18637
|
+
return srcExports.isJwtExpired(access)
|
|
18482
18638
|
}
|
|
18483
18639
|
|
|
18484
18640
|
async function GNOSISPAY() {
|
|
18485
18641
|
|
|
18486
18642
|
try {
|
|
18487
|
-
const
|
|
18643
|
+
const access = window.localStorage.getItem('GNOSIS_PAY_ACCESS');
|
|
18488
18644
|
|
|
18489
|
-
if(!
|
|
18645
|
+
if(!access){
|
|
18490
18646
|
throw new ValidationError('Gnosispay access is required. Grant access to query your account')
|
|
18491
18647
|
}
|
|
18492
|
-
|
|
18493
|
-
if(!access?.token || isExpired(access?.createdAt)){
|
|
18648
|
+
if(!access || isExpired(access)){
|
|
18494
18649
|
throw new ValidationError('Expired or invalid access token')
|
|
18495
18650
|
}
|
|
18496
18651
|
|
|
@@ -1,3 +1,138 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
8
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
19
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
20
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
21
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
22
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
23
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
24
|
+
mod
|
|
25
|
+
));
|
|
26
|
+
|
|
27
|
+
// node_modules/jwt-decode/lib/atob.js
|
|
28
|
+
var require_atob = __commonJS({
|
|
29
|
+
"node_modules/jwt-decode/lib/atob.js"(exports, module) {
|
|
30
|
+
var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
|
|
31
|
+
function InvalidCharacterError(message) {
|
|
32
|
+
this.message = message;
|
|
33
|
+
}
|
|
34
|
+
InvalidCharacterError.prototype = new Error();
|
|
35
|
+
InvalidCharacterError.prototype.name = "InvalidCharacterError";
|
|
36
|
+
function polyfill(input) {
|
|
37
|
+
var str = String(input).replace(/=+$/, "");
|
|
38
|
+
if (str.length % 4 == 1) {
|
|
39
|
+
throw new InvalidCharacterError("'atob' failed: The string to be decoded is not correctly encoded.");
|
|
40
|
+
}
|
|
41
|
+
for (
|
|
42
|
+
var bc = 0, bs, buffer, idx = 0, output = "";
|
|
43
|
+
// get next character
|
|
44
|
+
buffer = str.charAt(idx++);
|
|
45
|
+
// character found in table? initialize bit storage and add its ascii value;
|
|
46
|
+
~buffer && (bs = bc % 4 ? bs * 64 + buffer : buffer, // and if not first of each 4 characters,
|
|
47
|
+
// convert the first 8 bits to one ascii character
|
|
48
|
+
bc++ % 4) ? output += String.fromCharCode(255 & bs >> (-2 * bc & 6)) : 0
|
|
49
|
+
) {
|
|
50
|
+
buffer = chars.indexOf(buffer);
|
|
51
|
+
}
|
|
52
|
+
return output;
|
|
53
|
+
}
|
|
54
|
+
module.exports = typeof window !== "undefined" && window.atob && window.atob.bind(window) || polyfill;
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
// node_modules/jwt-decode/lib/base64_url_decode.js
|
|
59
|
+
var require_base64_url_decode = __commonJS({
|
|
60
|
+
"node_modules/jwt-decode/lib/base64_url_decode.js"(exports, module) {
|
|
61
|
+
var atob = require_atob();
|
|
62
|
+
function b64DecodeUnicode(str) {
|
|
63
|
+
return decodeURIComponent(atob(str).replace(/(.)/g, function(m, p) {
|
|
64
|
+
var code = p.charCodeAt(0).toString(16).toUpperCase();
|
|
65
|
+
if (code.length < 2) {
|
|
66
|
+
code = "0" + code;
|
|
67
|
+
}
|
|
68
|
+
return "%" + code;
|
|
69
|
+
}));
|
|
70
|
+
}
|
|
71
|
+
module.exports = function(str) {
|
|
72
|
+
var output = str.replace(/-/g, "+").replace(/_/g, "/");
|
|
73
|
+
switch (output.length % 4) {
|
|
74
|
+
case 0:
|
|
75
|
+
break;
|
|
76
|
+
case 2:
|
|
77
|
+
output += "==";
|
|
78
|
+
break;
|
|
79
|
+
case 3:
|
|
80
|
+
output += "=";
|
|
81
|
+
break;
|
|
82
|
+
default:
|
|
83
|
+
throw "Illegal base64url string!";
|
|
84
|
+
}
|
|
85
|
+
try {
|
|
86
|
+
return b64DecodeUnicode(output);
|
|
87
|
+
} catch (err) {
|
|
88
|
+
return atob(output);
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
// node_modules/jwt-decode/lib/index.js
|
|
95
|
+
var require_lib = __commonJS({
|
|
96
|
+
"node_modules/jwt-decode/lib/index.js"(exports, module) {
|
|
97
|
+
"use strict";
|
|
98
|
+
var base64_url_decode = require_base64_url_decode();
|
|
99
|
+
function InvalidTokenError(message) {
|
|
100
|
+
this.message = message;
|
|
101
|
+
}
|
|
102
|
+
InvalidTokenError.prototype = new Error();
|
|
103
|
+
InvalidTokenError.prototype.name = "InvalidTokenError";
|
|
104
|
+
module.exports = function(token, options) {
|
|
105
|
+
if (typeof token !== "string") {
|
|
106
|
+
throw new InvalidTokenError("Invalid token specified");
|
|
107
|
+
}
|
|
108
|
+
options = options || {};
|
|
109
|
+
var pos = options.header === true ? 0 : 1;
|
|
110
|
+
try {
|
|
111
|
+
return JSON.parse(base64_url_decode(token.split(".")[pos]));
|
|
112
|
+
} catch (e) {
|
|
113
|
+
throw new InvalidTokenError("Invalid token specified: " + e.message);
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
module.exports.InvalidTokenError = InvalidTokenError;
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
// node_modules/jwt-check-expiration/src/index.js
|
|
121
|
+
var require_src = __commonJS({
|
|
122
|
+
"node_modules/jwt-check-expiration/src/index.js"(exports, module) {
|
|
123
|
+
var jwtDecode = require_lib();
|
|
124
|
+
var isJwtExpired2 = (token) => {
|
|
125
|
+
if (typeof token !== "string" || !token) throw new Error("Invalid token provided");
|
|
126
|
+
let isJwtExpired3 = false;
|
|
127
|
+
const { exp } = jwtDecode(token);
|
|
128
|
+
const currentTime = (/* @__PURE__ */ new Date()).getTime() / 1e3;
|
|
129
|
+
if (currentTime > exp) isJwtExpired3 = true;
|
|
130
|
+
return isJwtExpired3;
|
|
131
|
+
};
|
|
132
|
+
module.exports.isJwtExpired = isJwtExpired2;
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
|
|
1
136
|
// src/utils/constants.js
|
|
2
137
|
var CHAIN_ID_MAP = {
|
|
3
138
|
ethereum: 1,
|
|
@@ -800,6 +935,12 @@ var FUNCTION_LOCALE = [
|
|
|
800
935
|
p: []
|
|
801
936
|
}
|
|
802
937
|
];
|
|
938
|
+
|
|
939
|
+
// src/crypto/gnosispay/gnosispay.js
|
|
940
|
+
var import_jwt_check_expiration = __toESM(require_src(), 1);
|
|
941
|
+
function isExpired(access) {
|
|
942
|
+
return (0, import_jwt_check_expiration.isJwtExpired)(access);
|
|
943
|
+
}
|
|
803
944
|
export {
|
|
804
945
|
BLOCKSCOUT_CHAINS_MAP,
|
|
805
946
|
CHAIN_ID_MAP,
|
|
@@ -808,5 +949,6 @@ export {
|
|
|
808
949
|
MAX_PAGE_LIMIT,
|
|
809
950
|
SAFE_CHAIN_MAP,
|
|
810
951
|
SERVICES_API_KEY,
|
|
811
|
-
UTILITY
|
|
952
|
+
UTILITY,
|
|
953
|
+
isExpired as isGnosisPayAccessExpired
|
|
812
954
|
};
|
package/lib/esm/index.mjs
CHANGED
|
@@ -18473,22 +18473,177 @@ async function SMARTCONTRACT() {
|
|
|
18473
18473
|
}
|
|
18474
18474
|
}
|
|
18475
18475
|
|
|
18476
|
-
|
|
18477
|
-
|
|
18478
|
-
|
|
18479
|
-
|
|
18476
|
+
var src = {};
|
|
18477
|
+
|
|
18478
|
+
var lib = {exports: {}};
|
|
18479
|
+
|
|
18480
|
+
/**
|
|
18481
|
+
* The code was extracted from:
|
|
18482
|
+
* https://github.com/davidchambers/Base64.js
|
|
18483
|
+
*/
|
|
18484
|
+
|
|
18485
|
+
var atob$1;
|
|
18486
|
+
var hasRequiredAtob;
|
|
18487
|
+
|
|
18488
|
+
function requireAtob () {
|
|
18489
|
+
if (hasRequiredAtob) return atob$1;
|
|
18490
|
+
hasRequiredAtob = 1;
|
|
18491
|
+
var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
|
|
18492
|
+
|
|
18493
|
+
function InvalidCharacterError(message) {
|
|
18494
|
+
this.message = message;
|
|
18495
|
+
}
|
|
18496
|
+
|
|
18497
|
+
InvalidCharacterError.prototype = new Error();
|
|
18498
|
+
InvalidCharacterError.prototype.name = 'InvalidCharacterError';
|
|
18499
|
+
|
|
18500
|
+
function polyfill (input) {
|
|
18501
|
+
var str = String(input).replace(/=+$/, '');
|
|
18502
|
+
if (str.length % 4 == 1) {
|
|
18503
|
+
throw new InvalidCharacterError("'atob' failed: The string to be decoded is not correctly encoded.");
|
|
18504
|
+
}
|
|
18505
|
+
for (
|
|
18506
|
+
// initialize result and counters
|
|
18507
|
+
var bc = 0, bs, buffer, idx = 0, output = '';
|
|
18508
|
+
// get next character
|
|
18509
|
+
buffer = str.charAt(idx++);
|
|
18510
|
+
// character found in table? initialize bit storage and add its ascii value;
|
|
18511
|
+
~buffer && (bs = bc % 4 ? bs * 64 + buffer : buffer,
|
|
18512
|
+
// and if not first of each 4 characters,
|
|
18513
|
+
// convert the first 8 bits to one ascii character
|
|
18514
|
+
bc++ % 4) ? output += String.fromCharCode(255 & bs >> (-2 * bc & 6)) : 0
|
|
18515
|
+
) {
|
|
18516
|
+
// try to find character in table (0-63, not found => -1)
|
|
18517
|
+
buffer = chars.indexOf(buffer);
|
|
18518
|
+
}
|
|
18519
|
+
return output;
|
|
18520
|
+
}
|
|
18521
|
+
|
|
18522
|
+
|
|
18523
|
+
atob$1 = typeof window !== 'undefined' && window.atob && window.atob.bind(window) || polyfill;
|
|
18524
|
+
return atob$1;
|
|
18525
|
+
}
|
|
18526
|
+
|
|
18527
|
+
var base64_url_decode;
|
|
18528
|
+
var hasRequiredBase64_url_decode;
|
|
18529
|
+
|
|
18530
|
+
function requireBase64_url_decode () {
|
|
18531
|
+
if (hasRequiredBase64_url_decode) return base64_url_decode;
|
|
18532
|
+
hasRequiredBase64_url_decode = 1;
|
|
18533
|
+
var atob = requireAtob();
|
|
18534
|
+
|
|
18535
|
+
function b64DecodeUnicode(str) {
|
|
18536
|
+
return decodeURIComponent(atob(str).replace(/(.)/g, function (m, p) {
|
|
18537
|
+
var code = p.charCodeAt(0).toString(16).toUpperCase();
|
|
18538
|
+
if (code.length < 2) {
|
|
18539
|
+
code = '0' + code;
|
|
18540
|
+
}
|
|
18541
|
+
return '%' + code;
|
|
18542
|
+
}));
|
|
18543
|
+
}
|
|
18544
|
+
|
|
18545
|
+
base64_url_decode = function(str) {
|
|
18546
|
+
var output = str.replace(/-/g, "+").replace(/_/g, "/");
|
|
18547
|
+
switch (output.length % 4) {
|
|
18548
|
+
case 0:
|
|
18549
|
+
break;
|
|
18550
|
+
case 2:
|
|
18551
|
+
output += "==";
|
|
18552
|
+
break;
|
|
18553
|
+
case 3:
|
|
18554
|
+
output += "=";
|
|
18555
|
+
break;
|
|
18556
|
+
default:
|
|
18557
|
+
throw "Illegal base64url string!";
|
|
18558
|
+
}
|
|
18559
|
+
|
|
18560
|
+
try{
|
|
18561
|
+
return b64DecodeUnicode(output);
|
|
18562
|
+
} catch (err) {
|
|
18563
|
+
return atob(output);
|
|
18564
|
+
}
|
|
18565
|
+
};
|
|
18566
|
+
return base64_url_decode;
|
|
18567
|
+
}
|
|
18568
|
+
|
|
18569
|
+
var hasRequiredLib;
|
|
18570
|
+
|
|
18571
|
+
function requireLib () {
|
|
18572
|
+
if (hasRequiredLib) return lib.exports;
|
|
18573
|
+
hasRequiredLib = 1;
|
|
18574
|
+
|
|
18575
|
+
var base64_url_decode = requireBase64_url_decode();
|
|
18576
|
+
|
|
18577
|
+
function InvalidTokenError(message) {
|
|
18578
|
+
this.message = message;
|
|
18579
|
+
}
|
|
18580
|
+
|
|
18581
|
+
InvalidTokenError.prototype = new Error();
|
|
18582
|
+
InvalidTokenError.prototype.name = 'InvalidTokenError';
|
|
18583
|
+
|
|
18584
|
+
lib.exports = function (token,options) {
|
|
18585
|
+
if (typeof token !== 'string') {
|
|
18586
|
+
throw new InvalidTokenError('Invalid token specified');
|
|
18587
|
+
}
|
|
18588
|
+
|
|
18589
|
+
options = options || {};
|
|
18590
|
+
var pos = options.header === true ? 0 : 1;
|
|
18591
|
+
try {
|
|
18592
|
+
return JSON.parse(base64_url_decode(token.split('.')[pos]));
|
|
18593
|
+
} catch (e) {
|
|
18594
|
+
throw new InvalidTokenError('Invalid token specified: ' + e.message);
|
|
18595
|
+
}
|
|
18596
|
+
};
|
|
18597
|
+
|
|
18598
|
+
lib.exports.InvalidTokenError = InvalidTokenError;
|
|
18599
|
+
return lib.exports;
|
|
18600
|
+
}
|
|
18601
|
+
|
|
18602
|
+
/**
|
|
18603
|
+
* @author Charles Markovich
|
|
18604
|
+
* @summary Check if JWT is expired
|
|
18605
|
+
* @description A global validator utility to share validation rules across all apps for a given project.
|
|
18606
|
+
* @public
|
|
18607
|
+
*/
|
|
18608
|
+
|
|
18609
|
+
var hasRequiredSrc;
|
|
18610
|
+
|
|
18611
|
+
function requireSrc () {
|
|
18612
|
+
if (hasRequiredSrc) return src;
|
|
18613
|
+
hasRequiredSrc = 1;
|
|
18614
|
+
var jwtDecode = requireLib();
|
|
18615
|
+
|
|
18616
|
+
const isJwtExpired = (token) => {
|
|
18617
|
+
if (typeof(token) !== 'string' || !token) throw new Error('Invalid token provided');
|
|
18618
|
+
|
|
18619
|
+
let isJwtExpired = false;
|
|
18620
|
+
const { exp } = jwtDecode(token);
|
|
18621
|
+
const currentTime = new Date().getTime() / 1000;
|
|
18622
|
+
|
|
18623
|
+
if (currentTime > exp) isJwtExpired = true;
|
|
18624
|
+
|
|
18625
|
+
return isJwtExpired;
|
|
18626
|
+
};
|
|
18627
|
+
|
|
18628
|
+
src.isJwtExpired = isJwtExpired;
|
|
18629
|
+
return src;
|
|
18630
|
+
}
|
|
18631
|
+
|
|
18632
|
+
var srcExports = requireSrc();
|
|
18633
|
+
|
|
18634
|
+
function isExpired(access) {
|
|
18635
|
+
return srcExports.isJwtExpired(access)
|
|
18480
18636
|
}
|
|
18481
18637
|
|
|
18482
18638
|
async function GNOSISPAY() {
|
|
18483
18639
|
|
|
18484
18640
|
try {
|
|
18485
|
-
const
|
|
18641
|
+
const access = window.localStorage.getItem('GNOSIS_PAY_ACCESS');
|
|
18486
18642
|
|
|
18487
|
-
if(!
|
|
18643
|
+
if(!access){
|
|
18488
18644
|
throw new ValidationError('Gnosispay access is required. Grant access to query your account')
|
|
18489
18645
|
}
|
|
18490
|
-
|
|
18491
|
-
if(!access?.token || isExpired(access?.createdAt)){
|
|
18646
|
+
if(!access || isExpired(access)){
|
|
18492
18647
|
throw new ValidationError('Expired or invalid access token')
|
|
18493
18648
|
}
|
|
18494
18649
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fileverse-dev/formulajs",
|
|
3
|
-
"version": "4.4.11-mod-
|
|
3
|
+
"version": "4.4.11-mod-91",
|
|
4
4
|
"description": "JavaScript implementation of most Microsoft Excel formula functions",
|
|
5
5
|
"author": "Formulajs",
|
|
6
6
|
"publishConfig": {
|
|
@@ -65,6 +65,7 @@
|
|
|
65
65
|
"esbuild": "^0.25.4",
|
|
66
66
|
"js-sha3": "^0.9.3",
|
|
67
67
|
"jstat": "^1.9.6",
|
|
68
|
+
"jwt-check-expiration": "^1.0.5",
|
|
68
69
|
"zod": "^3.25.71"
|
|
69
70
|
},
|
|
70
71
|
"devDependencies": {
|