diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml new file mode 100644 index 0000000..d74b0d7 --- /dev/null +++ b/.idea/workspace.xml @@ -0,0 +1,57 @@ + + + + + + + + + + + + + + + + + + + + + + + 1705013062691 + + + + + + \ No newline at end of file diff --git a/lib/curve.js b/lib/curve.js index 94f4390..3f46ce5 100644 --- a/lib/curve.js +++ b/lib/curve.js @@ -249,7 +249,7 @@ class Curve { let ret; do { - let rand8 = new global.Uint8Array(words); + let rand8 = new window.Uint8Array(words); rand8 = random(rand8); ret = new Field(rand8, "buf8", this); } while (this.order.less(ret)); @@ -323,7 +323,7 @@ class Curve { } calc_modulus() { - const ret = new global.Uint32Array(this.mod_words); + const ret = new window.Uint32Array(this.mod_words); ret[0] = 1; let word = Math.floor(this.m / 32); diff --git a/lib/models/Priv.js b/lib/models/Priv.js index 3863f6c..6b68e0d 100644 --- a/lib/models/Priv.js +++ b/lib/models/Priv.js @@ -205,7 +205,7 @@ Priv.prototype.decrypt = function(data, pubkey, param, algo) { }; Priv.prototype.encrypt = function(data, cert, algo) { - var crypto = global.crypto; + var crypto = window.crypto; var cek = random(Buffer.alloc(32)), ukm = random(Buffer.alloc(64)), diff --git a/lib/rand.browser.js b/lib/rand.browser.js index 32ddf6b..a0185ad 100644 --- a/lib/rand.browser.js +++ b/lib/rand.browser.js @@ -1,3 +1,3 @@ module.exports = function (fill) { - return (global.crypto || global.msCrypto).getRandomValues(fill); + return (window.crypto || window.msCrypto).getRandomValues(fill); }