ffjavascript
Advanced tools
Comparing version 0.2.38 to 0.2.39
{ | ||
"name": "ffjavascript", | ||
"type": "module", | ||
"version": "0.2.38", | ||
"version": "0.2.39", | ||
"description": "Finite Field Library in Javascript", | ||
@@ -42,3 +42,3 @@ "main": "./build/main.cjs", | ||
"chai": "^4.2.0", | ||
"eslint": "^6.8.0", | ||
"eslint": "^8.0.1", | ||
"mocha": "^8.2.1", | ||
@@ -45,0 +45,0 @@ "rollup": "^2.38.5" |
@@ -5,7 +5,7 @@ import wasmcurves from "wasmcurves"; | ||
global.curve_bls12381 = null; | ||
globalThis.curve_bls12381 = null; | ||
export default async function buildBls12381(singleThread) { | ||
if ((!singleThread)&&(global.curve_bls12381)) return global.curve_bls12381; | ||
if ((!singleThread)&&(globalThis.curve_bls12381)) return globalThis.curve_bls12381; | ||
const params = { | ||
@@ -26,3 +26,3 @@ name: "bls12381", | ||
if (!params.singleThread) { | ||
global.curve_bls12381 = null; | ||
globalThis.curve_bls12381 = null; | ||
await this.tm.terminate(); | ||
@@ -29,0 +29,0 @@ } |
@@ -5,7 +5,7 @@ import wasmcurves from "wasmcurves"; | ||
global.curve_bn128 = null; | ||
globalThis.curve_bn128 = null; | ||
export default async function buildBn128(singleThread) { | ||
if ((!singleThread)&&(global.curve_bn128)) return global.curve_bn128; | ||
if ((!singleThread)&&(globalThis.curve_bn128)) return globalThis.curve_bn128; | ||
const params = { | ||
@@ -25,3 +25,3 @@ name: "bn128", | ||
if (!params.singleThread) { | ||
global.curve_bn128 = null; | ||
globalThis.curve_bn128 = null; | ||
await this.tm.terminate(); | ||
@@ -32,3 +32,3 @@ } | ||
if (!singleThread) { | ||
global.curve_bn128 = curve; | ||
globalThis.curve_bn128 = curve; | ||
} | ||
@@ -35,0 +35,0 @@ |
@@ -1,2 +0,1 @@ | ||
/* global window */ | ||
import ChaCha from "./chacha.js"; | ||
@@ -7,5 +6,5 @@ import crypto from "crypto"; | ||
let array = new Uint8Array(n); | ||
if (typeof window !== "undefined") { // Browser | ||
if (typeof window.crypto !== "undefined") { // Supported | ||
window.crypto.getRandomValues(array); | ||
if (process.browser) { // Browser | ||
if (typeof globalThis.crypto !== "undefined") { // Supported | ||
globalThis.crypto.getRandomValues(array); | ||
} else { // fallback | ||
@@ -12,0 +11,0 @@ for (let i=0; i<n; i++) { |
@@ -1,2 +0,2 @@ | ||
/* global window, navigator, Blob, Worker, WebAssembly */ | ||
/* global navigator, WebAssembly */ | ||
/* | ||
@@ -44,3 +44,3 @@ Copyright 2019 0KIMS association. | ||
if (process.browser) { | ||
var binary_string = window.atob(base64); | ||
var binary_string = globalThis.atob(base64); | ||
var len = binary_string.length; | ||
@@ -59,3 +59,3 @@ var bytes = new Uint8Array(len); | ||
if (process.browser) { | ||
return window.btoa(str); | ||
return globalThis.btoa(str); | ||
} else { | ||
@@ -62,0 +62,0 @@ return Buffer.from(str).toString("base64"); |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
436153
11819