Resolve #303 isString() error

This commit is contained in:
the-djmaze 2022-03-24 13:23:52 +01:00
parent 049350b112
commit 99ffb986f1
2 changed files with 31 additions and 31 deletions

View file

@ -1,5 +1,5 @@
import { SettingsCapa, SettingsGet } from 'Common/Globals'; import { SettingsCapa, SettingsGet } from 'Common/Globals';
import { staticLink } from 'Common/Links'; //import { staticLink } from 'Common/Links';
//import { showScreenPopup } from 'Knoin/Knoin'; //import { showScreenPopup } from 'Knoin/Knoin';
@ -22,7 +22,8 @@ export const
init() { init() {
if (SettingsCapa('OpenPGP') && window.crypto && crypto.getRandomValues) { if (SettingsCapa('OpenPGP') && window.crypto && crypto.getRandomValues) {
rl.loadScript(staticLink('js/min/openpgp.min.js')) rl.loadScript(SettingsGet('StaticLibsJs').replace('/libs.', '/openpgp.'))
// rl.loadScript(staticLink('js/min/openpgp.min.js'))
.then(() => this.loadKeyrings()) .then(() => this.loadKeyrings())
.catch(e => { .catch(e => {
this.loadKeyrings(); this.loadKeyrings();

View file

@ -1455,16 +1455,15 @@ var openpgp = (function (exports) {
async function getBigInteger() { async function getBigInteger() {
if (util.detectBigInt()) { if (util.detectBigInt()) {
return BigInteger$1; return BigInteger$1;
} else {
const { default: BigInteger } = await Promise.resolve().then(function () { return bn_interface; });
return BigInteger;
} }
const { default: BigInteger } = await Promise.resolve().then(function () { return bn_interface; });
return BigInteger;
} }
// GPG4Browsers - An OpenPGP implementation in javascript // GPG4Browsers - An OpenPGP implementation in javascript
const util = { const util = {
isString: data => typeof data === 'string' || Object.prototype.isPrototypeOf.call(data, String), isString: data => null != data && (typeof data === 'string' || Object.prototype.isPrototypeOf.call(data, String)),
isArray: data => Array.isArray(data), isArray: data => Array.isArray(data),
@ -7439,7 +7438,7 @@ var openpgp = (function (exports) {
f = H5; f = H5;
g = H6; g = H6;
h = H7; h = H7;
// 0 // 0
h = ( w0 + h + ( e>>>6 ^ e>>>11 ^ e>>>25 ^ e<<26 ^ e<<21 ^ e<<7 ) + ( g ^ e & (f^g) ) + 0x428a2f98 )|0; h = ( w0 + h + ( e>>>6 ^ e>>>11 ^ e>>>25 ^ e<<26 ^ e<<21 ^ e<<7 ) + ( g ^ e & (f^g) ) + 0x428a2f98 )|0;
d = ( d + h )|0; d = ( d + h )|0;
@ -14810,10 +14809,10 @@ var openpgp = (function (exports) {
// reduce buffer size, avoiding mem copy // reduce buffer size, avoiding mem copy
function shrinkBuf(buf, size) { function shrinkBuf(buf, size) {
if (buf.length === size) { if (buf.length === size) {
return buf; return buf;
} }
if (buf.subarray) { if (buf.subarray) {
return buf.subarray(0, size); return buf.subarray(0, size);
} }
buf.length = size; buf.length = size;
return buf; return buf;
@ -14938,8 +14937,8 @@ var openpgp = (function (exports) {
function zero$1(buf) { function zero$1(buf) {
let len = buf.length; while (--len >= 0) { let len = buf.length; while (--len >= 0) {
buf[len] = 0; buf[len] = 0;
} }
} }
// From zutil.h // From zutil.h
@ -15209,7 +15208,7 @@ var openpgp = (function (exports) {
/* We overwrite tree[n].Dad which is no longer needed */ /* We overwrite tree[n].Dad which is no longer needed */
if (n > max_code) { if (n > max_code) {
continue; continue;
} /* not a leaf node */ } /* not a leaf node */
s.bl_count[bits]++; s.bl_count[bits]++;
@ -15224,7 +15223,7 @@ var openpgp = (function (exports) {
} }
} }
if (overflow === 0) { if (overflow === 0) {
return; return;
} }
// Trace((stderr,"\nbit length overflow\n")); // Trace((stderr,"\nbit length overflow\n"));
@ -15234,7 +15233,7 @@ var openpgp = (function (exports) {
do { do {
bits = max_length - 1; bits = max_length - 1;
while (s.bl_count[bits] === 0) { while (s.bl_count[bits] === 0) {
bits--; bits--;
} }
s.bl_count[bits]--; /* move one leaf down the tree */ s.bl_count[bits]--; /* move one leaf down the tree */
s.bl_count[bits + 1] += 2; /* move one overflow item as its brother */ s.bl_count[bits + 1] += 2; /* move one overflow item as its brother */
@ -15255,7 +15254,7 @@ var openpgp = (function (exports) {
while (n !== 0) { while (n !== 0) {
m = s.heap[--h]; m = s.heap[--h];
if (m > max_code) { if (m > max_code) {
continue; continue;
} }
if (tree[m * 2 + 1]/*.Len*/ !== bits) { if (tree[m * 2 + 1]/*.Len*/ !== bits) {
// Trace((stderr,"code %d bits %d->%d\n", m, tree[m].Len, bits)); // Trace((stderr,"code %d bits %d->%d\n", m, tree[m].Len, bits));
@ -15302,7 +15301,7 @@ var openpgp = (function (exports) {
for (n = 0; n <= max_code; n++) { for (n = 0; n <= max_code; n++) {
const len = tree[n * 2 + 1]/*.Len*/; const len = tree[n * 2 + 1]/*.Len*/;
if (len === 0) { if (len === 0) {
continue; continue;
} }
/* Now reverse the bits */ /* Now reverse the bits */
tree[n * 2]/*.Code*/ = bi_reverse(next_code[len]++, len); tree[n * 2]/*.Code*/ = bi_reverse(next_code[len]++, len);
@ -15425,13 +15424,13 @@ var openpgp = (function (exports) {
/* Initialize the trees. */ /* Initialize the trees. */
for (n = 0; n < L_CODES$1; n++) { for (n = 0; n < L_CODES$1; n++) {
s.dyn_ltree[n * 2]/*.Freq*/ = 0; s.dyn_ltree[n * 2]/*.Freq*/ = 0;
} }
for (n = 0; n < D_CODES$1; n++) { for (n = 0; n < D_CODES$1; n++) {
s.dyn_dtree[n * 2]/*.Freq*/ = 0; s.dyn_dtree[n * 2]/*.Freq*/ = 0;
} }
for (n = 0; n < BL_CODES$1; n++) { for (n = 0; n < BL_CODES$1; n++) {
s.bl_tree[n * 2]/*.Freq*/ = 0; s.bl_tree[n * 2]/*.Freq*/ = 0;
} }
s.dyn_ltree[END_BLOCK * 2]/*.Freq*/ = 1; s.dyn_ltree[END_BLOCK * 2]/*.Freq*/ = 1;
@ -15509,7 +15508,7 @@ var openpgp = (function (exports) {
} }
/* Exit if v is smaller than both sons */ /* Exit if v is smaller than both sons */
if (smaller(tree, v, s.heap[j], s.depth)) { if (smaller(tree, v, s.heap[j], s.depth)) {
break; break;
} }
/* Exchange v with the smallest son */ /* Exchange v with the smallest son */
@ -15640,7 +15639,7 @@ var openpgp = (function (exports) {
* establish sub-heaps of increasing lengths: * establish sub-heaps of increasing lengths:
*/ */
for (n = s.heap_len >> 1/*int /2*/; n >= 1; n--) { for (n = s.heap_len >> 1/*int /2*/; n >= 1; n--) {
pqdownheap(s, tree, n); pqdownheap(s, tree, n);
} }
/* Construct the Huffman tree by repeatedly combining the least two /* Construct the Huffman tree by repeatedly combining the least two
@ -15721,7 +15720,7 @@ var openpgp = (function (exports) {
} else if (curlen !== 0) { } else if (curlen !== 0) {
if (curlen !== prevlen) { if (curlen !== prevlen) {
s.bl_tree[curlen * 2]/*.Freq*/++; s.bl_tree[curlen * 2]/*.Freq*/++;
} }
s.bl_tree[REP_3_6 * 2]/*.Freq*/++; s.bl_tree[REP_3_6 * 2]/*.Freq*/++;
@ -15785,7 +15784,7 @@ var openpgp = (function (exports) {
} else if (count < min_count) { } else if (count < min_count) {
do { do {
send_code(s, curlen, s.bl_tree); send_code(s, curlen, s.bl_tree);
} while (--count !== 0); } while (--count !== 0);
} else if (curlen !== 0) { } else if (curlen !== 0) {
@ -16033,7 +16032,7 @@ var openpgp = (function (exports) {
// s->last_lit)); // s->last_lit));
if (static_lenb <= opt_lenb) { if (static_lenb <= opt_lenb) {
opt_lenb = static_lenb; opt_lenb = static_lenb;
} }
} else { } else {
@ -18048,11 +18047,11 @@ var openpgp = (function (exports) {
// String encode/decode helpers // String encode/decode helpers
try { try {
String.fromCharCode.apply(null, [ 0 ]); String.fromCharCode.apply(null, [ 0 ]);
} catch (__) { } catch (__) {
} }
try { try {
String.fromCharCode.apply(null, new Uint8Array(1)); String.fromCharCode.apply(null, new Uint8Array(1));
} catch (__) { } catch (__) {
} }
@ -18880,7 +18879,7 @@ var openpgp = (function (exports) {
root = bits; root = bits;
for (max = MAXBITS; max >= 1; max--) { for (max = MAXBITS; max >= 1; max--) {
if (count[max] !== 0) { if (count[max] !== 0) {
break; break;
} }
} }
if (root > max) { if (root > max) {
@ -18903,7 +18902,7 @@ var openpgp = (function (exports) {
} }
for (min = 1; min < max; min++) { for (min = 1; min < max; min++) {
if (count[min] !== 0) { if (count[min] !== 0) {
break; break;
} }
} }
if (root < min) { if (root < min) {
@ -19044,7 +19043,7 @@ var openpgp = (function (exports) {
sym++; sym++;
if (--count[len] === 0) { if (--count[len] === 0) {
if (len === max) { if (len === max) {
break; break;
} }
len = lens[lens_index + work[sym]]; len = lens[lens_index + work[sym]];
} }
@ -19065,7 +19064,7 @@ var openpgp = (function (exports) {
while (curr + drop < max) { while (curr + drop < max) {
left -= count[curr + drop]; left -= count[curr + drop];
if (left <= 0) { if (left <= 0) {
break; break;
} }
curr++; curr++;
left <<= 1; left <<= 1;
@ -28260,7 +28259,7 @@ var openpgp = (function (exports) {
async function generate(options, config) { async function generate(options, config) {
options.sign = true; // primary key is always a signing key options.sign = true; // primary key is always a signing key
options = sanitizeKeyOptions(options); options = sanitizeKeyOptions(options);
options.subkeys = options.subkeys.map((subkey, index) => sanitizeKeyOptions(options.subkeys[index], options)); options.subkeys = options.subkeys.map((subkey, index) => sanitizeKeyOptions(subkey, options));
let promises = [generateSecretKey(options, config)]; let promises = [generateSecretKey(options, config)];
promises = promises.concat(options.subkeys.map(options => generateSecretSubkey(options, config))); promises = promises.concat(options.subkeys.map(options => generateSecretSubkey(options, config)));
const packets = await Promise.all(promises); const packets = await Promise.all(promises);